note 39152 added to function.get-magic-quotes-gpc
| From: | phpPest at rn2 dot php dot net | Date: | Mon, 19 Jan 2004 02:56:14 +0000 |
| Subject: | note 39152 added to function.get-magic-quotes-gpc | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-63809@lists.php.net to get a copy of this message | ||
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
----
Manual Page -- http://www.php.net/manual/en/function.get-magic-quotes-gpc.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+39152
Delete -- http://master.php.net/manage/user-notes.php?action=delete+39152&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+39152&report=yes
Search -- http://master.php.net/manage/user-notes.php