I'm VERY confused about globals now

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

Xerpher
New php-forum User
New php-forum User
Posts: 164
Joined: Tue Aug 27, 2002 8:25 pm
Location: Ontario, Canada
Contact:

I'm VERY confused about globals now

Postby Xerpher » Thu Oct 03, 2002 1:24 pm

I thought globals off meant that $_GET['var'] would be disabled because my server said they disabled global variables and I can't use ANY of those arrays (GET, POST, SERVER, etc) the only way I can get the info is by using it as a normal variable ( $var rather than $_GET['var'] ). Could somebody please explain this to me.

DoppyNL

Postby DoppyNL » Thu Oct 03, 2002 1:27 pm

php ALLWAYS makes the global arrays $_GET, $_POST, $_COOKIE, $_SERVER etc., allthough they can be empty because there simply isn't a variable to put in there for php :)

the setting register_globals is only to make those variable accesable as "normal variables" in you're scope so you can use $username instead of $_POST['username']
the setting "register_globals" has no effect on the super globals

Greetz Daan

Xerpher
New php-forum User
New php-forum User
Posts: 164
Joined: Tue Aug 27, 2002 8:25 pm
Location: Ontario, Canada
Contact:

Postby Xerpher » Thu Oct 03, 2002 1:31 pm

Then why can I not use $_GET['pt_login'] but $pt_login works for this "http://www.terradesign.ws/index.php?pt_login=reg"?????

DoppyNL

Postby DoppyNL » Thu Oct 03, 2002 1:39 pm

You got me there :cry: :? 8O

anyway, if it where my host I would ask them to enable the global array's because they would prevent me to write safe code wich would lead to my site being possibly hacked wich would lead to their server being slow or unstable wich would lead..... you get the picture I guess :)

Greetz Daan

Xerpher
New php-forum User
New php-forum User
Posts: 164
Joined: Tue Aug 27, 2002 8:25 pm
Location: Ontario, Canada
Contact:

Postby Xerpher » Thu Oct 03, 2002 1:43 pm

Well unfortunately my host's staff are dumbasses, I hope they understand what php even is :? *sigh*

Jay

Postby Jay » Thu Oct 03, 2002 11:31 pm

What version of PHP are you using? 4.1.0 should have SGA's enabled by default.

Xerpher
New php-forum User
New php-forum User
Posts: 164
Joined: Tue Aug 27, 2002 8:25 pm
Location: Ontario, Canada
Contact:

Postby Xerpher » Fri Oct 04, 2002 9:41 am

I have version 4.1.2 and my SGA's are disabled, I know that my host recently got hacked and is scared to death... they even disabled annonymous ftp access, so maybe they disabled SGA's instead of SGV's by accident. I emailed them about it and they said they'd look in to it. I hope they do it soon because I'm going to have alot of recoding to do :cry:

[edit]
I just checked it again and my SGA's are finally working again *thank god*. the global variables are still working too, but I just won't use them. :)
[/edit]


Return to “PHP coding => General”

Who is online

Users browsing this forum: No registered users and 1 guest