I think that you need to consider / explain how you want to accomplish this in a bit more detail. It seems that you need to keep track of who is active and the time of their last activity. If they have closed the web page for your site, then you won't have anything running on the server for that session (that can access session or cookie data). You probably need some sort of timed task that will periodically check the time of last activity for whoever you believe to be online and mark them as offline if the last activity was older than some pre-determined period (e.g. 30 minutes).
chrishea
Nearly a Posting Virtuoso
1,429 posts since Sep 2008
Reputation Points: 210
Solved Threads: 230
You can check for a session and a valid in-time value.
The mysql db stores the session id and the last activity (e.g. page impression)
You can stop somebody carrying on with a session if there is no activity within say 20 minutes.
diafol
Rhod Gilbert Fan (ardav)
7,796 posts since Oct 2006
Reputation Points: 1,170
Solved Threads: 1,080