'Can we capture Logout timestamp if the user closes browser or shutdown in php?
If it possible what be the steps? If not what are the possible steps? In my overall project: I'm using session so that users session in that application is tracked if they logs out as followings
id|session|login_time_stamp|logout_time_stamp
---------------------------------------------
1 |xgy67sw| date-time | date-time
But if they Shutdown pc or closes browser, logout time stamp is null.
id|session|login_time_stamp|logout_time_stamp
---------------------------------------------
1 |xgy67sw| date-time | null
What I want is, if the users closes browser or PC how to grab their exiting timestamp?
Solution 1:[1]
What you want is not possible.
Maybe you will want to read these topics:
Solution 2:[2]
There is no reliable way to capture when a user logs out of a website. Sessions expire after a certain time period has elapsed, but there is no reliable way to know when a user actually closes their browser or shuts down their computer.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | matei1337 |
| Solution 2 | Yigal Bauch |
