I would like to store the login, logout and duration time in database.
- The login time is created when the user is authenticated(successfully logged in)
- The logout time is created when the user clicks the logout button
- The duration is logout - login time. (logout minus login)
But the problem is, what if the user didnt click the logout button. Here are the situations:
- Internet loss
- Close the browser/tab. (I need this must use javascript, but i donnu how to do it, any idea?)
EDIT:
I forgot to add something to the question, the program is a full flash program, there is no navigation to other page. Only 1 page