Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
517 views
in Technique[技术] by (71.8m points)

php - Error after loggin out

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:

https://i.stack.imgur.com/KgNLK.png

Do not know what is going on :/

Here is the program line error:

https://i.stack.imgur.com/1M0ZS.png

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');

    }
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...