mcmuney Posted March 23, 2012 Share Posted March 23, 2012 I'm using php edit function to edit an php file online. I think the portion that writing the file is below. My issue is that wherever there's a quote ("), it's automatically adding a slash (\). For example, if I had class="abc", it changes to class=\"abc\". How do I fix this? <?php $file = $_GET['f']; $script = $_POST['script']; if($file&&$script) { $fp=fopen($file, "w"); fwrite($fp,$script); fclose($fp); } ?> Link to comment https://forums.phpfreaks.com/topic/259586-php-edit/ Share on other sites More sharing options...
Psycho Posted March 23, 2012 Share Posted March 23, 2012 Your server likely has "magic quotes" enabled. Which is a bad thing. If you can you should turn that feature off in the web server. If you don't have that ability (e.g. you're on a shared server) you can remove the slashes at run time. Look at this page for more info: http://php.net/manual/en/security.magicquotes.disabling.php There is a sample script in example #2 that you can use. Just call it on any page that receives user input. Link to comment https://forums.phpfreaks.com/topic/259586-php-edit/#findComment-1330584 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.