Reputation: 2437
I want to force a user to logout when I change it's status to 'inactive' using session in codeigniter.
I used the method below, but it destroyed my own session:
function deactivate($user_Id)
{
$this->session->unset_userdata(array('user_Id' => $user_Id));
}
Upvotes: 3
Views: 2182
Reputation: 145
I happened to need this feature implemented and here is how I did it:
You can also use this to prevent concurrent login such as the last successful login user bump the previous one.
Upvotes: 3
Reputation: 9444
Use the sess_destroy()
method instead:
function deactivate() {
$this->session->sess_destroy();
}
Upvotes: 0