/**
*
* @file imgvcode.php
* @create date 2007-09-25
* @copyright (c) 2005 - 2007 eifr.com
* @license http://www.hzhuti.com/nokia/n97/
* eifr is free software
*/
session_start();
// main
$vcodes = '';
//generate Number 4
srand((double)microtime()*1000000);
for($i=0;$i
$vcodes.=rand(1,9);
}
$_SESSION['eifr_checkvcode'] = $vcodes;
if(function_exists('imagecreate')){
//generate picture validation code
Header("Content-type: image/PNG");
$img = imagecreate(44,18);
$bg = ImageColorAllocate($img, 245,245,245);
imagefill($img,0,0,$bg); //background
//generate Number 4
for($i=0;$i
$font = ImageColorAllocate($img, rand(100,255),rand(0,100),rand(100,255));
$vnum = substr($vcodes, $i, 1);
imagestring($img, 5, 2+$i*10, 1, $vnum, $font);
}
//add interference
for($i=0;$i
{
$randcolor = ImageColorallocate($img,rand(0,255),rand(0,255),rand(0,255));
imagesetpixel($img, rand()%70 , rand()%30 , $randcolor);
}
ImagePNG($img);
ImageDestroy($img);
}
?>
|