For your (Lonestarjack's) script to work it (1) has to use variable variables and (2) needs to account for auto_globals_jit.
1a.
Code: Select all
$x = array("\$_GET","\$_POST","\$_REQUEST","\$_SESSION","\$_COOKIE","\$_SERVER");
If you want to reference a variable then you need to use its name, and the dollar sign is not part of it.
Code: Select all
$x = array("_GET","_POST","_REQUEST","_SESSION","_COOKIE","_SERVER");
1b.
Code: Select all
foreach ( $val as $key => $data );
First take out the semicolon. The $val from the outer foreach loop is just a string: "_GET", "_POST", "_SERVER", etc. You have to dereference the string to get the variable it names.
Code: Select all
foreach ( $$val as $key => $data )
2. When auto_globals_jit is enabled (which it is by default) PHP may not create some of the superglobal arrays until you try to use them directly in code, and variable variables won't trigger their creation.
You can do it easily with something like
Code: Select all
foreach (array($_GET, $_POST, $_REQUEST, $_SESSION, $_COOKIE, $_SERVER) as $array);