plutomed Posted June 5, 2010 Share Posted June 5, 2010 I have been thinking about this for a while now. What is the best way to see if someone is online? For example in Facebook chat people log on and off all the time and if no response after a while you get the "busy". I am creating an online games system and want to play with other computers. If someone goes inactive after say 30s I want to be able to detect this. The best way I have come up with is to ping a script every 30s to say the person is still online and if the person hasn't pinged in they are set to offline. Is this the best way or does anyone have any better ideas? Quote Link to comment Share on other sites More sharing options...
haku Posted June 6, 2010 Share Posted June 6, 2010 You can set up a table in your database that contains the user ID, and their last activity. Every time they load a page, you update this table with their last activity. When you want to check if they are online or not, you query this table to get the time of their last activity, and if it's been more than ___minutes (choose whatever time you think is appropriate), then they are offline, and if it's been less than that, they are online. Quote Link to comment Share on other sites More sharing options...
ignace Posted June 6, 2010 Share Posted June 6, 2010 you query this table to get the time of their last activity, and if it's been more than ___minutes (choose whatever time you think is appropriate), then they are offline, and if it's been less than that, they are online. The same applies for setting them to busy. Quote Link to comment Share on other sites More sharing options...
plutomed Posted June 6, 2010 Author Share Posted June 6, 2010 Yes that'll do donkey that'll do. Thanx. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.