Originally posted by drawmack
they work on 12 different sites.
odd, because it doesn't work for me.
here is reg_globals.php
<?php
reg_globals();
print "$foo<br>\n";
print "$foo2<br>\n";
function reg_globals() {
foreach($_GET as $curVar) {
print "curVar = $curVar<br>\n";
print "_GET[$curVar] = {$_GET[$curVar]}<br>\n";
global $$curVar;
$$curVar = $_GET[$curVar];
} //end foreach
foreach($_POST as $curVar) {
global $$curVar;
$$curVar = $_POST[$curVar];
} //end foreach
} //end reg_globals
?>
when I go to that script passing variables to it:
reg_globals.php?foo=bar&foo2=5
it does not create the variables $foo and $foo2 and the variable $bar is empty. Here's the output of the print statements in that foreach loop:
curVar = bar
GET[bar] =
curVar = 5
GET[5] =
can you show me an example of a script using that function that works.