Exemplo n.º 1
0
 public function save()
 {
     $id = $this->input->post('id');
     $data['email'] = $this->input->post('email');
     $password = $this->input->post('password');
     if (!empty($password)) {
         $this->load->library('auth');
         $data['password'] = auth::encrypt($password);
     }
     $this->db->update('account', $data, "id = '{$id}'");
     $this->flash->success('<strong>恭喜,</strong> 管理员信息修改成功!');
     redirect('admin/personal');
 }
Exemplo n.º 2
0
Arquivo: Login.php Projeto: lansn/ci
 public function auth()
 {
     $email = $this->input->post('email', TRUE);
     $password = $this->input->post('password', TRUE);
     if (!$email) {
         $this->flash->warning('请输入邮箱!');
         redirect('admin/login');
     }
     if (!$password) {
         $this->flash->warning('请输入密码!');
         redirect('admin/login');
     }
     $this->load->library('auth');
     $password = auth::encrypt($password);
     $count = $this->db->where('email', $email)->where('password', $password)->get('account')->num_rows();
     if ($count > 0) {
         $this->session->set_userdata('sa_email', $email);
         redirect('admin/welcome');
     } else {
         $this->flash->error('邮箱或密码错误!');
         redirect('admin/login');
     }
 }