I realise that register_globals cannot be set by ini_set and saw somewhere that the code below is a way to block the register_globals security hole.
Am I correct and the code below will work, or is there a better way?
Am I correct and the code below will work, or is there a better way?
Code:
function cleanregisterglobals($keys) {
foreach (array_keys($keys) as $key) {
global $$key;
unset($$key);
}
}
cleanregisterglobals($_GET);
cleanregisterglobals($_POST);
cleanregisterglobals($_COOKIE);
cleanregisterglobals($_SERVER);
cleanregisterglobals($_ENV);
cleanregisterglobals($_FILES);