Welcome Guest, Not a member yet? Register   Sign In
User is logged in - CI destroys session - how to know if user was logged in?
#2

[eluser]WanWizard[/eluser]
You can extend the session library, and then define your own session_destroy:
Code:
function sess_destroy()
    {
        var_dump($this->userdata); // you can access the session data here before it's destroyed

        $logged_in = $this->userdata['is_logged_in']; // or do something like saving the current logged-in state
        parent::sess_destroy(); // call the original method
        if ( $logged_in )
        {
            redirect('you_have_been_logged_out_controller');
        }
    }
Note that the destroy method contains a design flaw: it does delete the session record and the cookie, but not the session data currently loaded. So your controllers will still be able to access the userdata as if the session still existed.


Messages In This Thread
User is logged in - CI destroys session - how to know if user was logged in? - by El Forum - 04-29-2010, 01:16 PM



Theme © iAndrew 2016 - Forum software by © MyBB