Beispiel #1
0
<?php

/**
* TestGuest Version1.0
* ================================================
* Copy 2014
* Web: http://www.yc60.com
* ================================================
* Author:zhangshuhui
* Date: 2014-5-20
*/
session_start();
include '../../includes/global.func.php';
_code();
Beispiel #2
0
<?php

/**
*2012-7-28   By:NaV!
*/
session_start();
//定义个常量,用来授权调用includes里面的文件
define('IN_GM', true);
//引入公共文件
require dirname(__FILE__) . '/includes/common.inc.php';
//运行验证码函数,默认:_code($_width = 75,$_height = 25,$_rnd_code = 4,$_flag = false)
//默认验证码大小为:75 * 25,默认位数是4位 如果要6位,长度推荐125,如果要8为,推荐175
//第四个参数是,是否要边框,要的话true,不要的话false,默认是false;
//可以通过数据库的方法,来设置验证码的各种属性
_code(75, 25, 4, false);
Beispiel #3
0
<?php

/**
 * Version1.0
 * Author: Herman
 * ----------------------------------------------------------------
 * Copy 2015
 * ----------------------------------------------------------------
 * Date: 2015-7-3
 */
session_start();
//定义个常量,用来授权调用includes里面的文件
define('IN_TG', true);
//引入公共文件
require dirname(__FILE__) . '/includes/common.inc.php';
//默认验证码大小为:75 * 25,默认位数是4位 如果要6位,长度推荐125,如果要8为,推荐175
_code(75, 25);
Beispiel #4
0
<?php

/*
 * 
 * 
 * 
 */
//创建随机码
session_start();
$_width = 75;
$_height = 25;
$num = 4;
_code($_width, $_height, $num);
//验证码
function _code($_width = 75, $_height = 25, $num = 4)
{
    for ($i = 0; $i < $num; $i++) {
        $_nmsg .= dechex(mt_rand(0, 15));
    }
    //保存到session
    $_SESSION['code'] = $_nmsg;
    //
    //创建图像
    $_img = imagecreatetruecolor($_width, $_height);
    //白
    $_white = imagecolorallocate($_img, 255, 255, 255);
    imagefill($_img, 0, 0, $_white);
    $_black = imagecolorallocate($_img, mt_rand(0, 255), mt_rand(0, 255), mt_rand(0, 255));
    //	花边狂
    imagerectangle($_img, 0, 0, $_width - 1, $_height - 1, $_black);
    for ($i = 0; $i < 3; $i++) {