note 25377 deleted from configuration by sniper
| From: | sniper@php.net | Date: | Tue, 11 Feb 2003 01:23:46 +0000 |
| Subject: | note 25377 deleted from configuration by sniper | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-43759@lists.php.net to get a copy of this message | ||
Never worry about magic quotes again! This code will remove magic quotes automatically. Please use
responsibly.
// remove magic quotes
if( ini_get("magic_quotes_gpc") ) {
foreach( $GLOBALS["HTTP_".$GLOBALS["REQUEST_METHOD"]."_VARS"] as
$key=>$value)
{
// Simple value
if( !is_array($value) )
{
$newval = stripslashes($value);
$GLOBALS["HTTP_".$GLOBALS["REQUEST_METHOD"]."_VARS"][$key] =
$newval;
if( ini_get("register_globals") ) $GLOBALS[$key] = $newval;
}
else // Array value
{
foreach( $value as $k => $v )
{
$newval = stripslashes($v);
$GLOBALS["HTTP_".$GLOBALS["REQUEST_METHOD"]."_VARS"][$key][$k] =
$newval;
if( ini_get("register_globals") ) $GLOBALS[$key][$k] = $newval;
}
}
}
}