Alexhoward Posted October 20, 2008 Share Posted October 20, 2008 Hi Guys, probably a stupid question, but does anyone know how to count the number of active sessions...? also is it possible to just count a specific group of sessions...? i can't find the answer anywhere.. Thanks in advance! Link to comment https://forums.phpfreaks.com/topic/129315-solved-how-to-count-active-sessions/ Share on other sites More sharing options...
discomatt Posted October 20, 2008 Share Posted October 20, 2008 The 'best' way to do this is to use a custom session handler the implements a database. You can then query the database for active sessions. Link to comment https://forums.phpfreaks.com/topic/129315-solved-how-to-count-active-sessions/#findComment-670448 Share on other sites More sharing options...
DarkWater Posted October 20, 2008 Share Posted October 20, 2008 ...Why? o_O Link to comment https://forums.phpfreaks.com/topic/129315-solved-how-to-count-active-sessions/#findComment-670451 Share on other sites More sharing options...
PFMaBiSmAd Posted October 20, 2008 Share Posted October 20, 2008 A session is just a container that holds data. Counting sessions, no matter how hard or easy it might be does not tell you much. A visitor could in fact have recently visited your site 13 times and he could have 13 different sessions. Whatever you are doing, you need to do it by using some specific data that tells you exactly what you want to know. If you are looking for the number of members (or a list of members) that are currently logged in, then you need to INSERT/UPDATE the last access time for logged in members in a table and then query the table to get those who's last access time is newer than some limit you pick. Link to comment https://forums.phpfreaks.com/topic/129315-solved-how-to-count-active-sessions/#findComment-670459 Share on other sites More sharing options...
Alexhoward Posted October 21, 2008 Author Share Posted October 21, 2008 HI Guys, thanks for the replies. it was a silly question... i was trying to find the number of items in a users shopping basket. but obviously i can just add together all the quantities...!! I thought this would be a build in function thou... Link to comment https://forums.phpfreaks.com/topic/129315-solved-how-to-count-active-sessions/#findComment-670711 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.