private function checkLogin()
 {
     $user = M('user');
     $data = $user->where('level =1')->select();
     $verify = new Verify();
     if ($verify->check(I('post.verify'))) {
         $uname = I('post.uname');
         $pass = I('post.pass');
         if (empty($uname)) {
             $this->error("账号不能为空");
         } elseif (empty($pass)) {
             $this->error("密码不能为空");
         }
         foreach ($data as $value) {
             if (I('post.uname') == $value['name'] && md5(md5(I('post.pass'))) == $value['pass']) {
                 session('uname', I('post.uname'));
                 header('Location:' . __APP__);
             } else {
                 alert('密码错误', '');
                 return false;
             }
         }
     } else {
         $this->error("验证码错误!");
     }
 }
 public function verify()
 {
     $config = array('fontSize' => 20, 'length' => 4, 'useNoise' => false);
     $Verify = new \Think\Verify($config);
     $Verify->codeSet = '0123456789';
     $Verify->entry();
 }
 function verify_code()
 {
     $config = array('length' => 4, 'useNoise' => false, 'reset' => false);
     ob_clean();
     $Verify = new \Think\Verify($config);
     $Verify->entry();
 }
Example #4
0
 public function GetVerifyCode()
 {
     $Verify = new \Think\Verify();
     $Verify->fontSize = 35;
     $Verify->length = 5;
     session('verify_code', "123");
     $Verify->entry();
 }
 public function verify()
 {
     //import('ORG.Util.Image');
     //Image::buildImageVerify();
     $config = array('fontSize' => 15, 'length' => 4, 'useNoise' => false, 'imageH' => 40, 'imageW' => 110);
     $Verify = new \Think\Verify($config);
     $Verify->entry();
 }
Example #6
0
 public function indexAction()
 {
     $sessionObj = new USession($this);
     $v = new Verify();
     $rcode = $v->createCodeStr();
     $sessionObj->getSessionData()->set('rcode', $rcode);
     $v->entry();
 }
 public function verify()
 {
     $Verify = new \Think\Verify();
     $Verify->length = 1;
     $Verify->imageW = 180;
     $Verify->imageH = 40;
     $Verify->fontSize = 20;
     $Verify->entry();
 }
 public function login_do()
 {
     //检测验证码
     $code = I('code');
     $verify = new Verify();
     if ($verify->check($code)) {
         $this->success('验证成功');
     } else {
         $this->error('验证码错误');
     }
 }
 public function index()
 {
     import("Verify");
     //$checkcode = new \Checkcode();
     $verify = new Verify();
     $verify->entry(1);
     /*
     if (isset($_GET['code_len']) && intval($_GET['code_len']))
         $checkcode->code_len = intval($_GET['code_len']);
     if ($checkcode->code_len > 8 || $checkcode->code_len < 2) {
         $checkcode->code_len = 4;
     }
     //设置验证码字符库
     if(isset($_GET['charset'])){
     	$checkcode->charset = trim($_GET['charset']);
     }
     //强制验证码不得小于4位
     if($checkcode->code_len < 4){
         $checkcode->code_len = 4;
     }
     if (isset($_GET['font_size']) && intval($_GET['font_size']))
         $checkcode->font_size = intval($_GET['font_size']);
     if (isset($_GET['width']) && intval($_GET['width']))
         $checkcode->width = intval($_GET['width']);
     if ($checkcode->width <= 0) {
         $checkcode->width = 130;
     }
     if (isset($_GET['height']) && intval($_GET['height']))
         $checkcode->height = intval($_GET['height']);
     if ($checkcode->height <= 0) {
         $checkcode->height = 50;
     }
     if (isset($_GET['font_color']) && trim(urldecode($_GET['font_color'])) && preg_match('/(^#[a-z0-9]{6}$)/im', trim(urldecode($_GET['font_color']))))
         $checkcode->font_color = trim(urldecode($_GET['font_color']));
     if (isset($_GET['background']) && trim(urldecode($_GET['background'])) && preg_match('/(^#[a-z0-9]{6}$)/im', trim(urldecode($_GET['background']))))
         $checkcode->background = trim(urldecode($_GET['background']));
     $checkcode->doimage();
     
     //验证码类型
     $type = I("get.type");
     $type = $type?strtolower($type):"verify";
     $verify = session("_verify_");
     if(empty($verify)){
         $verify = array();
     }
     $verify[$type] = $checkcode->get_code();
     session("_verify_",$verify);
     */
 }
 public function login($username = null, $password = null, $code)
 {
     if (IS_POST) {
         $v = new Verify();
         if (!$v->check($code, "")) {
             $this->error("验证码有误!");
         }
         $admin = M("AdminUser");
         $result = $admin->where("username='******' and password='******'", $username, $password)->select();
         if (count($result) == 0) {
             $this->error("错误的用户名或密码!");
         }
         $auth = array();
         $auth["username"] = $username;
         session("user_auth", $auth);
         $this->success("登录成功", U("Index/admin"));
     } else {
         $this->index();
     }
 }
 public function login()
 {
     if (IS_POST) {
         $loginModel = D('Admin');
         if ($data = $loginModel->validate($loginModel->LoginRules)->create()) {
             $verify = new Verify();
             if ($verify->check($_POST['verify'])) {
                 if ($loginModel->login()) {
                     $admin_info = $loginModel->get_admin_info($data['username']);
                     $_SESSION['last_login'] = $admin_info[0]['last_login'];
                     $this->success('登录成功', U('Admin/Index/index'));
                     exit;
                 }
             } else {
                 $this->error('验证码错误');
             }
         }
         $this->error($loginModel->getError());
     }
     $this->display('login');
 }
 public function accept()
 {
     $data = I('post.');
     $verify = new Verify();
     if (!$verify->check($data['code'])) {
         $this->ajaxReturn(array('status' => 403, 'info' => '验证码错误'));
     }
     if (mb_strlen($data['stunum'], 'utf-8') != 10) {
         $this->ajaxReturn(array('status' => 403, 'info' => '学号/教师一卡通号错误'));
     }
     $email = M('user_member')->where(array('stu_num' => $data['stunum']))->getField('email');
     if (!$email) {
         $this->ajaxReturn(array('status' => 403, 'info' => '无此学号/教师一卡通号'));
     } else {
         if ($this->mail($email, $data['stunum'])) {
             $this->ajaxReturn(array('status' => 200, 'info' => '成功', 'data' => $email));
             //                $this->success('邮件发送成功, 请12小时内前往邮箱('.$email.')收取检查', '', 10);
         } else {
             $this->ajaxReturn(array('status' => 500, 'info' => '邮件发送发生错误, 请联系红岩网校工作站或稍后再试!'));
         }
     }
 }
 public function savemsg()
 {
     if (IS_POST) {
         $code = $_POST["code"];
         $v = new Verify();
         if (!$v->check($code, "")) {
             $this->error("验证码有误!");
         }
         $m = M("Message");
         $data["title"] = $_POST["title"];
         $data["content"] = $_POST["content"];
         $data["contact_name"] = $_POST["contact_name"];
         $data["contact_phone"] = $_POST["contact_phone"];
         $data["email"] = trim($_POST["email"]);
         $data["submit_time"] = date("Y-m-d H:i:s", time());
         $m->add($data);
         loadFixedItem();
         $this->display();
     } else {
         $this->error("非法访问!");
     }
 }
 public function genverify()
 {
     /*
      * expire 验证码的有效期(秒)
      * useImgBg 是否使用背景图片 默认为false
      * fontSize 验证码字体大小(像素) 默认为25
      * useCurve 是否使用混淆曲线 默认为true
      * useNoise 是否添加杂点 默认为true
      * imageW 验证码宽度 设置为0为自动计算
      * imageH 验证码高度 设置为0为自动计算
      * length 验证码位数
      * fontttf 指定验证码字体 默认为随机获取
      * useZh 是否使用中文验证码
      * bg 验证码背景颜色 rgb数组设置,例如 array(243, 251, 254)
      * seKey 验证码的加密密钥
      * codeSet 验证码字符集合 3.2.1 新增
      * zhSet 验证码字符集合(中文) 3.2.1 新增
      */
     $config = array("fontSize" => 18, "length" => 4, "imageH" => 34, "codeSet" => "1234567890", "useNoise" => false);
     $v = new Verify($config);
     $v->entry();
 }
 /**
  *
  */
 public function getbackPasswd()
 {
     if (IS_POST) {
         $data['captcha'] = I('post.captcha', '');
         $data['email'] = I('post.email', '');
         $verify = new Verify();
         $checkRs = $verify->check($data['captcha']);
         if (!$checkRs) {
             $this->ajaxReturn(array('status' => false, 'message' => '提示:验证码不正确'));
         }
         if (!Validation::IsEmailAdress($data['email'])) {
             $this->ajaxReturn(array('status' => false, 'message' => '提示:邮箱地址不合法'));
         }
         $rs = M('Users')->where("email = '" . $data['email'] . "'")->find();
         if (!$rs) {
             $this->ajaxReturn(array('status' => false, 'message' => '提示:该账号不存在'));
         }
         $token = authcode($rs['userid'] . ',' . time() . ',' . $data['email'], "ENCODE", SESSION_AUTH);
         $this->assign('url', SITE_URL . '/Web/Login/modifyPasswd?token=' . base64_encode($token));
         $this->assign('username', $rs['nickname']);
         $res = ACPopedom::sendEmail($data['email'], $rs['nickname'], '旅之沙修改密码邮件', $this->fetch('modifyPasswdEmailContent'));
         if ($res) {
             cookie('__getback__', authcode($rs['userid'] . ',' . time() . ',' . $data['email'], "ENCODE", SESSION_AUTH), C('ACTIVATION_TIME'));
             $this->ajaxReturn(array('status' => true, 'message' => '提示:邮件发送成功', 'url' => SITE_URL . U('Web/Login/gbStep2')));
         } else {
             $this->ajaxReturn(array('status' => false, 'message' => '提示:发送邮件失败'));
         }
     }
     $this->display('getbackPasswdStep1');
 }
Example #16
0
 public function verify()
 {
     $Img = new Verify();
     $Img->useImgBg = true;
     $Img->entry();
 }
 public function checkVer()
 {
     $code = trim($_GET['code']);
     if ($code != "") {
         $path = __ROOT__ . "/Public/Image";
         // 文件路径
         $verify = new Verify();
         $verify->reset = false;
         // 禁用重置,方便多次验证
         $r = $verify->check($code);
         if ($r) {
             echo "<img src='" . $path . "/gou.png' style='width: 50px;height: 32px;'>";
         } else {
             echo "<img src='" . $path . "/cha.png' style='width: 50px;height: 32px;'>";
         }
     }
 }
Example #18
0
 public function verify()
 {
     $config = array('codeSet' => '0123456789', 'fontsize' => 20, 'length' => 3);
     $verify = new Verify($config);
     $verify->entry();
 }
Example #19
0
 /**
  * 验证验证码
  * @param string $checkCode 用户输入的验证码
  * @return bool
  */
 public static function checkCaptcha($checkCode)
 {
     $captcha = new Verify();
     return $captcha->check($checkCode);
 }
 /**
  * 验证码检测
  * @param $code 用户输入的验证码
  * @param string $id
  * @return bool
  */
 function check_verify($code, $id = '')
 {
     $verify = new \Think\Verify();
     return $verify->check($code, $id);
 }
 public function verifyAction()
 {
     $Verify = new Think\Verify(C('verifyconfig'));
     $Verify->entry();
 }
 /**
  * 获取验证码
  */
 public function getVerifyCode()
 {
     ob_clean();
     $Verify = new Verify();
     $Verify->entry();
 }
Example #23
0
 /**
  * 忘记密码发送重置邮件(支持 ajax).
  * status: 0 用户名, 1 邮箱, 2 验证码, 8 发送失败, 9 发送成功
  *
  * @access public
  * @return void
  * @author Liuping <*****@*****.**>
  */
 public function forgotPasswdSendEmail()
 {
     $verifyCode = I('post.code', '');
     $username = I('post.username', '');
     $email = I('post.email', '');
     $result = [];
     $vcode = new Verify();
     if (empty($username)) {
         $result['status'] = 0;
         $result['msg'] = L('CONTROLLER_MSG25');
     } elseif (empty($email)) {
         $result['status'] = 1;
         $result['msg'] = L('CONTROLLER_MSG1');
     } elseif (empty($verifyCode)) {
         $result['status'] = 2;
         $result['msg'] = L('CONTROLLER_MSG1');
     } elseif (IS_AJAX && !$vcode->check($verifyCode)) {
         $result['status'] = 2;
         $result['msg'] = L('CONTROLLER_MSG27');
     } else {
         // 验证用户与邮箱是否匹配
         $model = new UserModel();
         if (!$model->checkUserAndEmail($username, $email)) {
             $result['status'] = 1;
             $result['msg'] = L('CONTROLLER_MSG36');
         } else {
             // 用户名和邮箱匹配发送邮件
             if (!IS_AJAX && IS_POST) {
                 // 如果能 post 提交代表已经 ajax 请求该方法已验证验证码了
                 if ($this->sendResetPwdEmail($username, $email)) {
                     $result['status'] = 9;
                     $result['msg'] = L('CONTROLLER_MSG23');
                     $result['url'] = U('Home/Index/index');
                 } else {
                     $result['status'] = 8;
                     $result['msg'] = L('CONTROLLER_MSG24');
                 }
             } else {
                 $result['status'] = 9;
                 $result['msg'] = L('CONTROLLER_MSG48');
             }
         }
     }
     if (IS_AJAX) {
         $this->ajaxReturn($result, 'json');
     } elseif ($result['status'] == 9) {
         //$this->success($result['msg'], $result['url']);
         // 发送成功, 显示邮箱验证提示页面
         $this->assign('jumpUrl', $result['url']);
         $this->display('successSendEmail');
     } else {
         $this->error($result['msg']);
     }
 }
Example #24
0
 public function yzm()
 {
     //实例化验证码类
     $verify = new Verify();
     //生成一个验证码图形
     $verify->entry();
     print_r($_SESSION);
 }
 public function check_code($code)
 {
     $Verify = new Verify();
     $Verify->check($code);
 }
Example #26
0
 /**
  * 验证码
  */
 public function captcha()
 {
     $config = array('imageW' => '100', 'imageH' => '32', 'fontSize' => 14, 'useNoise' => false, 'useCurve' => false, 'length' => 4, 'useImgBg' => false, 'bg' => array(255, 255, 255));
     $verify = new Verify($config);
     $verify->entry();
 }
Example #27
0
 function verifyImg()
 {
     //给验证码做配置
     $config = array('useNoise' => true, 'fontSize' => 15, 'imageH' => 30, 'imageW' => 100, 'length' => 4, 'fontttf' => '4.ttf');
     //实例化Verify类
     $verify = new Verify($config);
     $verify->entry();
     //输出验证码
 }
 function verify()
 {
     $verify = new Verify();
     $verify->entry();
 }
 /**
  * 验证码
  */
 public function vertify()
 {
     $config = array('fontSize' => 20, 'length' => 4, 'useCurve' => true, 'useNoise' => true);
     $Verify = new Verify($config);
     $Verify->entry("AdminLogin");
 }
 /**
  * 登录页面验证码接口
  */
 public function verify()
 {
     $verify = new Verify();
     $verify->entry(1);
     //验证码编号为1
 }