php数字验证码
<无详细内容>
<?php
session_start();
//生成验证码图片
Header("Content-type: image/PNG");
srand((double)microtime()*1000000);
$im = imagecreate(62,20);
$black = ImageColorAllocate($im, 69,120,239);
$white = ImageColorAllocate($im, 0,0,0);
$gray = ImageColorAllocate($im, 200,200,200);
imagefill($im,68,30,$gray);
while(($authnum=rand()%100000)<10000);
//将五位整数验证码绘入图片
imagestring($im, 5, 10, 3, $authnum, $white);
for($i=0;$i<200;$i++) //加入干扰象素
{
$randcolor = ImageColorallocate($im,rand(0,255),rand(0,255),rand(0,255));
imagesetpixel($im, rand()%70 , rand()%30 , $randcolor);
}
ImagePNG($im);
ImageDestroy($im);
$_SESSION['SESSION_VALIDATE_CODE'] = $authnum.'';
?>
$txt="memory";
$im = imagecreatetruecolor(400,30);
$white = ImageColorAllocate($im, 255,255,255);
$black = ImageColorAllocate($im, 0,0,0);
// Replace path by your own font path
imagestring($im,1,10,10,$txt,$black);
//imagettftext($im, 20, 0, 10, 20, $black, "font.ttf","Testing...");
header("Content-type:image/jpeg");
imagejpeg($im);
// imagedestroy($im);
- 上一篇:php自定义符号 求运算 求唾骂
- 下一篇:PHP CURL 模拟提交(支持代理)
精彩图集
精彩文章






