By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,718 Members | 1,461 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,718 IT Pros & Developers. It's quick & easy.

superglobal help

P: n/a
How would you translate the following script into something that would
work with register globals set to 'off'?

---

$envs = array("HTTP_REFERER", "HTTP_USER_AGENT", "REMOTE_ADDR",
"REMOTE_HOST", "QUERY_STRING", "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($_SERVER[$env]))

however that doesn't work. Any ideas? Thanks.
Jul 17 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a

On 27-Apr-2004, wm*******@hotmail.com (Will) wrote:
How would you translate the following script into something that would
work with register globals set to 'off'?

---

$envs = array("HTTP_REFERER", "HTTP_USER_AGENT", "REMOTE_ADDR",
"REMOTE_HOST", "QUERY_STRING", "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($_SERVER[$env]))

however that doesn't work. Any ideas? Thanks.


if(isset($_SERVER[$$env]))

--
Tom Thackrey
www.creative-light.com
tom (at) creative (dash) light (dot) com
do NOT send email to ja*********@willglen.net (it's reserved for spammers)
Jul 17 '05 #2

P: n/a
Tom Thackrey wrote:

if(isset($_SERVER[$$env]))


you mean

if(isset($_SERVER[$env]))
------------ And now a word from our sponsor ------------------
Do your users want the best web-email gateway? Don't let your
customers drift off to free webmail services install your own
web gateway!
-- See http://netwinsite.com/sponsor/sponsor_webmail.htm ----
Jul 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.