CodeIgniter Forums
CodeIgniter logout function in model - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: CodeIgniter logout function in model (/showthread.php?tid=59635)



CodeIgniter logout function in model - El Forum - 10-29-2013

[eluser]Unknown[/eluser]
Hello,

it is possible to make a logout function in model only with session destroy or it is recommended to unset all session data and make session destroy?

Current function
Code:
function close_auth()
{
$this->session->destroy();
}

In Controller i call function like this:
Code:
$this->auth->close_auth();

Thank you for your help! :-)
Tomas


CodeIgniter logout function in model - El Forum - 11-11-2013

[eluser][email protected][/eluser]
You can use the following for login :
Code:
$this->session->set_userdata('loggedin', TRUE);

and for logout :
Code:
$this->session->set_userdata('loggedin', FALSE);