note 35380 deleted from function.ini-set by vincent
| From: | vincent@php.net | Date: | Fri, 29 Aug 2003 07:54:59 +0000 |
| Subject: | note 35380 deleted from function.ini-set by vincent | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-55281@lists.php.net to get a copy of this message | ||
Note Submitter: sloedough@hotmail.com
----
Here is a very useful script!
If you wright your PHP code for the register_globals setting to be on, but since the new PHP
releases have a default setting of off, just add these lines of code to the beginning of your code,
or even better yet put it in a global.php file and include or require that golbal.php in the
beginning of your other PHP files.
====THE CODE====
//Forcefully get the register_globals directive setting
if ( function_exists('ini_get') ) {
$onoff = ini_get('register_globals');
} else {
$onoff = get_cfg_var('register_globals');
}
//If the register_globals is set to off, manually register the variables
if ($onoff != 1) {
@extract($HTTP_SERVER_VARS, EXTR_SKIP);
@extract($HTTP_COOKIE_VARS, EXTR_SKIP);
@extract($HTTP_POST_FILES, EXTR_SKIP);
@extract($HTTP_POST_VARS, EXTR_SKIP);
@extract($HTTP_GET_VARS, EXTR_SKIP);
@extract($HTTP_ENV_VARS, EXTR_SKIP);
}
====END OF THE CODE====
I use this code for everything it makes coding things a whole lot easier.