Registered Members: 207 Unactivated Members: 0 Newest Member: Emily Benjamin
Function that removes all the globals added by register_globals
To expand on the nice bit of code Mike Willbanks wrote and Alexander tidied up, I turned the whole thing in a function that removes all the globals added by register_globals so it can be implemented in an included functions.php and doesn't litter the main pages too much.
<?php //Undo register_globals function unregister_globals() { if (ini_get(register_globals)) { $array = array('_REQUEST', '_SESSION', '_SERVER', '_ENV', '_FILES'); foreach ($array as $value) { foreach ($GLOBALS[$value] as $key => $var) { if ($var === $GLOBALS[$key]) { unset($GLOBALS[$key]); } } } } } ?>