note 35380 added to function.ini-set
| From: | sloedough at hotmail dot com | Date: | Fri, 29 Aug 2003 06:43:04 +0000 |
| Subject: | note 35380 added to function.ini-set | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-55276@lists.php.net to get a copy of this message | ||
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.
----
Manual Page -- http://www.php.net/manual/en/function.ini-set.php
Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+35380
Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+35380&report=yes
Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+35380&report=yes