[SOLVED] Losing one session variable, rest are still intact
Posted 14 March 2006 - 01:08 PM
I am setting session variables on a page then doing a header/location redirect to a second page however I am losing one of my session variables. Not all of them, just one.
Here are some details/comments:
I am doing a session_start() on ALL of my pages, right at the top of each page
I have tried session_write_close() before doing the redirect
A print_r of $_SESSION on the first page shows all of the variables intact before the redirect is attempted
There is nothing in the code or in an included file that unsets/destroys/overwrites the session variable.
The code that sets the variable is not within an output buffer
PHP version 4.3.1, Apache version 188.8.131.52 running on Windows 2000
Surely this shouldn't happen? If I was losing the entire session that would kind of be understandable but losing ONE variable out of about 10 or 11 is very strange.
Has anyone experienced this before or can anyone offer an explanation? Let me know if you need any further details.
Thanks for any advice offered.
Posted 14 March 2006 - 01:35 PM
Posted 14 March 2006 - 01:44 PM
do you have register_globals turned on? i found that one of my scripts behaved this way when i installed it on a server with register_globals on. what happened was that i had a $_SESSION['user'] variable, and on one page, i also had a plain $user variable. well, needless to say, with register_globals on, it overwrote my session variable anyway.
I've just checked the .ini file and register_globals is set to off.
Thanks for the advice though, I hadn't thought of checking that.
Posted 25 June 2007 - 11:39 PM
Posted 25 June 2007 - 11:42 PM
and register globals is on
Can you switch them off? Otherwise, you'll need to rename your variables. There is a conflict as described by obsidian.
Posted 25 June 2007 - 11:46 PM
Posted 25 June 2007 - 11:53 PM
Posted 26 June 2007 - 01:57 AM
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users