php 验证码
来源:互联网 发布:silhouette软件 编辑:程序博客网 时间:2024/05/16 05:25
<?phpsession_start();@header("Content-Type:image/png"); //设置header格式为png格式
$str = "1,2,3,4,5,6,7,8,9,a,b,c,d,f,g"; $list = explode(",", $str);$cmax = count($list) - 1;$verifyCode = '';for ( $i=0; $i < 5; $i++ ){ $randnum = mt_rand(0, $cmax); $verifyCode .= $list[$randnum]; }$_SESSION['code'] = $verifyCode;
$Code = $_SESSION['code']; //页面传递过来的随机验证码$width = 191; //验证码图片的宽度$height = 68; //验证码图片的高度
$img=imagecreate($width,$height);$back=imagecolorallocate($img,0xFF,0xFF,0xFF); //背景色$pix=imagecolorallocate($img,187,230,247); //模糊点颜色$fontColor=imagecolorallocate($img,41,163,238); //字体色$fontType='C:\Windows\Fonts\simhei.ttf'; //设置字体样式,这里是黑体mt_srand(); //绘模糊作用的点for($i=0;$i<1000;$i++){ imagesetpixel($img,mt_rand(0,$width),mt_rand(0,$height),$pix);}
imagettftext($img, 35, 0, 25, 52, $fontColor, $fontType, $Code);imagerectangle($img,0,0,$width-1,$height-1,$fontColor);imagepng($img);imagedestroy($img);?>
<img id="code" src="master/inc/create_code.php" width="80" height="22" onClick="this.src=this.src + '?Math.random()*10000';" />
- php图形验证码
- php 验证码
- PHP 验证码
- PHP图片验证码
- php验证码类
- php实现验证码
- PHP实现验证码
- PHP实现验证码
- PHP生成验证码
- PHP验证码
- php验证码类
- PHP 生成验证码
- php 验证码
- php 图片验证码
- php 验证码控件
- php 验证码总结
- PHP验证码生成
- PHP生成验证码
- VB write#语句和print#语句
- Unity3D公告板
- 表扬一下csdn
- 感染系统文件实现自启动
- dd命令的高级应用
- php 验证码
- 利用linux中的gtk程序开发包写的计算器程序
- jquery中的循环技巧
- jsp中<html:select>标签的用法
- C# 经纬度转换 和 时间转换
- 使用cookie
- [linux][sendmail][error]DSN: Data format error
- ESRI.ArcGIS.AnalysisTools的使用
- java JNI入门一