note 56254 deleted from function.get-magic-quotes-gpc by philip
| From: | philip@php.net | Date: | Tue, 27 Jun 2006 06:38:54 +0000 |
| Subject: | note 56254 deleted from function.get-magic-quotes-gpc by philip | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-114344@lists.php.net to get a copy of this message | ||
Note Submitter: Balu
----
Just for reference - I like the following code to clean up the superglobals. It was posted here by
"php Pest" sometime...
if ((bool) get_magic_quotes_GPC()) { // by "php Pest"
// Really EGPCSR - Environment $_ENV, GET $_GET , POST $_POST, Cookie $_COOKIE, Server $_SERVER
// and their HTTP_*_VARS cousins (separate arrays, not references) and $_REQUEST
$fnStripMagicQuotes = create_function(
'&$mData, $fnSelf',
'if (is_array($mData)) { foreach ($mData as $mKey=>$mValue) $fnSelf($mData[$mKey],
$fnSelf); return; } '.
'$mData = stripslashes($mData);'
);
$fnStripMagicQuotes($_POST, $fnStripMagicQuotes); // do each set of EGPCSR as you find necessary
$fnStripMagicQuotes($_GET, $fnStripMagicQuotes);
$fnStripMagicQuotes($_REQUEST, $fnStripMagicQuotes);
}