willpower Posted February 20, 2007 Share Posted February 20, 2007 Hi I have probably gone about this the wrong way...so please advise 1 User Logs in. 2. Session created 3. DB updated WHERE user_logged_in = true Now this means that if I try and log in with a name already logged on, upon checking I can see that user is already loged in and then deny the new log on. Which is the ONLY reason that I created the user_logged_in field Now the problem lies, of course, when someone closes their browser and doesn't log out. The session is destroyed but the DB field remains true. How does one normally go about this. How can I create a system where I can identify who is logged in and therefore prevent duplicate log ins and allow this to cope with users not logging off? Thanks Will Link to comment https://forums.phpfreaks.com/topic/39286-log-in-seesion-and-dbtits-up-me-thinks/ Share on other sites More sharing options...
willpower Posted February 20, 2007 Author Share Posted February 20, 2007 **bump** Link to comment https://forums.phpfreaks.com/topic/39286-log-in-seesion-and-dbtits-up-me-thinks/#findComment-189410 Share on other sites More sharing options...
trq Posted February 20, 2007 Share Posted February 20, 2007 You also need to create a timestamp field, then this field needs to be updated anytime your user makes a page request. You then run a cron job to query the database and delete any logged in users who have not made a request within say the last 10 minutes. Link to comment https://forums.phpfreaks.com/topic/39286-log-in-seesion-and-dbtits-up-me-thinks/#findComment-189414 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.