2014-03-12 3 views
1

내보기 페이지에서 로그 아웃을위한 링크를 만듭니다. 클릭하면 다른 페이지로 이동하지만 브라우저의 뒤로 버튼을 클릭하면 마지막 페이지로 돌아옵니다. 로그 아웃 할 때 로그 아웃합니다.이 문제를 방지하려면 어떻게해야합니까? 동작?
cotroller : 당신의 도움에 대한codeigniter에서 로그 아웃하는 가장 좋은 방법은 무엇입니까?

function logout(){ 
$this->session->sess_destroy(); 
redirect('acontrol/index');} 

감사합니다. 세션인지 여부를 사전에 존재라는 것입니다 당신은 당신이 당신의 class.It에서 __construct 기능에서 확인할 수 있습니다 again.Better 로그인 페이지로 리디렉션해야하는 세션이 비어 not.If 것을

답변

0

당신은 before the function calls를 확인하실 수 있습니다 귀하의 함수 호출 그래서, 각 페이지에 대한 페이지가 귀하의 세션이 비어 때마다 로그인 리디렉션됩니다.

function __construct() { 
    if($this->session->userdata('iUserId') == '') { 
     // Redirect to Login page 
     redirect('controllername/login'); 
    } 
} 
0

당신은 컨트롤러 구조 방식으로 세션을 확인할 수 있습니다

public function __construct() 
    { 
     // Initialization of class 
     parent::__construct(); 

     if(!$this->session->userdata('id')){ 

      $this->session->set_flashdata('error', 'Please login first'); 

      /* if user is not login then 
      redirect back to login page and show error 
      */ 

      redirect('admin/login/index'); 
     } 

    } 
관련 문제