| px | top | add code | search | signup | login | help |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>write direct file Protect file</title>
</head>
<!--- questions info@ticinonline.to .it .de .fr or bad .en --->
<body bgcolor="#FFFFD5">
<?php
$adesso = date( "d M y");
echo"<b>write direct</b><br>";
function write_file($filename, $scrivinelfile) {
if ($fp = fopen($filename, "w")) {
fwrite ($fp, stripslashes($scrivinelfile));
fclose($fp);
return 1;
}
else { return 0; }
};
echO"$adesso <br>";
if ($submitButton == "done")
{
$poi=eregi_replace(" ","_",$titolo);
$filename=strtolower($poi);
$doc=nl2br($contents);
$scrivinelfile= "<? include ('headerfooter.php3'); header ('$titolo - / $curdate',' $titolo' ); ?>"; //print file + header footer function
$scrivinelfile.= "<title>$titolo</title>";
$scrivinelfile.= "<? include ('menu.php3'); ?>";
$scrivinelfile.= "<center><h2>$titolo</h2></center>";
$scrivinelfile.= "<blockquote>$doc</blockquote>";
$scrivinelfile.= "<br><br><div align='center'><a href='http://www.jazzascona.ch/' target='_top'>www.jazzascona.ch</a></div><? footer ( ) ?>\n";
write_file ("../$filename.html","$scrivinelfile");
$forumdb="../_menu1.txt";
$menu= "<!--- inizio-$filename ---><? if(ereg(\"$filename\", \$REQUEST_URI)) {\n"; //print nav menu
$menu.= "print\"$adesso :<br><p class='nolink'>$titolo</p>\";\n";
$menu.= "}\n";
$menu.= "else {\n";
$menu.= "print\"$adesso :<br><a href='$filename.html'>$titolo</a><br>\";\n";
$menu.= "}\n";
$menu.= "?><!--- fine-$filename --->\n";
$fpn=@fopen($forumdb.".tmp","w");
fputs($fpn,$menu);
$fp=@fopen($forumdb,"r");
if($fp<=0) {
echo"Error";
}
while(!feof($fp)) {
$zeile=fgets($fp,32000);
fputs($fpn,$zeile);
}
fclose($fp);
fclose($fpn);
unlink($forumdb);
rename($forumdb.".tmp",$forumdb);
}
?><br>
<form action="write.php3" method="POST">
<input type="Text" name="titolo" size="20" maxlength="20"> TITLE<br>
<textarea name="contents" cols="55" rows="10" wrap="PHYSICAL">
</textarea> TEXT<br>
<input type="Submit" name="submitButton" value="done"></form> SAVE DIRECT (done)<br><br>
<?php echo"<a href='../$filename.html' target='_blank'>$filename</a>"; ?><br>
<a href="write.php3">new write</a><br>
Comments or questions?
PX is running PHP 5.2.11
Thanks to Miranda Productions for hosting and bandwidth.
Use of any code from PX is at your own risk.