note 39708 added to function.get-magic-quotes-gpc
| From: | justin at homelessinsane dot com | Date: | Sun, 08 Feb 2004 08:42:28 +0000 |
| Subject: | note 39708 added to function.get-magic-quotes-gpc | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-64813@lists.php.net to get a copy of this message | ||
Woops, sorry that code won't work for arrays containing sub-arrays (like $_SERVER)
<?PHP
if (get_magic_quotes_gpc()) {
strip_slashes($_GET);
strip_slashes($_POST);
strip_slashes($_COOKIE);
strip_slashes($_SERVER);
}
/* Captain America's Function */
function & strip_slashes(&$str) {
if (is_array($str)) {
while(list($key, $val) = each($str))
$str[$key] = strip_slashes($val);
} else
$str = stripslashes($str);
return $str;
}
?>
----
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+39708
Delete -- http://master.php.net/manage/user-notes.php?action=delete+39708&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+39708&report=yes
Search -- http://master.php.net/manage/user-notes.php