komquat Posted August 10, 2007 Share Posted August 10, 2007 Can you set up something in sessions that shows who is currently logged in? The forum does it, is that in php? Please point me in the right direction. Thank you Link to comment https://forums.phpfreaks.com/topic/64180-active-sessions/ Share on other sites More sharing options...
Fadion Posted August 10, 2007 Share Posted August 10, 2007 As far as my knowledge goes, i dont think u can use sessions, as theyre stored locally. Maybe a 'logged' column in the user's table which is marked as 'true' when a user logs in, may do it. Link to comment https://forums.phpfreaks.com/topic/64180-active-sessions/#findComment-319905 Share on other sites More sharing options...
teng84 Posted August 10, 2007 Share Posted August 10, 2007 showing whos logged in is done in db when the session is register it will be set in the db like active else inactive now the forum will query for those active and show in the board Link to comment https://forums.phpfreaks.com/topic/64180-active-sessions/#findComment-319908 Share on other sites More sharing options...
komquat Posted August 10, 2007 Author Share Posted August 10, 2007 What if you leave the page and stay logged in? Link to comment https://forums.phpfreaks.com/topic/64180-active-sessions/#findComment-319911 Share on other sites More sharing options...
teng84 Posted August 10, 2007 Share Posted August 10, 2007 no if you close the page your session will be killed and when you dont close it the ini set will take charge we have the ini_set() something like that to declare how long will the session stay Link to comment https://forums.phpfreaks.com/topic/64180-active-sessions/#findComment-319915 Share on other sites More sharing options...
komquat Posted August 10, 2007 Author Share Posted August 10, 2007 but this will not update the DB that said you are logged in. I will try this! Link to comment https://forums.phpfreaks.com/topic/64180-active-sessions/#findComment-319929 Share on other sites More sharing options...
trq Posted August 10, 2007 Share Posted August 10, 2007 The easiest way to do this is to store a flag and a timestamp when as user logs in. On each request the timestamp needs to be updated. Then, all you do is simply run a cronjob every 10 minutes or so that looks for timestamps older than say 8 minutes or so (must be slightly longer than your default session timeout setting) and deletes these entries. Link to comment https://forums.phpfreaks.com/topic/64180-active-sessions/#findComment-319936 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.