http://php.planetmirror.com/manual/fr/faq.misc.php#faq.misc.registerglobals
Exemple 77-1. Emulation des Register Globals

Ceci émulera la directive register_globals à On.
<?php
// Emulation de 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);
}
?>

Ceci émulera register_globals à Off.
<?php
// Emulation de 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);
}
?>
 
info/emulerregisterglobalonsurduoff.txt · Dernière modification: 2008/11/11 11:37 (modification externe)
 
Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki