Re: Kill Magic Quotes
| From: | mike | Date: | Fri, 08 Aug 2008 17:20:01 +0000 |
| Subject: | Re: Kill Magic Quotes | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-277914@lists.php.net to get a copy of this message | ||
On 8/8/08, Stephen <stephen-d@rogers.com> wrote:
> I found this solution after a web search. I can't attribute the author, but
> would like to if I could.
I have something like that myself, but even on the URL they linked it
has a "php.net approved" snippet of code that works:
http://www.php.net/manual/en/security.magicquotes.disabling.php
<?php
if (get_magic_quotes_gpc()) {
function stripslashes_deep($value)
{
$value = is_array($value) ?
array_map('stripslashes_deep', $value) :
stripslashes($value);
return $value;
}
$_POST = array_map('stripslashes_deep', $_POST);
$_GET = array_map('stripslashes_deep', $_GET);
$_COOKIE = array_map('stripslashes_deep', $_COOKIE);
$_REQUEST = array_map('stripslashes_deep', $_REQUEST);
}
?>
but i'd say skip REQUEST. just unset($_REQUEST); don't get in the
habit of using it. blech.