2016-05-09 10 views
0

今Codeigniterを使用してシステム文書を開発しています。しかし問題はログインしていない問題ページ間でを切り替える。ログインとようこそこれのように永遠にスイッチを入れる。Codeigniterのログインエラーログインとウェルカムの切り替え

public function index() 
{ 
    if($this->input->post(NULL)){ 
     $username = $this->input->post('username'); 
     $password = $this->input->post('password'); 

     $result = $this->m_login->check_login($username,$password); 

     if(!empty($result)){ 
      $data_account = array(); 
      foreach($result as $row){ 
       $data_account = array(
        'account_id' => $row->id, 
        'username' => $row->user_name, 
        'password' => $row->password, 
        'fullname' => $row->fullname, 
        'email' => $row->email, 
        'tel' => $row->tel, 
        'detail' => $row->detail 
       ); 
      } 
      $this->session->set_userdata('data_account',$data_account); 
      $this->__login(); 
      //create_log_activity($this->account_id, date("Y-m-d H:i:s")); 
      redirect('welcome', 'refresh'); 
      exit; 
     }else{ 
      $this->load->view('login'); 
     } 
    }else if($this->session->userdata('data_account')){ 
     redirect('welcome', 'refresh'); 
     exit; 
    }else{ 
     $this->load->view('login'); 
    } 
} 

public function logout(){ 

    $this->session->unset_userdata('data_account'); 
    redirect('','refresh'); 
} 

私は問題を解決する方法を知りたい、事前に感謝します。

+0

はたぶん、あなたがチェックしたいです ' if($ this-> input-> post(NULL)){'?()の代わりに{$ this-> input-> post( 'submit')) – Tpojka

答えて

0

使用 場合($ _、SERVER [ 'REQUEST_METHOD'] == "POST"){ の代わりに、 場合(の$ this - >入力 - >ポスト(NULL)){