Page 1 of 1

When register_globals is on

Posted: Thu Jun 08, 2006 10:17 am
by lostinfog
i've finished some codes. Those codes works well when register_globals is off. I know this setting is default since PHP v4.2.
Buf when register_globals is on, error occured.
I'd like to know whether or not it's possible to tell a variable is from session or get? If possible, how?
TIA!

Posted: Thu Jun 08, 2006 10:39 am
by bokehman
By only retrieving variables from superglobal arrays.

Posted: Thu Jun 08, 2006 10:40 am
by feyd
unless you have weird code, I don't know how code would break when it works without register_globals on..

Re: When register_globals is on

Posted: Thu Jun 08, 2006 10:54 am
by RobertGonzalez
lostinfog wrote:i've finished some codes. Those codes works well when register_globals is off. I know this setting is default since PHP v4.2.
Buf when register_globals is on, error occured.
I'd like to know whether or not it's possible to tell a variable is from session or get? If possible, how?
TIA!
First tip, leave register globals off.

As far as telling where a variable comes from, dont't know if you can do that except for running an isset if check against all GPCS vars, but then there is an issue of precedence in these vars so the results might be skewed. But I would seriously recommend leaving register globals off.

Posted: Thu Jun 08, 2006 10:57 am
by feyd
ini_get('variables_order') will help determine it..

http://php.net/ini.core#ini.variables-order