[eluser]davidbehler[/eluser]
Code:
$this->db->from('sessions');
$this->db->where('last_activity >= ', 'DATE_ADD(NOW(), -5, MINUTES)', FALSE);
$result = $this->db->get();
I don't know what your columns are called exactly or what type of field they are, this is for type datetime. If you are using timestamp, you would have to get use this:
Code:
$this->db->where('last_actitiy >= ', '(UNIX_TIMESTAMP() - 300)', FALSE);
instead.
That should return all sessions that were used since the last 5 minutes. Now you have to loop over all return rows and check if user_data is not empty and user_id is set and valid.
Hope that helps.