Reputation: 5673
There is a table default_ci_sessions
in pyrocms. I think this has to be done using this table.
The fields of this table are:
1 session_id varchar(40)
2 ip_address varchar(16)
3 user_agent varchar(120)
4 last_activity int(10)
5 user_data text
sample row:
1 70bb123786d01c0be696e98cb1f6622e
2 0.0.0.0
3 Mozilla/5.0 (Windows NT 6.1) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.168 Safari/535.19
4 1336371726
5 a:7:{s:9:"user_data";s:0:"";s:8:"username";s:5:"admin";s:5:"email";s:22:"[email protected]";s:2:"id";s:1:"1";s:7:"user_id";s:1:"1";s:8:"group_id";s:1:"1";s:5:"group";s:5:"admin";}
I am developing on my localhost and there is just one (above) user registered. What I was thinking before I see the content of the table was that there should be one record at that table since you know :). But there are already 120 records there including guest users session_ids and 10 rows for my user (admin).
I think the only way is to figure out what can I do with this last_activity
field.
And an offtopic question : why there are so much sessions there? aren't they active sessions? So can I group them all for each username and pick the biggest last_activity
?
Upvotes: 1
Views: 394
Reputation: 16055
You can consider a user logged in (since You have no information about logging out) with last activity not older than 24 minutes (24 mins is the time browser default holds the session).
So in Your query You will count those records from default_ci_sessions
where last_activity >= NOW() - INTERVAL '24' MINUTES
...
Upvotes: 1