Example #1
0
    $rand1 = mt_rand(1, 25);
    $rand2 = mt_rand(5, 10);
    for ($yy = $rand; $yy <= +$rand + 2; $yy++) {
        for ($px = -80; $px <= 80; $px = $px + 0.1) {
            $x = $px / $rand1;
            if ($x != 0) {
                $y = sin($x);
            }
            $py = $y * $rand2;
            //imagesetpixel($distortion_im, $px+80, $py+$yy, $text_c);
        }
    }
    Header("Content-type: image/JPEG");
    ImagePNG($distortion_im);
    ImageDestroy($distortion_im);
    ImageDestroy($im);
}
function make_rand($length = "36")
{
    $str = "abcdefghijklmnopqrstuvwxyz0123456789";
    $result = "";
    for ($i = 0; $i < $length; $i++) {
        $num[$i] = rand(0, 35);
        $result .= $str[$num[$i]];
    }
    return $result;
}
$checkcode = make_rand($num);
session_start();
$_SESSION['coupon_submit_code'] = strtolower($checkcode);
getAuthImage($checkcode, $width, $height, $move_x, $move_y, $font_size, $count);
Example #2
0
            imagesetpixel($distortion_im, $px + 80, $py + $yy, $text_c);
        }
    }
    //设置文件头;
    //Header("Content-type: image/JPEG");
    //以PNG格式将图像输出到浏览器或文件;
    $fileName = $text . ".png";
    ImagePNG($distortion_im, $fileName);
    //销毁一图像,释放与image关联的内存;
    ImageDestroy($distortion_im);
    ImageDestroy($im);
}
function make_rand($length = "32")
{
    //验证码文字生成函数
    $str = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";
    $result = "";
    for ($i = 0; $i < $length; $i++) {
        $num[$i] = rand(0, 35);
        $result .= $str[$num[$i]];
    }
    return $result;
}
//输出调用
for ($i = 1; $i <= 10200; $i++) {
    $checkcode = make_rand(5);
    getAuthImage($checkcode);
}
?>

Example #3
0
                $y = sin($x);
            }
            $py = $y * $rand2;
            imagesetpixel($distortion_im, $px + 80, $py + $yy, $text_c);
        }
    }
    //设置文件头;
    Header("Content-type: image/JPEG");
    //以PNG格式将图像输出到浏览器或文件;
    ImagePNG($distortion_im);
    //销毁一图像,释放与image关联的内存;
    ImageDestroy($distortion_im);
    ImageDestroy($im);
}
function make_rand($length = "32")
{
    //验证码文字生成函数
    $str = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
    $result = "";
    for ($i = 0; $i < $length; $i++) {
        $num[$i] = rand(0, 25);
        $result .= $str[$num[$i]];
    }
    return $result;
}
//输出调用
$checkcode = make_rand(4);
session_start();
//将随机数存入session中
$_SESSION['helloweba_gg'] = strtolower($checkcode);
getAuthImage($checkcode);
Example #4
0
 /**
  * 验证码生成
  */
 public function getcapcode($type = 'reg')
 {
     $checkcode = make_rand(4);
     $_SESSION['capcode_' . $type] = strtolower($checkcode);
     getAuthImage($checkcode);
 }