Turning on register_globals Print

  • 0

We do not support turning on register_globals. As documented by the PHP developers, using register_globals is insecure and can lead to unauthorized data access. In most all situations, the following snippet below can emulate the expected behaviour.

<?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);
}
?>


Was this answer helpful?

« Back