Skip to content
Advertisement

How to destroy a session an hour or day after a user exit site [closed]

I have an admin page where some users can have access to but I want that whenever they leave the site or close the tab for about an hour or a day the session should be destroyed so as not to allow someone else.

Advertisement

Answer

The thing you are searching for is $_COOKIE. There you can define how long the Variable is saved etc. The only thing you will have to consider is that the values are stored locally and not on the server. If you want to achieve that, you can create a Cookie-Key system similar to the one PHP uses to save the Session data on the Server. In that Case the User would get a key, saved as a cookie and the data is stored on the server under that key.

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement