Jump to content

Prevent PHP SESSION expiration using AJAX


tsangaris

Recommended Posts

changing the session save path could only cause this problem if your setting was only in effect for some of the files, not all of them.

 

the problem could be anyplace in your code, from the login not actually working (i can devise an example that contains an incorrectly coded 'test' of a session variable that makes it appear that the user is logged in, with a second correctly coded test that finds that the user is isn't logged in) to things like header() redirects (already mentioned above), url rewriting (that's changing the sub-domain/host name for only some files), pages getting requested twice by your browser (where the code isn't detecting if there is actually data and ends up clearing session variables), older version of php where register globals are still in effect and you are overwriting the session variables, ...

 

there's just too many possibilities and hitting the correct one based on pot-shot guessing isn't going to find the cause any time soon.

 

if you are not able to troubleshoot your code to find the problem, you will need to post enough of your code that reproduces the problem.

Link to comment
Share on other sites

Is there a possibility that i have this problem because i changed the session.save_path from the default value(\temp) to another path?

No, because we've just established that your sessions are working correctly.

Edited by scootstah
Link to comment
Share on other sites

  • 2 weeks later...

It turns out that the only thing that is working for me is to use the session_regenerate_id() within refreshSession.php script..

 

Is there a problem if i regenerate the session of the user each 20 minutes? Will it affect anything?

 

Regards,

 

Chris

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.