CodeIgniter Forums
Session destroy - 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: Session destroy (/showthread.php?tid=29553)



Session destroy - El Forum - 04-13-2010

[eluser]myjeep_2003[/eluser]
I am using mysql table to store session and trying to delete session (logout function) It is not killing the sessions... what is wrong...?


function logout()
{

$this->delete_autologin();

// See http://ellislab.com/forums/viewreply/662369/

$this->ci->session->set_userdata(array('user_id' => '', 'username' => '', 'status' => ''));

$this->ci->session->sess_destroy();


}


Session destroy - El Forum - 04-13-2010

[eluser]danielpetrie[/eluser]
*removed*

didn't see you used tankAuth.. have no experience with that, sorry.


Session destroy - El Forum - 04-13-2010

[eluser]myjeep_2003[/eluser]
I am not sure what are you referring to by *removed*..IS there a technique to be used if one uses ci sessions stored in table?


Session destroy - El Forum - 04-13-2010

[eluser]bobbob[/eluser]
This doesn't work?

$this->session->sess_destroy();


Session destroy - El Forum - 04-13-2010

[eluser]danielpetrie[/eluser]
[quote author="myjeep_2003" date="1271207154"]I am not sure what are you referring to by *removed*..IS there a technique to be used if one uses ci sessions stored in table?[/quote]

I deleted my post because I realized my solution wouldn't work because you were using tankAuth.


Session destroy - El Forum - 04-13-2010

[eluser]myjeep_2003[/eluser]
My logout function looks like this,,,, but it does not work... Since I am using table to store the session data, do I need to delete table records ..? just a thought..

function logout()
{

$this->delete_autologin();

// Remove token from the session
$this->ci->session->unset_userdata('user_id');

$this->ci->session->sess_destroy();

}