is there a way to count the number of currently active sessions?
Feb 11th, 2005 03:55
Stoyan Stefanov, Guest,
Yes, it is possible and not very hard to do.
By default php stores session data in files, but you can override this
behaviour and define your own session handling functions that will store
the session data in a database table. Then all you need to do is
SELECT COUNT(*) FROM `your_session_table`;
... and you'll have the number of active sessions.
Redefining session handlers may sound complicated, but you can find a
nice article on how to do this on zend.com -
There is a class definition you can just copy and use as is.