Session Variables Being Re-initialized!!

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
montecristo
Forum Newbie
Posts: 20
Joined: Thu Oct 19, 2006 9:51 am

Session Variables Being Re-initialized!!

Post by montecristo »

Hi guys,

I have a php application with a oracle database backend. The application requires the user to login using a username and password, which are used to query the database.

These are stored in session variables, which work fine. BUT If I open another internet explorer window and then go back to my appplication, the session variables have been re-initialized.

Is there any way to stop this from happening?

Thanks in advance
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

I'm not sure what you mean. Sessions are persistent. If you open a window and log into the app, then open a second window and go to the same application you'll be sharing a session. That's normal behaviour.

Is that what you mean?

If that's not what you mean then perhaps post some code ;)
montecristo
Forum Newbie
Posts: 20
Joined: Thu Oct 19, 2006 9:51 am

Post by montecristo »

Thanks for getting back to me.

I log into my application and it works fine. I then open another window with php developers network.
I then go back to my application and the session variables have been reinitialized.

I don't understand why this happens, perhaps I should put a time limit on the session?

Thanks
User avatar
iknownothing
Forum Contributor
Posts: 337
Joined: Sun Dec 17, 2006 11:53 pm
Location: Sunshine Coast, Australia

Post by iknownothing »

Have you in any way changed the original page from when you left it? If you are changing your page apon returning to it then perhaps that second page is not communicating with the first, or you are destroying the session before you end up at the second page.

There is no way that it can re-initialise unless you have a Loop (check your code, incase you are infact looping the session info)
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

The internet explorer "stores" cookies with an expire value of 0 (session cookies) only in memory and does not share them with other IE processes. I.e. if you start another IE process it has no access to the other process' session cookie data.
montecristo
Forum Newbie
Posts: 20
Joined: Thu Oct 19, 2006 9:51 am

Post by montecristo »

Thanks for the feed back

The session variables were being re-initialised by poor code :oops:

When I was going back to the page , the session variables were being re-assigned by a $_POST (i,e the post never took place)

Thanks for your time
Post Reply