Ejemplo n.º 1
0
 /**
  * 验证码
  *
  * @param int $num          验证码个数
  * @param int $width        验证码宽度
  * @param int $height       验证码高度
  * 
  * @return string
  *
  */
 public function verifyCode($num = 4, $width = 130, $height = 50)
 {
     require $this->app->frameworkPath . 'Library/Captcha/VerifyCode.class.php';
     $VerifyCode = new VerifyCode();
     $VerifyCode->codelen = $num;
     $VerifyCode->width = $width;
     $VerifyCode->height = $height;
     $VerifyCode->doimg();
     $this->app->session->setState('verifycode', $VerifyCode->getCode(), 600);
 }
Ejemplo n.º 2
0
 public function dealWithGet()
 {
     /*
      * 	1.verify code service
      * 	2.logout
      * 	3.modify geren dang
      * 	4.modify user image
      */
     if ($_GET['way'] === '1') {
         $v = new VerifyCode($this->arr);
         $code = $v->getCode();
         $_SESSION['verify_code'] = isset($_SESSION['verify_code']) ? $_SESSION['verify_code'] : array();
         switch ($_GET['kind']) {
             case 'signup':
                 $_SESSION['verify_code']['up'] = $code;
                 break;
             case 'signin':
                 $_SESSION['verify_code']['in'] = $code;
                 break;
             case 'admin':
                 $_SESSION['verify_code']['admin'] = $code;
                 break;
         }
     }
     if ($_GET['way'] === '2') {
         $user = new User($this->arr);
         $bool = $user->logout();
         $arr = array('isok' => '1', 'info' => '0');
         echo json_encode($arr);
     }
     if ($_GET['way'] === '3') {
         $id = (int) $_GET['user_id'];
         $user = new User($this->arr);
         $bool = false;
         if ($user->isThisUser($id)) {
             $bool = true;
         }
         if ($bool) {
             $arr = $user->modifyGerendang($id . '');
         } else {
             $arr = array('isok' => '0', 'info' => 'user verify error');
         }
         echo json_encode($arr);
     }
     if ($_GET['way'] === '4') {
         $src = C::safe($_GET['src'], $this->dbc);
         $id = (int) $_GET['id'];
         $arr = array('isok' => '1', 'src' => $src, 'id' => $id);
         $user = new User($this->arr);
         $arr = $user->modifySelfImg($arr);
         echo json_encode($arr);
         exit;
     }
 }
Ejemplo n.º 3
0
<?php

session_start();
include 'verify_code.php';
$code = new VerifyCode();
$_SESSION['code'] = $code->getCode();
$code->output();
Ejemplo n.º 4
0
<?php

/*
 * Created on 2012-6-30
 *
 * To change the template for this generated file go to
 * Window - Preferences - PHPeclipse - PHP - Code Templates
 */
require 'include/common.inc.php';
require ROOT . '/classes/mgr/verifycode.cls.php';
$_vc = new VerifyCode();
//实例化一个对象
$_vc->doimg();
$_SESSION[SESSIONNAME]['verifycode'] = $_vc->getCode();
//验证码保存到SESSION中
 static function imgCheckcode()
 {
     Sys::S('core.VerifyCode.VerifyCode');
     VerifyCode::getCode(6);
 }