PHP Register Globals

May be security risk or mess up your code

If register globals is on/off, you can change it by adding to apache .htaccess file:

php_flag register_globals off


php_flag register_globals on

OR php code.

if (ini_get(register_globals)) { // if on, turn off
    $rg = array_keys($_REQUEST);
    foreach($rg as $var)
        if ($_REQUEST[$var] === $$var)
if (! ini_get(register_globals)) { // if off, turn on
    extract($_REQUEST, EXTR_OVERWRITE); 
   //If variable of same name exits, this will overwrite it;

You cannot set register_globals using