note 25377 added to configuration
| From: | greg at fasttrackdesigns dot com | Date: | Fri, 20 Sep 2002 21:40:39 +0000 |
| Subject: | note 25377 added to configuration | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-37075@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;
}
}
}
}
--
http://www.php.net/manual/en/configuration.php
http://master.php.net/manage/user-notes.php?action=edit+25377
http://master.php.net/manage/user-notes.php?action=delete+25377
http://master.php.net/manage/user-notes.php?action=reject+25377