Error after loggin out

心已入冬 提交于 2019-12-13 11:24:36

问题


My program works properly.. it has several pages and if i click on the button of the browser to go back, it goes to the previous page:

BUT there is an error after loggin out. When i logged out the program redirects me to the login page, everything seems to be working fine but it does not

When i click on "logout" and the program redirects me to the login system IF I press the button in the browser to go back i got this error:

Do not know what is going on :/

Here is the program line error:

My code, the model file ("m_login"):

public function getDetails()
{
   $st = $this->db->SELECT('cursadas.date as date, cursadas.grade as grade, usuarios.username as user, materias.name as subject')->from('cursadas')
    ->join('usuarios','usuarios.id=cursadas.user_id')
    ->join('materias','materias.id=cursadas.subject_id')
    ->WHERE('cursadas.user_id=',$this->session->userdata['id'])
    ->get()->result_array();
return $st; 
}

My logout function:

        public function logout(){

        $this->session->sess_destroy();
        redirect('login/index');

    }

回答1:


Change getDetails() method by this

// $this->session->userdata['id'] to this code $this->session->userdata('id')


public function getDetails()
{
 $st = $this->db->SELECT('cursadas.date as date, cursadas.grade as grade,
usuarios.username as user, materias.name as subject')->from('cursadas')
->join('usuarios','usuarios.id=cursadas.user_id')
->join('materias','materias.id=cursadas.subject_id')
->WHERE('cursadas.user_id=',$this->session->userdata('id'))
->get()->result_array();
return $st; 
}

see the link for more info

https://www.codeigniter.com/user_guide/libraries/sessions.html#retrieving-session-data



来源:https://stackoverflow.com/questions/43312420/error-after-loggin-out

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!