A
A
alestro2016-03-19 19:29:35
PHP
alestro, 2016-03-19 19:29:35

How to log out a user who is not active for a certain amount of time?

Interested in the implementation of the following: It is necessary to delete the session where the administrator was not active within, say, 10 minutes after the last activity. Something like this: Logged in -> wandered through the admin panel-> no action for 10 minutes -> activity -> throws it on the authorization page and asks to enter the password again.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
W
WebDev, 2016-03-19
@kirill-93

session lifetime set

V
Valery, 2016-03-19
@supervaleha

Setting the cookie and session lifetime should solve the problem in most cases.

X
xmoonlight, 2016-03-19
@xmoonlight

if ($_SESSION['last_activity']-date()>=600) {header("Location: /logon/");exit;}
else $_SESSION['last_activity']=date();

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question