note 58782 deleted from ref.info by philip
| From: | philip@php.net | Date: | Wed, 29 Mar 2006 18:52:43 +0000 |
| Subject: | note 58782 deleted from ref.info by philip | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-106958@lists.php.net to get a copy of this message | ||
Note Submitter: descartavel dot 1 at gmail dot com
----
Removes magic quotes and register globals.
it's simply a fixed version of some attemps to solve the problem. i just mixed some and fixed
some minor logic.
function _strip_magic_quotes( &$arr ){
foreach( $arr as $k=>$v ){
if( is_array($v) ){
$arr[$k] = strip_magic_quotes($v);
}else{
$arr[$k] = stripslashes($v);
}
}
return $arr;
}
foreach( array('_GET','_POST','_COOKIE') as $source ){
foreach( ${$source} as $key=>$value ){
if( ini_get('register_globals') ){ // If register_globals is enabled
unset( ${$key} );
}
}
if( get_magic_quotes_gpc() ){
_strip_magic_quotes( ${$source} );
}
}