note 20710 deleted from function.get-magic-quotes-gpc by didou
| From: | didou@php.net | Date: | Thu, 29 May 2003 21:12:42 +0000 |
| Subject: | note 20710 deleted from function.get-magic-quotes-gpc by didou | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-49322@lists.php.net to get a copy of this message | ||
Note Submitter: reply: hirose@tg.rim.or.jp 28-May-2001
----
Setting MagicQuotes off needs ini_set("magic_quotes_gpc",0); to be called, too, because
even if it has no effect to anything done, you need it because otherwise other scripts you use dont
know that magicquotes are off and may strip slashes again or may not add_slashes when useing sql or
echoing javascript. So the real code would be:
if (get_magic_quotes_gpc()) {
// Overrides GPC variables
for (reset($HTTP_GET_VARS); list($k, $v) = each($HTTP_GET_VARS); )
$$k = $HTTP_GET_VARS[$k] = stripslashes($v);
for (reset($HTTP_POST_VARS); list($k, $v) = each($HTTP_POST_VARS); )
$$k = $HTTP_POST_VARS[$k] = stripslashes($v);
for (reset($HTTP_COOKIE_VARS); list($k, $v) = each($HTTP_COOKIE_VARS); )
$$k = $HTTP_COOKIE_VARS[$k] = stripslashes($v);
ini_set("magic_quotes_gpc",0);
}