How do I go about checking to see who is logged onto my website?
if(isset($_SESSION['userID'])){
display content for logged in user
}
else{
display content for non-logged in user
}
this will tell me what to echo depending if the user is logged in or not.
But how do I check every user account in the db and determine who is currently logged in?
If a user logs into the site, I can set a loggedIn field in the user's table to 'true'.
Then when the user clicks the log out button, I can easily set that field to false...but if the user closes the browser or navigates to another site, I am without a clue on how to update the db...
Any ideas???
How to check who is currently logged in?
Moderator: General Moderators
- aceconcepts
- DevNet Resident
- Posts: 1424
- Joined: Mon Feb 06, 2006 11:26 am
- Location: London
Re: How to check who is currently logged in?
I think in this case what you would have to do is detect whether the browser window is attempting to close (probably by using Javascript) and deal with it from there.
Have a look on the web for such Javascript procedures.
Have a look on the web for such Javascript procedures.