public function customValidate() { if (count($this->errors) == 0) { if (!isEmail($_POST['email'])) { $this->errors['email'] = "not_validate"; } if (isset($_POST['tel'])) { if (!isTel($_POST['tel'])) { $this->errors['tel'] = "not_validate"; } } if (!$this->checkAvailableUsername($_POST['username'])) { $this->errors['username'] = "******"; } } if (count($this->errors) > 0) { return false; } else { return true; } }
public function queryIsRegister($phone) { $data['result'] = 1; if (isTel($phone)) { $sql = "select * from t_user where user_id = '" . $phone . "'"; $m = M(); $res = $m->query($sql); if (count($res) > 0) { $data['result'] = 2; $data['reason'] = "手机已存在"; } else { $data['result'] = 0; $data['reason'] = "手机号码可用"; } } else { $data['reason'] = "手机号格式不正确"; } $this->ajaxReturn($data); }