After the user successfully logs in, I store login = true in database. But how do I check if the user logged out by closing the browser without clicking the logout button? A
If you are trying to track the users that are 'online' then you might consider using a session for the individual user and instead of storing login=true in the db to display their status to you or others, store the last activity time for the user. When you pull up your list of online users, create your sql query to only return users with 'last_activity' within the last 10 minutes.