jasonmc
11-12-2010, 09:18 AM
I need a bit of advice please...I am working on a chat program. When a user logs in, a value in the database is set to 1 (online), and when he/she logs out it is set to 0 (offline).
The probelm is, if a user closes the browser, he/she is still online; not only this, but the session (variables; $_SESSION['username'] etc) is still active aswell.
I was wondering if there is a way around this problem? I have tried onbodyunload in the body tags but cant get it to work. Somebody has suggested having a timer so it automatically logs out after a set time bu i have not got a clue how to do this. If anybody has any advice, please help me it is driving me mad...thanks you very much in advance for any replies :)
The probelm is, if a user closes the browser, he/she is still online; not only this, but the session (variables; $_SESSION['username'] etc) is still active aswell.
I was wondering if there is a way around this problem? I have tried onbodyunload in the body tags but cant get it to work. Somebody has suggested having a timer so it automatically logs out after a set time bu i have not got a clue how to do this. If anybody has any advice, please help me it is driving me mad...thanks you very much in advance for any replies :)