June 29th, 2000, 11:39 AM
-
I am using this script to edit an HTML file on a web server:
<BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">code:</font><HR><pre>
<html>
<head>
<title>Editing <? print "$file"; ?></title>
</head>
<body>
<form method=POST action="save_file.php3">
<b><u><? print "$file"; ?></u></b><br><br>
<textarea name="data" rows=10 cols=70>
<?
if (file_exists("$file"))
{readfile("$file");}
?>
</textarea><br><br>
<input type="hidden" name="file" value="<? print "$file"; ?>">
<input type="submit" name="submit" value="Save Changes">
</form>
</body></html>
-----save_file.php3-----
<?
$f = fopen("$file", "w");
fputs($f, $data);
fclose($f);
print "File $file has been amended!";
?>
[/code]
But the problem I am having is that when there are single quotes in the file, they get "escaped" by a backslash. My guess is that I need to enable Magic Quotes at runtime, but how do I do that on my win32 machine in the PHP script? If it's not magic quotes that I need to change then can someone tell me what it is that I need to change. Thanks.
------------------
------------------------
Alex
(http://www.alex-greg.co.uk)
June 29th, 2000, 03:27 PM
-
You need to disable magic quotes gpc from your php.ini file, or failing that just use $file=stripslashes($file).