PHP write generate cool verification code, PHP cool Verification Code
1
Php2 $im=imagecreate (200,100);//Generate Canvas3Imagecolorallocate ($im, 0,0,0);//Background color4 $white=imagecolorallocate ($im,Rand(0,255),Rand(0,255),Rand(0,255) );//Generate random colors5 for($i= 0;$i<9;$i++)6 {7Imageline ($im,Rand(0,200),Rand(0,100),Rand(0,200),Rand(0,100),$white);//Generate Disturbing line elements8 }9 for($i= 0;$i<150;$i++)Ten { OneImagesetpixel ($im,Rand(0,200),Rand(0,100),$white);//Generate Interference point elements A } - for($i=0,$str='';$i<4;$i++)//get four characters by Loop - { the Switch(Rand(1,3)) - { - Case' 1 ': - $ch=Rand(0,9); + Break; - Case' 2 ': + $ch=sprintf('%c ',Rand(97,122)); A Break; at Case' 3 ': - $ch=sprintf('%c ',Rand(65,90)); - Break; - } - $str.=$ch; - in } -Imagettftext ($im, 32,Rand(0,15), 55, 70,$white, ' C.TTC ',$str);//Output a string on the canvas to Header("Content-type:image/jpeg"); +Imagejpeg ($im); -Imagedestroy ($im); the?>
http://www.bkjia.com/PHPjc/1122767.html www.bkjia.com true http://www.bkjia.com/PHPjc/1122767.html techarticle PHP write generate cool verification code, PHP cool verification code 1? PHP 2 $im =imagecreate (200,100);//Generate Canvas 3 imagecolorallocate ($im, 0,0,0);//Background color 4 $white =i Magecolorallocate ( ...