note 39708 deleted from function.get-magic-quotes-gpc by nlopess
| From: | nlopess@php.net | Date: | Sun, 08 Feb 2004 09:47:30 +0000 |
| Subject: | note 39708 deleted from function.get-magic-quotes-gpc by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-64815@lists.php.net to get a copy of this message | ||
Note Submitter: justin@homelessinsane.com
----
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;
}
?>