CodeIgniter Forums
i need to unserialize all user session data - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=11)
+--- Thread: i need to unserialize all user session data (/showthread.php?tid=62391)



i need to unserialize all user session data - nirav - 07-09-2015

Hello,

I have many try to get unserialize data of users.
I want to get all online users in my store so how can i do this???

I have used following code.

$CI =& get_instance();
$CI->db->select('*');
$query = $CI->db->get('ci_sessions');
if($query->num_rows() > 0){
foreach ($query->result() as $result):
pre(unserialize($result->data));
endforeach;
}

Sample code from database data filed.
__ci_last_regenerate|i:1436435382;user_id|s:1:"1";user|O:8:"stdClass":7:{s:7:"user_id";s:1:"1";s:8:"username";s:4:"test";s:9:"firstname";s:4:"Test";s:8:"lastname";s:4:"Demo";s:5:"email";s:18:"[email protected]";s:5:"about";s:245:"Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.";s:7:"support";s:245:"Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.";}