Search code examples
codeigniterion-auth

codeigniter, ion_autho logout() session error


Recently i implemented ion_auth into my hmvc system. Now the problem is when i logout from my cms, logout is working, but before is destroying the session is showing me those errors:

Undefined index: session_id

Undefined index: ip_address

Undefined index: user_agent

.....

now i don't know what is next lines of error cause is just for 1 second and then is destroying the session. Could this be a security issue ? Because if i turn off development mode it doesn't show anymore. Any suggestions how to fix this? Thanks


Solution

  • I will answer this problem by myself as nobody willed to help me :) so that was the causing problem

    line 102-103
    //log the user out
    function logout()
    {
        $this->data['title'] = "Logout";
    
        //log the user out
        $logout = $this->ion_auth->logout();
    
        //redirect them to the login page
        $this->session->set_flashdata('message', $this->ion_auth->messages());
        redirect('auth/login', 'refresh');
    }
    

    and I changed it to:

    //log the user out
    function logout()
    {
        if($this->ion_auth->logged_in())
        {
            $this->ion_auth->logout();
            redirect('admin/login', 'refresh');
        }
    
    }
    

    source: I tested myself and is working just fine :)