Jump to content

[SOLVED] Losing one session variable, rest are still intact


da_beaver

Recommended Posts

Hi,

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 2.0.5.2 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.
Link to comment
Share on other sites

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.
Link to comment
Share on other sites

[!--quoteo(post=354872:date=Mar 14 2006, 01:35 PM:name=obsidian)--][div class=\'quotetop\']QUOTE(obsidian @ Mar 14 2006, 01:35 PM) [snapback]354872[/snapback][/div][div class=\'quotemain\'][!--quotec--]
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.
[/quote]

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.
Link to comment
Share on other sites

  • 1 year later...
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.