Reputation: 355
I have found that on my simple web application, if you leave the page alone for more than about five minutes and then reload the page, calling session_id() will return a different value the second time. Users remain logged in, so the session data is being moved across to the new ID, but I keep track of cart items in a MySQL database based on the session ID, and when the ID changes, the association with the cart items is lost.
Nowhere in my code do I ever call session_regenerate_id()
Help!
Upvotes: 2
Views: 1268
Reputation: 93
Few more things you might want to check if encountered such situation AND you do use session_name():
Warning! The session name can't consist of digits only, at least one letter must be present.
session_name('blah blah')
Both situations force a new session id generated every time.
Upvotes: 0
Reputation: 1394
You might want to check your code to see if you are using session_id() with an argument anywere as this will also change the session id. Without seeing the code it is hard to be specific as to a fix or to know what is going wrong.
Upvotes: 0