uncleronin Posted February 16, 2007 Share Posted February 16, 2007 sometimes its possible for a server to go down, be rebooted, etc. and drop a session. Is there any way of detecting this and recovering from it? Quote Link to comment Share on other sites More sharing options...
The_Assistant Posted February 16, 2007 Share Posted February 16, 2007 session id's are generated every time a user visits a site but if the server goes down then the session is reset so there is no way that i know of to recover a session let alone detect it. Quote Link to comment Share on other sites More sharing options...
JasonLewis Posted February 16, 2007 Share Posted February 16, 2007 i no that in firefox it can do that, but thats the browser. i to wouldnt know how to do it in php. Quote Link to comment Share on other sites More sharing options...
uncleronin Posted February 16, 2007 Author Share Posted February 16, 2007 So there is absolutely no way? Browsers aside, there must be some method. :-\ I sppose you could always store a cookie with the session id which tracks whether a session is in progress. When a session is started the cookie is set. When the session ends (user logs out, browser closes) the cookie is destroyed. If the session is dropped then the cookie would say the session is active which would conflict with the fact that a new session is being started - so you could 'detect' dropping a session. You could also recover the session if you had stored it in a db or file (like you would with automatic logins, etc). Actually, this WOULD actually actually work if the server goes down as well wouldn't it? Now, what if cookies are disabled!?! Quote Link to comment Share on other sites More sharing options...
The_Assistant Posted February 17, 2007 Share Posted February 17, 2007 see if you can get some code that checks to see if cookies are enabled and if not then use a javascript alert of something similar to ask the user to enable cookies Quote Link to comment Share on other sites More sharing options...
roopurt18 Posted February 17, 2007 Share Posted February 17, 2007 You could serialize and store the session in the DB every time the user requests a page as well as a cookie on their system. If they leave and come back you could reload the saved session from their last visit. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.