예제 #1
0
 /**
  * 检查该QQ是否已被注册
  * @param string qq 用户提交的qq字段
  * @access protected
  * */
 protected function checkQq($qq)
 {
     $mo = new UsersModel();
     if (empty($mo->where(array('qq' => $qq))->find())) {
         return true;
     } else {
         return false;
     }
 }
예제 #2
0
 protected function checkInf()
 {
     $mo = new UsersModel();
     $mo->where(array('uid' => $_POST)['uid']);
     if (empty($mo->find())) {
         return true;
     } else {
         return false;
     }
 }
예제 #3
0
 /**
  * 校验密码是否正确
  * 内置回调函数
  * @access protected
  * @param string $password 提交的密码
  * @return boolean
  * */
 protected function checkPassword($password)
 {
     $mo = new UsersModel();
     $mo->where(array('uid' => $this->uid));
     $dbPassword = $mo->getField('password');
     $subPassword = crypt($password, $dbPassword);
     if ($dbPassword != $subPassword) {
         return false;
     } else {
         return true;
     }
 }
예제 #4
0
 /**
  * 入口函数。此函数会被自动调用
  * */
 public function run()
 {
     //检查验证码
     if (!(APP_DEBUG && C('Not_VerifyCode'))) {
         check_verify(I('post.verifycode')) or drop(EC_4341);
     }
     //校验登陆信息
     test_token() or drop(EC_4342);
     //尝试创建数据对象
     $mo = new UsersModel();
     $mo->field('uid,password');
     $mo->create(array('uid' => cookie('uid'), 'password' => I('post.password')), Model::MODEL_UPDATE) or drop($mo->getError());
     //检测字段值
     if (I('post.password') != I('post.re_password')) {
         drop(EC_4343);
     }
     //写入数据
     $mo->save() or drop(EC_4351 . $mo->getError());
     //执行登出操作
     R('Service/_empty', 'action=SignOut') or drop(EC_4361);
 }
예제 #5
0
파일: function.php 프로젝트: pea3nut/wa
/**
 * 查询当前协会编号的状态(users表中的state字段)
 * @param $uid String(4) 要查询的协会编号
 * @return String(3) 当前协会编号的状态
 * */
function get_state($uid)
{
    if (empty($uid)) {
        $uid = cookie('uid');
    }
    $mo = new UsersModel();
    $mo->where(array('uid' => $uid));
    return $mo->getField('state');
}