How would you translate the following script into something that would
work with register globals set to 'off'?
---
$envs = array("HTTP_REF ERER", "HTTP_USER_AGEN T", "REMOTE_ADD R",
"REMOTE_HOS T", "QUERY_STRI NG", "PATH_INFO" );
foreach($envs as $env) {
if(isset($$env) )
print("$env: ${$env}<br />\n");
}
---
The obvious solution would be to change
if(isset($$env) )
to
if(isset($_SERV ER[$env]))
however that doesn't work. Any ideas? Thanks.
work with register globals set to 'off'?
---
$envs = array("HTTP_REF ERER", "HTTP_USER_AGEN T", "REMOTE_ADD R",
"REMOTE_HOS T", "QUERY_STRI NG", "PATH_INFO" );
foreach($envs as $env) {
if(isset($$env) )
print("$env: ${$env}<br />\n");
}
---
The obvious solution would be to change
if(isset($$env) )
to
if(isset($_SERV ER[$env]))
however that doesn't work. Any ideas? Thanks.
Comment