Alex Rivera | Logout

How to detect if a user has logged out, in php?

Asked 2009-05-20T13:32:11.210
10

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? And also, how do I redirect user who has been inactive for 10 minutes to login page?

I am using php and mysql. Any help would be appreciated.

EDIT: Sorry if my question is not clear. I did use session to store whether they are logged-in or not. But, now I want to store the info in database, so that I can display their status on other pages. Let's say user1 has 3 friends. When displaying all his friends, user1 want to know whether his friends are online or offline. This is what I want. Any advise?

Edit
Report

1 Answer

0

Why dont you use session or cookies for this instead of inserting it in the database. You can set the cookies by using setcookie() function or either you can make a session vaiable and store the value in it.

answered 2009-05-20T13:36:09.953

Your Answer