Emulating "register_globals On"
Posted: Fri Sep 02, 2005 7:57 pm
For those who are having problems due to the change of register_globals to Off, here is a script that emulates register_globals as if it is On.
It's useful if you don't know what to do if your script shows any error because of register_globals or if you don't want to let your site offline while reprogramming the script.
Here it is:
It should be put in the beginning of your script. I hope you like it. 
It's useful if you don't know what to do if your script shows any error because of register_globals or if you don't want to let your site offline while reprogramming the script.
Here it is:
Code: Select all
<?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);
}
}
?>
