/** * 申请认证详情页 */ public function certDetailAction() { $id = $this->getRequest()->getParam('uid', 0); $id = safe::filter($id, 'int', 0); if ($id) { } }
/** * 登录处理 */ public function doLogAction() { $account = safe::filterPost('account'); $password = $_POST['password']; $captcha = safe::filterPost('captcha', '/^[a-zA-Z]{4}$/'); $data = array('errorCode' => 0); $captchaObj = new captcha(); if ($account == '') { $data['errorCode'] = 1; } else { if ($password == '') { $data['errorCode'] = 2; } else { if ($captcha == '') { $data['errorCode'] = 3; } else { if (!$captchaObj->check($captcha)) { //验证码是否正确 $data['errorCode'] = 4; } else { $userModel = new UserModel(); $userData = $userModel->checkUser($account, $password); if (empty($userData)) { //账户密码错误 $data['errorCode'] = 5; } else { //登录成功 $checkRight = new checkRight(); $checkRight->loginAfter($userData); } } } } } $data['returnUrl'] = isset($_POST['callback']) && $_POST['callback'] != '' ? trim($_POST['callback']) : url::createUrl('/'); echo JSON::encode($data); return false; }
/** * 子账户添加处理 */ public function doSubAccAction() { if (IS_POST) { $data = array(); $data['user_id'] = safe::filterPost('id', 'int', 0); $data['pid'] = $this->user_id; $data['username'] = safe::filterPost('username'); $data['mobile'] = safe::filterPost('mobile', '/^\\d+$/'); $data['email'] = safe::filterPost('email', 'email'); $data['password'] = safe::filterPost('password', '/^\\S{6,20}$/'); $data['repassword'] = safe::filterPost('repassword', '/^\\S{6,20}$/'); $data['head_photo'] = tool::setImgApp(safe::filterPost('imgfile1')); $data['status'] = safe::filterPost('status', 'int'); $userModel = new UserModel(); if ($data['user_id'] == 0) { //新增子账户 $res = $userModel->subAccReg($data); } else { //更新子账户 if ($data['password'] == '') { //账户密码为空则不修改密码 unset($data['password']); unset($data['repassword']); } $res = $userModel->subAccUpdate($data); } if (isset($res['success']) && $res['success'] == 1) { $this->redirect('subAccList'); } else { echo $res['info']; } } return false; }