Slash Appended To All My Posts
Possible Duplicate: Why turning magic_quotes_gpc on in PHP is considered a bad practice? when i get information from a post form, the html form adds slashes before random charac
Solution 1:
This is an old (deprecated) feature of PHP that automagically escapes some characters in strings from various sources ($_GET, $_POST, $_COOKIE, etc).
The goal was to protect from SQL injection vulnerabilities, but this was not that good.
This can be disabled by setting the magic_quotes_gpc
setting to 0 in your php.ini
.
If you don't have control over the magic_quotes_gpc
setting, you may want to reverse its effect, by using the stripslashes
function:
$value = stripslashes($_POST['foo']);
You can do it on all $_POST
variables like this:
function stripslashes_r($value) {
if (is_array($value)) return array_map('stripslashes_r', $value);
else return stripslashes($value);
}
if (get_magic_quotes_gpc()) {
$_POST = stripslashes_r($_POST);
}
Solution 2:
special characters are escaped. you can remove the backslashes with http://php.net/manual/en/function.stripslashes.php
Post a Comment for "Slash Appended To All My Posts"