note 50731 deleted from security.globals by aidan
| From: | aidan@php.net | Date: | Tue, 12 Apr 2005 01:47:46 +0000 |
| Subject: | note 50731 deleted from security.globals by aidan | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-87869@lists.php.net to get a copy of this message | ||
Note Submitter: luciano at vittoretti dot com dot br
----
This function helps you to add predefined vars to global scope , when Register Globals is disabled
by administrator.
<?
function table_manager_import_vars($var) {
$vars = explode(",", $var);
foreach($vars AS $var) {
switch ($var) {
case "G":
$var = "HTTP_GET_VARS";
break;
case "P":
$var = "HTTP_POST_VARS";
break;
case "C":
$var = "HTTP_COOKIE_VARS";
break;
case "S":
$var = "HTTP_SESSION_VARS";
session_start();
break;
case "E":
$var = "HTTP_SERVER_VARS";
break;
}
if (isset($GLOBALS[$var])) {
if (is_array($GLOBALS[$var])) {
foreach($GLOBALS[$var] AS $var1 => $value) {
if ($var1 != $var) {
$GLOBALS[$var1] = $value;
}
}
}
}
}
}
?>
How to use:
<?
table_manager_import_vars("G,P,C,S,E");
?>