Hello, and happy 4th of July
I got this script from here:
Online File Editing ScriptIt looks to be JUST what I need, but while it will load the specified text file, it will not save the edits.
It just reloads the page with the prior text still intact.
While I am using the same code as the author, I believe, I will post it below in the event I missed something.
CODE
<?php
$loadcontent = "testit.txt";
if($save_file) {
$savecontent = stripslashes($savecontent);
$fp = @fopen($loadcontent, "w");
if ($fp) {
fwrite($fp, $savecontent);
fclose($fp);
} else
echo "Error opening file";
}
$fp = @fopen($loadcontent, "r");
$loadcontent = fread($fp, filesize($loadcontent));
$loadcontent = htmlspecialchars($loadcontent);
fclose($fp);
?>
<form method=post action="<?=$_SERVER['PHP_SELF']?>">
<textarea name="savecontent" cols="70" rows="25"><?php echo $loadcontent; ?> </textarea>
<br>
<input type="submit" name="save_file" value="Save">
</form>
I am on a Linux server, and I tried setting the permissions to both the PHP file AND the text file (testit.txt) to 755, 666, and finally, to 777 just to rule out a permissions thing.
I would have posted this question on the board where the program was initially posted, except that another user was having the same problem as me, and no answer was ever given after several months.
Any clues people?
Thx,
Rick