Jump to content


This topic is now archived and is closed to further replies.


register global questions

Recommended Posts

i've just been looking through my php.ini file and i just read the part that goes.

[QUOTE]; You should do your best to write your scripts so that they do not require
; register_globals to be on;  Using form variables as globals can easily lead
; to possible security problems, if the code is not very well thought of.
register_globals = Off[/QUOTE]

but doesn't register globals have to be on to include pages like /?id=page here.

is there a way to get links working like that with register globals on then?

Share this post

Link to post
Share on other sites
no, you do not need register global on to enable any particular feature.

assume you have this kind of passing:

and you want to print the username out.

with register global on, simply
echo $username;

without register global on,
echo $_GET['username'];

relying on register global is generally not good style.  There're many reason for it.

Bottom line is, accessing your GET and POST data via $_GET and $_POST

Share this post

Link to post
Share on other sites
When register_globals is off you have to use a set of predifined variables called superglobals. The following are the superglobas:

Basically to get session data you use $_SESSION, for cookies you use $_COOKIE, for server variables you use $_SERVER, for get/post'd data you you use $_GET or $_POST

Share this post

Link to post
Share on other sites


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.