Good morning,
I am looking for an identifier when a user connected but inactive for 30 minutes will be closed by the Plesk server
(30 minutes of inactivity is my server setting before closing the session)
I have an application developed in PHP hosted and administered under plesk.
since plesk I determine the time of inactivity before closing a session.
when a user leaves his page open without activity for more than 30 minutes, his session is automatically closed but without warning or message.
so to prevent him from believing that the application is no longer working I would like to be able to display a message to him indicating that the session has expired, but I am unable to do so
Thank you for your help.
inside a function called every minute I do the following test:
if (session_status() === PHP_SESSION_DISABLED || session_status() === PHP_SESSION_NONE ) {
respAjax::errorJSON(array('message' => ($usrActif->lang == 'FR' || $usrActif->lang == '' ? 'SESSION EXPIREE' : 'SESSION EXPIRED')));
}
1
Answers
You can start timer when user logs in
then you can reset timer when any activity happens
also u can clear timer if you want when user logout
Note : this has nothing to do with ur php this is all done by javascript
Just in addition this might help someone :
Another thing if you dont want session to expire whole day or till browser is closed then you can just make a simple jquery call via ajax to server every 5-10 minutes (accordingly) and it will never expires. You can also update values if needed in client end with this ajax request.
Here is example :