PHP,Codeigniter会话登录

时间:2018-01-22 09:46:21

标签: php codeigniter

function login_proses() {
    $username = $this->input->post('username');
    $password = $this->input->post('password');

    $chek = $this->db->get_where('tabel_users', array('username' => $username, 'password' => $password, 'status' => '1'));
    $chek2 = $this->db->get_where('tabel_users', array('username' => $username, 'password' => $password, 'status' => '0'));

    if ($chek->num_rows() > 0 ) {
      $this->session->set_userdata(array('username' => $username, 'status_login_admin' => 'sudah_login'));
      redirect('admin/home');
    }
    else if ($chek2->num_rows() > 0 ) {
      $this->session->set_userdata(array('username' => $username, 'status_login_sekda' => 'sudah_login'));
      redirect('admin/home_sekda');
    }
    else {
      $this->template->load('templatelogin','admin/login/login_error');   
    }  
  } 

当我运行该代码并插入ch​​ek2的用户名和密码时,我无法访问chek2及其返回登录表单

如何使代码工作,以便我可以访问home_sekda

0 个答案:

没有答案