PX : code

Edit page by Klaus Hansen
Download this code


<?PHP
/*
   Edit page script by Klaus Hansen <krh@wiktor.dk>
   Send please comments to me...
   I need a password proction on this page..
   V 0.9
   1. relase


 */
 
function write_file($filename$contents) {
 if (
$fp fopen($filename"w")) {
        
fwrite ($fpstripslashes($contents));
        
fclose($fp);
        return 
1;
        }
 else { return 
0; }
        };

if (
$submitButton == "done")
{
$rs write_file("$page""$test"" ");
echo 
"<a href=\"$page\">$page</A><BR>     ";

}
elseif (
$action == "page")
{
     
$content "$page";
$fp fopen($content'r' ) or die ('Could not open file.'); 
$contents fread($fpfilesize($content)) or die('Could not read from file.'); 
$contents htmlspecialchars($contents); 
fclose($fp); 

echo 
"<form action=\"admin.php3?page=$page\" method=\"POST\">";
echo 
"<textarea name=test rows=20 cols=70 wrap=soft> ";
echo 
$contents;
echo 
"</textarea>";
echo 
"<INPUT type=\"submit\" NAME=\"submitButton\" VALUE=\"done\">";
echo 
"</form>";
}
else
{
echo 
"<form action=\"admin.php3?action=page\" method=\"POST\">";
echo 
"<input type=text size=20 name=page>";
echo 
"<input type=submit name=Send value=Send>";
echo 
"</form>";
}
?>

Comments or questions?
PX is running PHP 5.2.17
Thanks to Miranda Productions for hosting and bandwidth.
Use of any code from PX is at your own risk.