Jump to content

Archived

This topic is now archived and is closed to further replies.

marcus

help with file editing (found a script)

Recommended Posts

ok, here is my code

[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>
[/code]

and here is the error i get

[code]
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
[/code]

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.