Welcome Guest, Not a member yet? Register   Sign In
Who's online in codeigniter
#1

[eluser]anesmon[/eluser]
At first i think i can use the ci_session in database, but i found that it is hard to do because it store the username in the same field with other userdata. Is there any simple way to do this?
#2

[eluser]InsiteFX[/eluser]
unserialize

The data is an array!

InsiteFX
#3

[eluser]anesmon[/eluser]
Thanks InsiteFX, i think i understand how to get the username. I didn't know that array is structured that way.
Actually i also need the last_activity to displayed in the user profile, anyone has a simple solution?
If it is hard, maybe it is easier to save the last login instead.
#4

[eluser]WanWizard[/eluser]
Last activity is also stored in the session record.

It's not entirely accurate, as it is actually the last session update timestamp, so it depends on the session id rotation time you have defined in the config (default = 300 seconds).

You can easily run a query to get all session records from users active in the last 10 minutes or so. Loop through the results, unserialize the user_data, and retrieve the user info. This also allows you to count guests (user_data without user info).




Theme © iAndrew 2016 - Forum software by © MyBB