Whenever a user logs in the site updates the MySQL database to show that "user-A" is logged in and also gives a cookie to stay logged in.
I can make it show whos online.. My problem is of a similar nature though..
I have it set to whenever a user logs out, it gets rid of the cookie and updates the database so that "user-A" is now showing as OFFLINE.
The problem arises when people dont log out and therefor are still considered "online" for an unlimited amount of time.
The people using my site are very lazy and want to stay logged in for long periods of time, but I dont want it to show them online if they arent.. (like if they leave the site it shows them offline)
Is there anyway to update the database OnExit?
I looked into the OnExit thing for the body tag (in HTML) but I cant figure out how it could perform a PHP function. Everything I have seen using the OnExit thing calls a javascript function.
Any help will be greatly appreciated!