How check user online status in web site?

Posted by Milan Sanda Sri on Stack Overflow See other posts from Stack Overflow or by Milan Sanda Sri
Published on 2013-10-25T03:49:08Z Indexed on 2013/10/25 3:53 UTC
Read the original article Hit count: 165

Filed under:
|
|
|

how can i get know when user online and offline. when one user log in to my site. i set a script to change database table field of that user, as a boolean to indicates users online states. but my problem is if he/she leaved my site without clicking the log-out button, then my script does not work and database show he/she as a online user.

please give me any sugestion to fix this. i have no idea what to do!

i check some answers on this topic, but most of says asnwer lie this -->

if last activity time is less than now+15 minutes
then user is online, offline otherwise.

but i have seen some social networking sites shows that we have gone offline, just we close the browser. how they do that ?

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about php