fwrite adding quotes
Posted: Sun Apr 23, 2006 9:14 pm
I have a script that takes a config file and edits it.
Then the edit's are passed using a form and POST to a file named update_config.php, the code is:
But when it writes the new config file, it takes a variable such as and changes it to and if theres something like it changes it to How can I get it not to add the \ before the " and '?
Then the edit's are passed using a form and POST to a file named update_config.php, the code is:
Code: Select all
<? include('../../config.php'); ?>
<?php
$ip = $_POST['ip'];
$submit = $_POST['submit'];
unlink("../config.php");
touch("../config.php");
$filename = "../config.php";
$fp = fopen($filename, "w") or die("Could not open $filename");
fwrite($fp, "$ip");
fclose($fp);
echo "Updated, please <a href=\"configure.php\">click here</a> to go back";
?>Code: Select all
$name = "steve";Code: Select all
$name = \"steve\";Code: Select all
$blogname = "Steve's Blog";Code: Select all
$blogname = \"Steve\'s Blog\";