CodeIgniter back button after logout

后端 未结 6 1148
攒了一身酷
攒了一身酷 2020-12-04 02:02

I\'m trying to stop/disable the back button functionality of the browser when a user logs out of my CodeIgniter (PHP) app. But, I think the browser is caching the page so it

6条回答
  •  囚心锁ツ
    2020-12-04 02:31

    My solution for this problem:

    1. Check that the cookie is set will with an if.
    2. Step parameters and call the login method of user model.
    3. Finally charge the corresponding views.

    If the cookie is not set will redirected to the login page.

    if(isset($_COOKIE['ci_session'])){ 
      $user= $this->security->xss_clean($this->input->post('user'));
      $pass= $this->security->xss_clean($this->input->post('pass'));
    
      $result = $usrLog->loguearUsuario($user, $pass);
    
      if($result == TRUE){
         $data = $this->session->set_userdata('logged_in', $sessArray);
         $this->load->view('pages/admin', $data);
      }
    
    }else{
       header('Location: login'); 
    }
    

    I hope you learn! And sorry for my english! :-)

提交回复
热议问题