Automatic Logout after 15 minutes of inactive in php

后端 未结 8 793
悲&欢浪女
悲&欢浪女 2020-12-04 15:51

I want to destroy session if users are not doing any kind of activity on website. At that time after 5 users automatically redirect on index page. How is it possible? Is pos

8条回答
  •  盖世英雄少女心
    2020-12-04 16:42

    In index.php in dashboard.php if(time() - $_SESSION['loggedAt'] > 240) { echo""; unset($_SESSION['username'], $_SESSION['loggedAt']); header("Location: " . index.php); exit; } else { $_SESSION['loggedAt'] = time(); }

提交回复
热议问题