note 11532 deleted from language.variables.external by philip
| From: | philip@php.net | Date: | Mon, 01 Apr 2002 05:32:42 +0000 |
| Subject: | note 11532 deleted from language.variables.external by philip | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-28450@lists.php.net to get a copy of this message | ||
If you want to have variables always globally registered, dependless on setting of register_globals
you can call following code before your scripts (remember that track_vars must be on - which is the
default in PHP4):
if(!ini_get('register_globals')){
$__am = array('COOKIE','POST','GET');
while(list(,$__m) = each($__am)){
$__ah = &${"HTTP_".$__m."_VARS"};
if(!is_array($__ah)) continue;
while(list($__n, $__v) = each ($__ah)) $$__n = $__v;
}
}
You can easily change the order in which cookie, get and post variables are registered.
Similar trick can be made for magic_quotes - in this way, you can make your scripts not being
affected by the server settings.