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.

  • 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

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.