note 106122 deleted from security.globals by danbrown

From: Date: Wed, 12 Oct 2011 14:52:03 +0000
Subject: note 106122 deleted from security.globals by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-183828@lists.php.net to get a copy of this message
Note Submitter: anonymous ---- Here is the code to emulate register_globals On. <?php // Emulate register_globals on if (!ini_get('register_globals')) { $superglobals = array($_SERVER, $_ENV, $_FILES, $_COOKIE, $_POST, $_GET); if (isset($_SESSION)) { array_unshift($superglobals, $_SESSION); } foreach ($superglobals as $superglobal) { extract($superglobal, EXTR_SKIP); } ini_set('register_globals', true); } ?> And this code will emulate register_globals Off. <?php // Emulate register_globals off if (ini_get('register_globals')) { $superglobals = array($_SERVER, $_ENV, $_FILES, $_COOKIE, $_POST, $_GET); if (isset($_SESSION)) { array_unshift($superglobals, $_SESSION); } foreach ($superglobals as $superglobal) { foreach ($superglobal as $global => $value) { unset($GLOBALS[$global]); } } ini_set('register_globals', false); } ?> I have found and reported here this useful solution (from: http://www.daniweb.com/web-development/php/code/216720)

« previous php.notes (#183828) next »