how can you tell whether a user is still online?
please excuse me if this isn't a php ques.
In what context? What kind of website are you referring to?
...still online? As in has the user not hung up the connection?
or do you mean:
still looking at and interacting with your webpage?
still got one of his browser tabs with your webpage loaded?
or something else?
You can't tell in real time unless their browser is currently making a request for information from the server.
The best you can do is to assume that anyone who made a request in the last X minutes is still online. Five or ten minutes are typical time periods used for this by various sites.