Log in

View Full Version : Once more I need Help...



jad9321
07-08-2006, 02:36 AM
Ok,
Once more I need help. I have this script

<?PHP
$yourFile = "dbinfo.php";
if(!$_POST['submit']) {
$fs = fopen($yourFile, "r");
while(!feof($fs)) {
$fileData = fread($fs, 1024);
}
}else{
$fs = fopen($yourFile, "w");
fwrite($fs, $_POST['fileData']);
}
fclose($fs);
?>
<form method="POST">
<?PHP print $yourFile; ?>'s contents:
<textarea name="fileData" rows=5 cols=100><?PHP print $fileData; ?></textarea><br />
<input type="submit" value="Save" name="submit">
</form>

And when I change the php file from within there after I save it puts odd /'s in the php file at random places... :/

Twey
07-08-2006, 02:54 AM
fwrite($fs, stripslashes (http://www.php.net/stripslashes)($_POST['fileData']));

jad9321
07-08-2006, 02:59 AM
where do I put that? Just anyware?

Twey
07-08-2006, 03:54 AM
In place of the existing fwrite() call :)