scootstah Posted July 9, 2015 Share Posted July 9, 2015 Okay, so we have proved that sessions are behaving normally and your configuration is fine. The problem is with your code, then. We need to see more code to further help you. 1 Quote Link to comment https://forums.phpfreaks.com/topic/297222-prevent-php-session-expiration-using-ajax/page/2/#findComment-1515976 Share on other sites More sharing options...
tsangaris Posted July 9, 2015 Author Share Posted July 9, 2015 Is there a possibility that i have this problem because i changed the session.save_path from the default value(\temp) to another path? Quote Link to comment https://forums.phpfreaks.com/topic/297222-prevent-php-session-expiration-using-ajax/page/2/#findComment-1516002 Share on other sites More sharing options...
mac_gyver Posted July 9, 2015 Share Posted July 9, 2015 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. Quote Link to comment https://forums.phpfreaks.com/topic/297222-prevent-php-session-expiration-using-ajax/page/2/#findComment-1516005 Share on other sites More sharing options...
scootstah Posted July 10, 2015 Share Posted July 10, 2015 (edited) 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 July 10, 2015 by scootstah Quote Link to comment https://forums.phpfreaks.com/topic/297222-prevent-php-session-expiration-using-ajax/page/2/#findComment-1516011 Share on other sites More sharing options...
tsangaris Posted July 19, 2015 Author Share Posted July 19, 2015 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 Quote Link to comment https://forums.phpfreaks.com/topic/297222-prevent-php-session-expiration-using-ajax/page/2/#findComment-1516752 Share on other sites More sharing options...
scootstah Posted July 19, 2015 Share Posted July 19, 2015 (edited) There's no problem, but make sure you pass true as the first argument so that the previous session gets removed immediately. session_regenerate_id(true); Edited July 19, 2015 by scootstah Quote Link to comment https://forums.phpfreaks.com/topic/297222-prevent-php-session-expiration-using-ajax/page/2/#findComment-1516775 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.