Quote:
Originally Posted by Fumigator
Those sites are tricking you into thinking they are keeping close track but I assure you they are not. They are using a technique similar to the one I've described. You want to actively keep track of user's sessions and update a database field at a given moment in time when someone becomes idle but that's just wasted effort in my opinion-- you can achieve the same exact results by passively checking when the need arises.
So yes, you could set a Javascript timer to make an Ajax call every 5 minutes, which would determine if the client has done anything on the website, and if not then update the user's status to "idle". And then anyone who is friends with that guy, when they inquire about his status, you can rely on that database value to tell you.
Or, you can determine if he's idle by performing a timediff() on the last_activity column. At any moment you can decide if a user is idle. It's really the same thing, but this way you don't have to constantly update the database, you don't have the overhead of an Ajax call every 5 minutes, and it's one moving part you don't have to worry about it breaking.
|
Ok thankyou very much for you're time, much appreciated, i will look into this sometime later on.