Page 1 of 1

Whats the problem when ..

Posted: Tue Jun 26, 2007 11:11 pm
by PHPycho
Hello forums !!
I am curious about some questions.
what happens when the session name and the $_POST vars or $_GET vars names are same.
ie

Code: Select all

$_SESSION['sess_name'] = "xyz";
$_GET['sess_name'] = "abc" ;
Thanks in advance to all of you.

Posted: Tue Jun 26, 2007 11:14 pm
by feyd
Nothing. .. or are you referring to if and when register_globals is on, in which case we would ask, why would your code rely on that? .. or are you referring to $_REQUEST, which follows the "variables_order" php.ini directive?

Posted: Tue Jun 26, 2007 11:28 pm
by PHPycho
but i got problem when i used the session variable and get variables with the same name...
ie
i used

Code: Select all

$_session['role'] = "admin";
and when i tried to use the variable role as query string as

Code: Select all

index.php?role=nonadmin
I had checked if role == nonadmin then it should log out

and the same happened when i clicked on the link with rol=nonadmin...

I am not clear how does that happened..
Please clearify ...
thanks

Posted: Tue Jun 26, 2007 11:30 pm
by feyd
You appear to rely on register_globals. That's a dangerous practice.