Jump to content

How to preserve php session variables when there is a glitch in net connection


vinodxx

Recommended Posts

You can add:

?PHPSESSID=<?=session_id() ;?>

to all of the URLS on the site. This way if an ISP drops and the user clicks on the page they will be passing back the same SSID. You can store it in a cookie and reset the ssid.

And internet connection goes and comes again.

 

As long as sessions are setup to use cookies and the sure does not close the browser this should not be an issue.

 

The other route is to session_set_cookie_params make the cookie last longer than the browser close, that should re-instantiate the session upon going back to your site.

Hmm never had this before. If the users web browser is still open and the connection drops and then reconnects it's a possibility that the session will still be active however I have never tested this so you would have to try by switching your router off.

You could keep the value active also by storing the data in a cookie and transferring to a session var if detected.

This is a curious question because session data is stored at the server side.

 

I think the default is 20 mins. So as long as the user doesn't close the browser, I can't

see why intermittent connections would cause the user to lose his session when his internet

comes back? As long as it's within 20 mins....

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.