100分请高手做个带验证码的PHP表单系统(生成图片程序已有)

来源:百度知道 编辑:UC知道 时间:2024/06/18 09:10:44
下面是我找来的PHP生成验证码图片的程序:
但我不知道如何做一个能使用它验证的表单,请帮忙做一个(请带注释)

<?php
Header("Content-type:image/PNG");
srand((double)microtime()*1000000);
$im =imagecreate(72,15);
$black = ImageColorAllocate($im, 0,0,0);
$white= ImageColorAllocate($im,255,204,0);
$gray = ImageColorAllocate($im,102,102,0);
imagefill($im,1,1,$gray); //imagefill($im,0,0,$gray);

for($i=0;$i<600;$i++)
{
$randcolor =ImageColorallocate($im,rand(10,255),rand(10,255),rand(10,255));
imagesetpixel($im, rand()%90 , rand()%30 ,$randcolor);
}

#---------------------------
# WRITE 10 BLACKLINE
#---------------------------
for($i=0;$i<6;$i++)
{
imageline($im,rand(0,75),rand(0,75),rand(0,75),rand(0,75),$black);
}

#---------------------------
# WRITE 7 mumber
#---------------------------
//while(($authnum=rand()%100000)<10000);
$array="0123456789ABCDEFGHIJKL

<?php

$glbVerifySeed = "123456789abcdefghkmnpqrstxyz";
main();

function main() {
session_start();

$verifyCode = getRandomCode();
$_SESSION["img_code"] = $verifyCode;
$imgWidth = $_REQUEST["width"];
$imgHeight = $_REQUEST["height"];
$imgFont = $_REQUEST["font"];

if($imgWidth == "") $imgWidth = 100;
if($imgHeight == "") $imgHeight = 30;
if($imgFont == "") $imgFont = 4;
doOutputImg($verifyCode, $imgWidth, $imgHeight, $imgFont);
}

//获取随机数字字符串
function getRandomCode($length=6) {
global $glbVerifySeed;

$bgnIdx = 0;
$endIdx = strlen($glbVerifySeed)-1;

$code = "";
for($i=0;