Jump to content

[SOLVED] PHP Session Cookie in IE7


jyushinx

Recommended Posts

Hi,

 

I am having a bit of an issue working with a PHP session in IE7. I'm just starting to set this up, so for informational purposes, all I have is a page that starts a session and then displays the SID. Now in Firefox, I start a session and it places a session cookie on my system. If I kept refreshing this page, the cookie still exists and thus the session, so it keeps displaying the same SID. Now if I deleted the cookie, a new session would be created on my next refresh with a new SID and cookie. In IE7, I cannot find the cookie for the session. I checked using Nirsoft Cookie Viewer as well as looking myself in Windows Explorer. There is no cookie. However, when I refresh the page, the SID stays the same, as if the session is active and the cookie does exist. Perhaps it does and I just don't know where. Any ideas?

 

Also, in regards to sessions, I was under the impression they had a default lifetime of 3 hours. However,  I have left my computer for far longer than this, and when I return, it is still active. Does it only end when the browser is closed?

 

Thanks.

Link to comment
Share on other sites

revraz,

 

I already looked in that location (that's what I meant by saying I checked with Windows Explorer) . I looked in both C:\Documents and Settings\user\Local Settings\Temporary Internet Files & C:\Documents and Settings\user\Cookies. The cookie is nowhere to be found.

 

 

p2grace,

 

I know that you can control the session lifetime in php.ini, but when it is not explicitly set (which it isn't), what is the default?

 

 

Thanks.

Link to comment
Share on other sites

I understand they are different, but it seems that if the cookie is not present, the session is no longer valid. You can see this by the way it behaves in Firefox. The cookie is set with an SID. If I delete the cookie and try to refresh the page a new session is started along with a new SID.

 

With IE, I just closed the program and reopened it. I navigated to the page in question and was prompted to set my session cookie with an expiry marked as "End of session". I clicked allow and voila, I cannot find this cookie anywhere. Where is it going? It has to be somewhere.

 

Link to comment
Share on other sites

Well my initial motivation was because I was going to delete the cookie to make sure that when I refreshed the page, a new Session was generated. That wasn't a pressing issue or anything, but now I want to know for information's sake. I like to understand how it functions because I don't like assuming things will just "work" without understanding the underlying mechanism. I've found that this sort of assumption leads to more trouble if you ever run into a problem down the road.

Link to comment
Share on other sites

The IE cookie question is really very simple. Any cookie with a zero life time is kept in a cookie cache in memory (which is deleted when the browser closes.)

 

For the second question, as long as the browser is left open (even if you browse to a different site) the session cookie is kept alive. However, if the session garbage collection runs on the server and deletes the corresponding session data file, then the session cookie would no longer have a corresponding session data file when the browser fetches a URL at your site.

Link to comment
Share on other sites

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.