0

Is it possible to get a timestamp, and have that timestamp saved as a cookie or even into mysql database when a PHP session is timed out? I've been fiddling with the expiry times and want to have reassurance of how long the sessions are lasting for.

And that way I can see what time people log in and what time they are either kicked out or logged out.

  • 1
    if you really want to sneak upon the activity time, you can insert time in db when a user is logged in and update it when he logs out ? Why don't you go with this approach ? – Muhammad Usman Oct 24 '17 at 20:13
  • I'm going to do that as well but it's rare that someone actually logs out, they typically just close the browser. – AllianceHardware Oct 24 '17 at 20:15
  • You could fire a AJAX post somewhere to record it in the database after an 'onbeforeunload' event is executed. https://stackoverflow.com/questions/20853142/trying-to-detect-browser-close-event – jon.r Oct 24 '17 at 20:30

0 Answers0