Jump to content

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


vinodxx

Recommended Posts

Suppose there is a variable is storied in a session variable $_SESSION['record'].

And internet connection goes and comes again.

This happens with unreliable ISPs.

How to preserve the old value of $_SESSION['record'] in the new situation.

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

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.