Jump to content


Photo

help with file editing (found a script)


  • This topic is locked This topic is locked
No replies to this topic

#1 marcus

marcus
  • Members
  • PipPipPip
  • Advanced Member
  • 1,842 posts
  • LocationRochester, NY

Posted 16 October 2006 - 12:24 AM

ok, here is my code

<?php
$loadcontent = "$_GET[page]";
if($save_file) {
$savecontent = stripslashes($savecontent);
$fp = @fopen($loadcontent, "w");
if ($fp) {
fwrite($fp, $savecontent);
fclose($fp);
}
}
$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"><?=$loadcontent?></textarea>
<br>
<input type="submit" name="save_file" value="Save">
</form>

and here is the error i get

Warning: fread(): supplied argument is not a valid stream resource in /home/neoblob/public_html/php/3/edit.php on line 12
Warning: fclose(): supplied argument is not a valid stream resource in /home/neoblob/public_html/php/3/edit.php on line 14





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users