php - Codeigniter - How to get Other user session -
i'm using chat in codeigniter here i'm tring active users can display in chat whether user online or offline. tried following result empty.
$this->session->all_userdata();
kindly me.
if using database sessions, potentially verify login status using call ci_sessions table (or whatever have named it). can use simple query validate if have been browsing within last hour (or whatever) , validate them being online.
sample sql query this:
select from_unixtime(timestamp) 'timestamp' ci_sessions timestamp > unix_timestamp(date_add(curdate(),interval -1 hour)) order timestamp desc
this return users active in last hour (the timestamp col updated each time page requested)
you can grab users details out of 'data' column...
$this->session->all_userdata()
will not return logged in users available data of current logged in user
Comments
Post a Comment