I need a timer of 30 min to auto logout my quiz application coded in PHP. It should be a forced one. Even if the user is doing some activities.How to implement that?
Asked
Active
Viewed 157 times
0
-
This is impossible by means of php only, since php runs on the server side and the server does not have access to the client, expect when the client chooses to contact the server. – arkascha Jan 16 '16 at 14:27
-
Maybe same topic here: http://stackoverflow.com/questions/20516969/automatic-logout-after-15-minutes-of-inactive-in-php – JoGe Jan 16 '16 at 14:28
-
1Possible duplicate of [php ajax auto logout with timer](http://stackoverflow.com/questions/3801935/php-ajax-auto-logout-with-timer) – roottraveller Jan 16 '16 at 14:29
-
Also have a look at http://stackoverflow.com/questions/6119451/page-redirect-after-certain-time-php – roottraveller Jan 16 '16 at 14:30
1 Answers
0
PHP does not work like a runtime application, it doesn't have a state. Your frontend via javascript or other means would need to send a request to the server on an interval to check if the user is still authenticated. Then you check using PHP if the user is expired or not, in which case you action that using the frontend logic.
This is way too vague to give a definitive answer.

Steve_B19
- 538
- 3
- 10