473,396 Members | 1,726 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

superglobal help

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
2 1694

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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Rainer Erismann | last post by:
Hi, i have a variable (well, an Object) which is needed in beneath every Script. it's not needed to be changed during the whole script, so i like to access it easyli without passing by or declare...
1
by: pkp | last post by:
Does anyone know a way I can register my own superglobal? Meaning, I would like to make my own variable such as $_SESSION which is available in all scopes and contexts without having to declare...
21
by: Dave | last post by:
After following Microsofts admonition to reformat my system before doing a final compilation of my app I got many warnings/errors upon compiling an rtf file created in word. I used the Help...
6
by: wukexin | last post by:
Help me, good men. I find mang books that introduce bit "mang header files",they talk too bit,in fact it is my too fool, I don't learn it, I have do a test program, but I have no correct doing...
9
by: Super Mango | last post by:
Hi - Is it possible to change the status of a variable to superglobal so it'll be valid inside functions without declaring it with "global" inside each function? Thanks -
3
by: Colin J. Williams | last post by:
Python advertises some basic service: C:\Python24>python Python 2.4.1 (#65, Mar 30 2005, 09:13:57) on win32 Type "help", "copyright", "credits" or "license" for more information. >>> With...
5
by: splodge | last post by:
This may seem like a stupid question but I want to check before I go ahead and build this... I am working on a portal, part of which allows users to upload files. Part of the array within...
3
by: P Pulkkinen | last post by:
This is just for curiosity, but: Lets say I would like to have a new superglobal, in addition to automatically made get, post, cookie and session. I mean, I would (theoretically) want to AVOID...
3
by: Michaelp | last post by:
Hello! I see that I can access a superglobal element using the index this way: print("<p>$_GET</p>"); //(element index without any delimiters within a double-quotation-mark-delimited string)...
3
by: Phper | last post by:
Can anyone give a definition of it?
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.