CodeIgniter Forums
In Code Igniter, destroying a specific session - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: General (https://forum.codeigniter.com/forumdisplay.php?fid=1)
+--- Forum: Lounge (https://forum.codeigniter.com/forumdisplay.php?fid=3)
+--- Thread: In Code Igniter, destroying a specific session (/showthread.php?tid=86190)



In Code Igniter, destroying a specific session - leusiam - 01-19-2023

I'd want to be able to log people out of my Code Igniter app.

I know how to bring an active local session to a close:

Code:
$this->session->sess_destroy();

How can I end a session that was initiated on another machine and log a user out of their session?
I keep a unique id connected with their account in the session data so that I can see it in the database's session table, but it is stored among the other session data in a column named user data, the contents of which look similar to this:

a:4:
{s:9:"user_data";s:0:"";s:6:"userid";s:6:"189034";s:9:"logged_in";b:1;s:5:"token";i:1767727789;}

wherein 189034 is the user id.

Is there a method to choose a record in the session database depending on the user's id, delete the row, and then kill the session? Is there any way to accomplish this entirely?