PHP: on session death change DB

tinasea

New Member
I am using PHP for a project. I have set the session life to 0 so that when the user closes the browser, the session dies and he/she is logged out. However, I have a status variable in the DB which stores the information telling me if the user is logged in or not. I use this to inform other users the status of a particular user.When the session dies, how can I call a function that will change the value in my DB?I have looked at overriding the session_set_save_handler(). But that requires me to override the entire function and define my own sessions. Is there a function that is called that I could use to change my DB variable?Is there a better way for me to implement what I am trying to achieve?ThanksEdit: For those in the same situation as I am, I did what nikic suggested. I have a log which keeps track of each page visited by every user. In order to check if a user is online I check my DB to check if the logged in variable is set and then double check if there has been some activity in the recent past to know if the user is actually online.
 
Back
Top