function auth(){
$nic = $this->input->post('nic',TRUE);
$password = md5($this->input->post('password',TRUE));
$this->load->model('Login_model');
$validate = $this->Login_model->validate($nic,$password);
$this->load->helper("cookie");
$autoLogin = $this->input->post("autologin",true);
if($validate->num_rows() > 0){
$data = $validate->row_array();
$nic = $data['user_nic'];
$name = $data['user_name'];
$email = $data['user_email'];
$level = $data['user_level'];
$sesdata = array(
'nic' => $nic,
'username' => $name,
'email' => $email,
'level' => $level,
'logged_in' => TRUE
);
$this->session->set_userdata($sesdata);
if($level === '1'){
redirect('Forget/dashboard');
// access login for staff
}elseif($level === '2'){
redirect('welcome/officer_dashboard');
// access login for author
}elseif($level === '3'){
redirect('User/User_Dashboard');
}
}else{
echo $this->session->set_flashdata('msg','Username or Password is Wrong');
redirect('welcome');
}
}
}
这是我的用户身份验证功能,它根据用户级别重定向到年龄。根据用户级别,我有很多视图。但是每当我登录时,第二个选项卡基本 url 就会再次重定向到登录页面。TIA
天涯尽头无女友
噜噜哒