Whats the problem when ..

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
PHPycho
Forum Contributor
Posts: 336
Joined: Fri Jan 06, 2006 12:37 pm

Whats the problem when ..

Post 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.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post 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?
User avatar
PHPycho
Forum Contributor
Posts: 336
Joined: Fri Jan 06, 2006 12:37 pm

Post 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
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

You appear to rely on register_globals. That's a dangerous practice.
Post Reply