php图形验证码
2006-06-05 13:24
260 查看
<?php
/*
* Filename: authimg.php
* Author: hutuworm
* Date: 2003-04-28
* @Copyleft hutuworm.org
*/
//生成验证码图片
Header("Content-type: image/PNG");
srand((double)microtime()*1000000);
$im = imagecreate(62,20);
$black = ImageColorAllocate($im, 0,0,0);
$white = ImageColorAllocate($im, 255,255,255);
$gray = ImageColorAllocate($im, 200,200,200);
imagefill($im,68,30,$gray);
while(($authnum=rand()%100000)<10000);
//将四位整数验证码绘入图片
imagestring($im, 5, 10, 3, $authnum, $black);
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);
?>
/*
* Filename: authimg.php
* Author: hutuworm
* Date: 2003-04-28
* @Copyleft hutuworm.org
*/
//生成验证码图片
Header("Content-type: image/PNG");
srand((double)microtime()*1000000);
$im = imagecreate(62,20);
$black = ImageColorAllocate($im, 0,0,0);
$white = ImageColorAllocate($im, 255,255,255);
$gray = ImageColorAllocate($im, 200,200,200);
imagefill($im,68,30,$gray);
while(($authnum=rand()%100000)<10000);
//将四位整数验证码绘入图片
imagestring($im, 5, 10, 3, $authnum, $black);
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);
?>
相关文章推荐
- 完整的PHP图形验证码程序源码!
- PHP 中文图形验证码
- php图形图像函数的运用-验证码
- PHP制作图形验证码代码分享
- php + redis 完成api接口的图形验证码
- PHP 图形图像操作(生成图像验证码、添加水印等)
- 完整的PHP图形验证码程序源码!
- PHP实现生成带背景的图形验证码功能
- 完整的PHP图形验证码程序源码!
- php复习 第九天 绘制图形验证码
- php图形图像处理之生成验证码
- PHP生成图形验证码
- PHP imagechar() 图形验证码 字体太小问题
- 完整的PHP图形验证码程序源码!
- 一个简单的php图形验证码生成程序
- 完整的PHP图形验证码程序源码
- php 图形验证码的3种方法
- php生成图形验证码几种方法小结
- php生成图形验证码几种方法小结
- PHP图形操作之生成图像验证码