Re: No Global Code Fixing
| From: | Tularis | Date: | Sat, 04 Jan 2003 18:49:13 +0000 |
| Subject: | Re: No Global Code Fixing | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-130249@lists.php.net to get a copy of this message | ||
NOTE:
this basicly mimics the way register_globals works.
I use this code to fix register_globals aswell as the magic_quotes_gpc:
$global = @array($_SESSION, $_SERVER, $_COOKIE, $_POST, $_GET, $_FILES, $_ENV);
$global_old = @array($HTTP_SESSION_VARS, $HTTP_SERVER_VARS, $HTTP_COOKIE_VARS, $HTTP_POST_VARS, $HTTP_GET_VARS, $HTTP_FILES_VARS, $HTTP_ENV_VARS);
if(!$global[1]){
$global = $global_old;
}
if(!@ini_get('magic_quotes_gpc')){
foreach($global as $array){
if(is_array($array)){
foreach($array as $key=>$val){
$$key = addslashes($val);
}
}
}
}else{
foreach($global as $array){
if(is_array($array)){
foreach($array as $key=>$val){
$$key = $val;
}
}
}
}