I have $_SESSION
variables containing user login username that have the default session life set ( 24 minutes I think ). I'm wondering if there is a way to execute a function on session timeout.
I know I can tell the page to execute the function when the user reloads the page and the session variable has expired but I'm trying to figure out a way for the server to do this by itself. Is there such a method?
My Reasoning: When the user logs in I report to my database and update the user record for 'lastlogin'. I want to update 'lastlogout' when the user clicks logout or when the $_SESSION
variable expires.
Try settings callbacks in session_set_save_handler on close and gc (garbage collector).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With