+ 1

How can I destory a session after specific period of time?

I want after the user log in to count 60 seconds then if he stayed more than 60 sec without being active it will destroy the session (when I click refresh on the browser)

11th Jul 2018, 9:30 PM
Sooso Sweet
Sooso Sweet - avatar
1 Answer
0
Try this: if (isset($_SESSION["LAST_ACTION"]) && (time() - $_SESSION["LAST_ACTION"] > 60)) { session_unset(); session_destroy(); } $_SESSION["LAST_ACTION"] = time();
11th Jul 2018, 10:09 PM
AtoMX
AtoMX - avatar