note 50731 added to security.globals

From: Date: Tue, 08 Mar 2005 13:18:18 +0000
Subject: note 50731 added to security.globals
Groups: php.notes 
Request: Send a blank email to php-notes+get-86102@lists.php.net to get a copy of this message
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"); ?> ---- Manual Page -- http://www.php.net/manual/en/security.globals.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+50731 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+50731&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+50731&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+50731&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+50731&report=yes&reason=useless Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+50731&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+50731&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#86102) next »