Possible Duplicate:
Destroy or unset session when user close the browser without clicking on logout
I am implementing a chat script for my client. The problem I am facing is, if the user logs out, I can program to end his chat status to offline, as the status is set to 1 when the user logs in, but I am confused about, what if the user close the browser without logging out. In this case the status in the db remains 1 as the user hasn't logged out.
Hope you understand the question. Please help.