Automatic Logout after 15 minutes of inactive in php

后端 未结 8 795
悲&欢浪女
悲&欢浪女 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:39

    You may create a cookie for a specific time. For example you could put this on your login page:

    
    

    Then in some file part that is included in every page, like 'header.php', you may include:

     location.href='logout.php'; ";   
      }
    
      setcookie('admin', 'abc', time()+50);
    ?>
    

    In the above example, after 50s the cookie will die and the user will be logged out automatically.

提交回复
热议问题