I use sessions to log in users. When the user logs in I update a table to 1 and once logged out it is set back to 0. The reason I did it this way was to avoid using cookies.
My problem is that when someone closes the browser it doesn't set that flag back to 0. They are still logged in. Any ideas on how to log these users out? Should I set an activity stamp and check against that?
PHP: Log Out Users
Started by Ronin, Apr 16 2007 10:31 AM
3 replies to this topic
#1
Posted 16 April 2007 - 10:31 AM
|
|
|
#2
Posted 16 April 2007 - 08:43 PM
You can check for browser close-down, using JavaScript - but nowadays many people have JavaScript disabled, so it wouldn't work for everyone. IMO would the best solution be to make the timestamp, you was talking about. Then check it with a fixed amount of time, and if the user hasn't been active, you would set the flag to zero.
#3
Posted 26 April 2007 - 06:07 AM
I believe the time stamp would work. If they were not active for over 30 minutes or so then you could remove it. You could create a variable or time stamp in your DB. Everytime they move to a new page the time stamp gets reset so you can determine if they are active or not.
Hi >> Saint
#4
Posted 26 April 2007 - 06:42 AM
That is basically what I did and it works fine for now. :)


Sign In
Create Account


Back to top









