这个代码在一台电脑上工作正常,但在转移到另一台电脑后,它无法正常工作。会议即将到期。这是我的代码。
public function login($type='') {
if ($this->isLoggedIn()) {
redirect('user-home');
}
$form_action = $this->input->post('action');
if (!empty($form_action) && $form_action === 'login') {
$this->load->library('form_validation');
if($type == 'X')
$this->form_validation->set_rules('x_id', 'X Id', 'trim|required|xss_clean');
else
$this->form_validation->set_rules('email', 'Email', 'trim|required|xss_clean|valid_email');
$this->form_validation->set_rules('password', 'Password', 'trim|required|xss_clean');
if ($this->form_validation->run() == FALSE) {
$message = array('type' => 'danger', 'msg' => 'The email address or password you entered is incorrect.');
$this->session->set_flashdata('message', $message);
redirect('login');
} else {
$user_info = $this->user_model->login($auth_data, $type);
// HERE USER info found properly
if (!empty($user_info)) {
$this->session->set_userdata('curr-user', $user_info);
$this->loginLog();
// HERE USER info found also
redirect('user-home');
} else {
$message = array('type' => 'danger', 'msg' => 'The email address or password you entered is incorrect.');
$this->session->set_flashdata('message', $message);
redirect('login');
}
}
} else {
redirect('login');
}
}
重定向后,在CI会话的user_home控制器的构造函数中找到一种类型的用户,但是另一种类型(x)丢失。
注意: 我没有使用会话数据库