Jump to content

PHP Edit


mcmuney

Recommended Posts

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

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

Archived

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

×
×
  • Create New...

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.