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
 /**
  * 验证码
  *
  * @param string $key       验证码key
  * @param int $num          验证码个数
  * @param int $width        验证码宽度
  * @param int $height       验证码高度
  * @param int $expire       过期时间
  * 
  * @return string
  *
  */
 public function verifyCode($key = 'verifycode', $num = 4, $width = 130, $height = 40, $expire = 600)
 {
     $VerifyCode = new VerifyCode();
     $VerifyCode->codelen = $num;
     $VerifyCode->width = $width;
     $VerifyCode->height = $height;
     $VerifyCode->doimg($key, $expire);
     //Wave::app()->session->setState($key, $VerifyCode->getCode(), $expire);
 }
Ejemplo n.º 3
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中
Ejemplo n.º 4
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.º 5
0
<?php

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

header("Content-Type: text/html; charset=utf-8");
header('Access-Control-Allow-Origin: *');
ini_set("display_errors", "On");
include "VC/VC.php";
$object = new VerifyCode();
$object->Init_Image("VC/1.jpg", array('g', '4', 'J', 'p'));
$object->Init_Image("VC/2.jpg", array('B', 'H', 'd', '7'));
$object->Init_Image("VC/3.jpg", array('T', 'F', '5', 'H'));
$object->Init_Image("VC/4.jpg", array('F', 'u', 'X', 'x'));
$object->Init_Image("VC/5.jpg", array('Y', 't', 'h', 'u'));
$object->Init_Image("VC/6.jpg", array('e', 'E', 'F', 'E'));
$object->Init_Image("VC/7.jpg", array('9', 'W', 'Q', 'n'));
$object->Init_Image("VC/8.jpg", array('7', 'g', 'M', 'C'));
$object->Init_Image("VC/9.jpg", array('d', 's', 'w', 'p'));
$object->Init_Image("VC/10.jpg", array('x', 'p', 'K', '2'));
$object->Init_Image("VC/11.jpg", array('8', '7', 'f', 'U'));
$object->Init_Image("VC/12.jpg", array('3', '8', 'U', 'Y'));
$object->Init_Image("VC/13.jpg", array('R', 'T', 'P', 'D'));
$object->Init_Image("VC/14.jpg", array('Z', 'F', '5', 'H'));
$object->Init_Image("VC/15.jpg", array('4', 'W', 'Q', 'n'));
$object->Init_Image("VC/16.jpg", array('E', 'U', 'b', 'g'));
$object->Init_Image("VC/17.jpg", array('J', '6', 'v', 'b'));
$object->Init_Image("VC/18.jpg", array('G', 'H', 'd', '7'));
$object->Init_Image("VC/19.jpg", array('m', 'E', 'F', 'E'));
$object->Init_Image("VC/20.jpg", array('z', 'b', 'N', 'P'));
$object->Init_Image("VC/21.jpg", array('D', '7', 'f', 'U'));
$object->Init_Image("VC/22.jpg", array('K', 's', 'w', 'p'));
$object->Init_Image("VC/23.jpg", array('w', 'Q', 'R', 'z'));
$object->Init_Image("VC/24.jpg", array('n', 'c', 'B', 'S'));
        }
        $this->view($result);
    }
    public function view($image)
    {
        header('Content-Type: image/jpeg');
        imagejpeg($image, NULL, 100);
    }
}
if (true) {
    echo "importing...<br/>";
    ob_flush();
    flush();
}
/* Initialize object */
$object = new VerifyCode();
/* import data */
$dir = "./data/";
$fileArray[] = NULL;
if (false != ($handle = opendir($dir))) {
    $i = 0;
    while (false !== ($file = readdir($handle))) {
        if ("." != $file && ".." != $file && strpos($file, ".")) {
            $fileArray[$i] = basename($data . $file, ".gif");
            if (100 == $i) {
                break;
            }
            if (true) {
                echo "importing {$i} => " . $fileArray[$i] . "...<br/>";
                ob_flush();
                flush();
Ejemplo n.º 8
0
<?php

// 包含生成验证码的类
require_once 'class.php';
$code = '';
// 保存生成的验证码字符串
// 好吧,给我来十个字符的验证码
$verify = new VerifyCode();
$code = $verify->mkCode(4);
?>

 static function imgCheckcode()
 {
     Sys::S('core.VerifyCode.VerifyCode');
     VerifyCode::getCode(6);
 }