note 39152 deleted from function.get-magic-quotes-gpc by aidan
| From: | aidan@php.net | Date: | Tue, 06 Jul 2004 06:19:37 +0000 |
| Subject: | note 39152 deleted from function.get-magic-quotes-gpc by aidan | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-72690@lists.php.net to get a copy of this message | ||
Note Submitter: php Pest
----
I devised a little recursive routine that will strip the slashes from selected EGPCSR arrays (and
whatever else you feed it).
It uses create function, so if magic_quotes_gpc is off, there is no function laying around. It also
uses references to keep from creating extra memory demand. One stop conditinal stripper:
if (get_magic_quotes_GPC() ) {
// 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); '.
'else $mData = stripslashes($mData);');
$fnStripMagicQuotes($_POST,$fnStripMagicQuotes); // do each set of EGPCSR as you find necessary
} // end if