Possible Duplicate:
Best way to detect when user leaves a web page
Check if user closed the page in PHP?
i did not find my answer by viewing other question.
As i wanted to make online chat application for my web site
Many answers says that store users status to 1 so that we can identify who is login
on Logut i will make status to 0
yes this is good idea but my confusion is that if someone not logut and close the browser or user’s session expire in anyway how do i set status to 0
Have a look here: http://www.daniweb.com/web-development/javascript-dhtml-ajax/threads/324675/help-needed-please-update-database-on-browser-close. I think this is what you are after.