i wrote a Website in PHP with user authentification. I used sessions for this. When a user logs in, a flag in a database is set and when he logs out this flag is reseted. This prevents that one user can login multiple times into the Website.
All works fine, but when the user forgets to logout, the session become invalid after a time. When the user now tries to relogin, he will be prevented from login, because the flag is still set.
I need a handler/function that will be invoked, when the session becomes invalid/destroyed. How can i do this?
I know that there is a function called session_set_save_handler but i only need the destroy function. Don't need the other functions and can i access the $_SESSION variables in that function ? Because in this variable the userid is saved, whose flag need to be reseted.
Thanks for help.