Welcome Guest, Not a member yet? Register   Sign In
destroy session then set flash data
#3

[eluser]thinkigniter[/eluser]
[quote author="NZmuzzer" date="1229220857"]I have a very similar problem. Using v1.7 session class with database. When the user logs out the session record (database row) is removed and a new one created for the now logged out (guest) user. A flashdata messeage is then set, "You are now logged out", and the page redirected to the homepage.

Code:
function logout()
    {
        $this->wd_auth->logout();
        $this->session->set_flashdata( 'notice', '<p>Welcome, you are now logged out</p>' );
        redirect( 'homepage' );
    }

[/quote]
Try changing function logout() to this...
Code:
function logout()
    {
        $this->ci =& get_instance();
        $config =& get_config();
        
        // delete user record from session table
        $this->ci->db->where( 'session_id', $this->ci->session->userdata( 'session_id' ) );
        if( $query = $this->ci->db->delete( $config['sess_table_name'] ))
            return FALSE;
        
        // destroy the session
        $this->CI->session->sess_destroy();
     $this->session->set_flashdata( 'notice', '<p>Welcome, you are now logged out</p>'
        return TRUE;
    }


Messages In This Thread
destroy session then set flash data - by El Forum - 12-12-2008, 07:59 AM
destroy session then set flash data - by El Forum - 12-13-2008, 02:14 PM
destroy session then set flash data - by El Forum - 12-14-2008, 05:51 PM
destroy session then set flash data - by El Forum - 12-20-2008, 06:06 PM
destroy session then set flash data - by El Forum - 06-03-2010, 07:44 AM
destroy session then set flash data - by El Forum - 06-03-2010, 08:16 AM
destroy session then set flash data - by El Forum - 06-03-2010, 01:20 PM



Theme © iAndrew 2016 - Forum software by © MyBB