10-21-2011, 04:25 PM
I can seem to find any reference to the "undefined index: page"...
And yet your script tries to locate it...
Cleared and should work, still not secure though...
Study the script and look at the changes before you just go on copy-pasting...
Code:
<form action="<?php echo $_SERVER["PHP_SELF"] ?>" method="post">
<textarea rows="10" cols="100" name="content"><?php readfile($fn); ?></textarea><br />
<input type="submit" value="Save" VALUE="Refresh">
</form>
And yet your script tries to locate it...
PHP Code:
$firstfile = $_POST['page'];
Cleared and should work, still not secure though...
Study the script and look at the changes before you just go on copy-pasting...
Code:
<?php
$firstfile = (isset($_POST['page'])) ? $_POST['page'] : ((isset($_GET['page'])) ? $_GET['page'] : '');
echo $firstfile; // the file is shown, and is there
$fn = $firstfile; // totally wasting resources and space: lulz
if (isset($_POST['content']))
{
$content = stripslashes($_POST['content']);
$fp = fopen($fn,"w") or die ("Error opening file in write mode!"); // fopen($firstfile) // remove $fn
fputs($fp,$content);
fclose($fp) or die ("Error closing file!");
}
?>
<form action="<?php echo $_SERVER["PHP_SELF"].'?page={$firstfile}' ?>" method="post">
<input type="text" name="page" value="{$firstfile}" /><br />
<textarea rows="10" cols="100" name="content"><?php readfile($fn); ?></textarea><br />
<input type="submit" value="Save" VALUE="Refresh">
</form>