Skip to content

Instantly share code, notes, and snippets.

@voda
Last active December 20, 2015 13:29
Show Gist options
  • Save voda/6139350 to your computer and use it in GitHub Desktop.
Save voda/6139350 to your computer and use it in GitHub Desktop.
register globals for PHP 5.4+
<?php
/**
* Register globals sucks
* use with 'auto_prepend_file' directive
*/
foreach (array($_ENV, $_GET, $_POST, $_COOKIE, $_SERVER) as $source) {
foreach ($source as $key => $val) {
$GLOBALS[$key] = $val;
}
}
foreach ($_FILES as $key => $val) {
$GLOBALS["{$key}"] = $val['tmp_name'];
$GLOBALS["{$key}_name"] = $val['name'];
$GLOBALS["{$key}_size"] = $val['size'];
$GLOBALS["{$key}_type"] = $val['type'];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment