note 56877 deleted from function.get-magic-quotes-gpc by philip
| From: | philip@php.net | Date: | Tue, 27 Jun 2006 06:38:44 +0000 |
| Subject: | note 56877 deleted from function.get-magic-quotes-gpc by philip | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-114343@lists.php.net to get a copy of this message | ||
Note Submitter: hitman at bootbox dot net
----
A fast and easy way for getting rid of magic_quotes_gpc. Just include this piece of code in the
beginning of your script and later you won't have to bother whether magic_quotes_gpc is on or
off, it will be the same as off:
if ( get_magic_quotes_gpc () )
{
function traverse ( &$arr )
{
if ( !is_array ( $arr ) )
return;
foreach ( $arr as $key => $val )
is_array ( $arr[$key] ) ? traverse ( $arr[$key] ) : ( $arr[$key] = stripslashes ( $arr[$key] ) );
}
$gpc = array ( &$_GET, &$_POST, &$_COOKIE );
traverse ( $gpc );
}