예제 #1
0
 public function updateAction()
 {
     $password = I('post.');
     $password['opwd'] = ao_mi($password['userid'], $password['opwd']);
     $password['password'] = ao_mi($password['userid'], $password['password']);
     $user = M('user');
     $map['userid'] = $password['userid'];
     $data = $user->where($map)->find();
     if ($password['opwd'] == $data['password']) {
         $user->data($password)->save();
         echo "success";
         return;
     } else {
         echo "error";
         return;
     }
 }
예제 #2
0
 public function signInAction()
 {
     $name = I('post.name', 0);
     $password = I('post.password', 0);
     $miPassword = ao_mi($name, $password);
     $dbPassword = $this->user->field('password')->where('userid=' . "'{$name}'")->find();
     if ($dbPassword[password] == null) {
         $error = "该用户不存在";
         $this->assign(error, $error);
         $this->loginAction();
     } else {
         if ($dbPassword[password] == $miPassword) {
             session('userId', $name, 1800);
             $url = U('Admin/Index/index');
             redirect_url($url);
             die;
         } else {
             $error = "密码错误";
             $this->assign(error, $error);
             $this->loginAction();
         }
     }
 }
예제 #3
0
 public function resetAction()
 {
     $id = I('get.id', 0);
     if ($id === 0) {
         $resData['status'] = 'error';
         $resData['msg'] = '未接收到id值';
     } else {
         $map['userid'] = $id;
         $userM = M('User');
         $pwd['password'] = '******';
         $pwd['password'] = ao_mi($map['userid'], $pwd['password']);
         $resDel = $userM->where($map)->save($pwd);
         if ($resDel === null) {
             $resData['status'] = 'error';
             $resData['msg'] = '重置失败';
         } else {
             $resData['status'] = 'success';
             $resData['msg'] = '重置成功';
         }
     }
     $url = U('index');
     if ($resData['status'] == 'success') {
         $this->success('重置成功', $url, 2);
     } else {
         $this->error('重置失败', $url);
     }
 }