【php 验证码(倾斜,正弦干扰线,黏贴,旋转)】教程文章相关的互联网学习教程文章

php实现简单的图片验证码

这是最简单的图片验证码: image.php header("Content-type: image/png");$string = "abcdefghijklmnopqrstuvwxyz0123456789";for($i=0;$i $pos = rand(0,36); $str .= $string{$pos};}$img_handle = ImageCreate (60, 20) or die ("Cannot Create image");//Image size (x,y)$back_color = ImageColorAllocate($img_handle, 255, 255, 255);//Background color RBG$txt_color = ImageColorAllocate($img_handle, 0, 0, 0...

php验证码实现代码

PHP验证码实现原理 生成随机数或者字母保存到session中(验证验证码的时候用),然后对生成的数字或者字母进行绘图!然后呈现在我们眼前 刷新验证码:用js改变验证码图片所带的参数,让浏览器不读缓存的图片,从而实现刷新验证码效果! 代码示例$str="QWERTYUIOPASDFGHJKLZXCVBNM1234567890"; $image=imagecreate(50,25);imagecolorallocate($image,mt_rand(0,125),mt_rand(0,125),mt_rand(0,125));$color = imagecolorallocate($image,...

漂亮的PHP验证码类【图】

class Page { private $total; //总记录 private $pagesize; //每页显示多少条 private $limit; //limit private $page; //当前页码 private $pagenum; //总页码 private $url; //地址 private $bothnum; //两边保持数字分页的量 //构造方法初始化...

生成验证码随机干扰php实现

session_start ();header ( 'Content-type: image/png' );//创建图片$im = imagecreate($x=130,$y=45 );$bg = imagecolorallocate($im,rand(50,200),rand(0,155),rand(0,155)); //第一次对 imagecolorallocate() 的调用会给基于调色板的图像填充背景色$fontColor = imageColorAllocate ( $im, 255, 255, 255 ); //字体颜色$fontstyle = 'rock.ttf'; //字体样式,这个可以从c:\windows\Fonts\文件夹下找到,我把它放到和authc...

PHP生成图形验证码(大小写字母与数字混合)【图】

header("content-type:image/png"); $num = $_GET['num']; $imagewidth=60; $imageheight=18; srand(microtime() * 100000); $numimage = imagecreate($imagewidth,$imageheight); imagecolorallocate($numimage,183,180,83); for($i=0;$i $font = mt_rand(3,5); $x = mt_rand(1,8)+$imagewidth*$i/4; $y = mt_rand(1,$imageheight/3); $color=imagecolorallocate($numimage,mt...

php生成数字字母的验证码图片

php生成数字字母的验证码图片 header ('Content-Type: image/png');$image=imagecreatetruecolor(100, 30);$color=imagecolorallocate($image, 255, 255, 255);imagefill($image, 20, 20, $color);//只含有数字// for($i=0;$i // $font=6; // $x=rand(5,10)+$i*100/4; // $y=rand(8, 15); // $string=rand(0, 9); // $color=imagecolorallocate($image, rand(0,120), rand(0,120), rand(0,120)); // imagestring($image, $fo...

PHP实现汉字验证码和算式验证码

大家知道简单数字或者字母验证码很容易被破解,但是算式验证码或者中文汉字验证码不容易被破解, 所以建议大家在使用验证码的时候,尽量用算式验证码或者中文汉字验证码。 下面是我写的两种验证码代码,有用到的朋友可以参考下: 1.算式验证码:session_start();header("Content-type: image/png"); $num1 = mt_rand(0,9);//第一位数$num2 = mt_rand(1,9);//第二位数 $type_str = "+-*";//方法字符串集合$type = subs...

生成验证码

require_once('string.func.php'); function verifyImage( $type=1,$length=4,$pixel=0,$line=0,$sess_name="verify"){ session_start(); /*定义长度和宽度*/$width=80;$height=30;/* 创建画布*/$image=imagecreatetruecolor($width, $height);/*本函数用来匹配图形的颜色,供其它绘图函数使用。参数 image 表示图形的 handle。参数 red、green、blue 是色彩三原色,其值从 0 至 255....我在此定义黑色和白色*/$white=imagecol...

一个好用的验证码PHP工具类

<?php/** * 验证码类 */class Base_Tool_Verify{ /** * 生成验证码方法 */ public static function createCode(){ //生成验证码图片 // 全数字 $str = "D,B,2,3,4,5,6,7,8,9,A,B,C,D,E,F,G,H,W,J,K,M,M,N,K,P,Q,R,S,T,U,V,W,X,Y,Z"; //要显示的字符,可自己进行增删 $list = explode(",", $str); $cmax = count($list) - 1; $verifyCode = ; for ( $i=0; $i...

一个php验证码生成类代码

class ValidationCode { //属性 private $width; private $height; private $codeNum; private $image; private $disturbColorNum; //干扰元素数目 private $checkCode; function __construct($width=80,$height=20,$codeNum=4) { $this->width=$width; $this->height=$height; $this->codeNum=$codeNum; $number=floor(...

PHP简单的图片验证码实现

//第一段代码生成随机图片------code2.php //开启session以用于保存生成的内容session_start();$table=array( "pic0"=>"dog", "pic1"=>"cat", "pic2"=>"fish", "pic3"=>"bird");$index=rand(0,3);$value=$table['pic'.$index]; $_SESSION['authcode']=$value;//得到随机生成的图片名$filename=dirname(__FILE__).'/pic'.$index.'.jpg';$content=file_get_contents($filen...

php简单验证码的制作

$image=imagecreatetruecolor(100, 30);$white=imagecolorallocate($image, 255, 255, 2);$red=imagecolorallocate($image, 255, 0, 0);imagefill($image, 0, 0, $white);//munber create$num="";for($i=0;$i $num.=rand(1,9);}imagestring($image, 6, rand(10,20), rand(00,10), $num,imagecolorallocate($image, rand(0,100), rand(100,125), rand(0,255)) );for($j=0;$j imagesetpixel($image,rand(1,199), ...

PHP数字运算验证码

getValidate(100,30); function getValidate($w,$h){ $img = imagecreate($w,$h); $gray = imagecolorallocate($img,255,255,255); $black = imagecolorallocate($img,rand(0,200),rand(0,200),rand(0,200)); $red = imagecolorallocate($img, 255, 0, 0); $white = imagecolorallocate($img, 255, 255, 255); $green = imagecolorallocate($img, 0, 255,...

PHP利用GD库实现一个简单的验证码【图】

$img=imagecreatetruecolor(100, 40);$red=imagecolorallocate($img, 255, 0, 0);$green=imagecolorallocate($img, 0, 255, 0);$blue=imagecolorallocate($img, 0, 0, 255);$white=imagecolorallocate($img, 255, 255, 255);$black=imagecolorallocate($img, 0, 0, 0);//生成图片imagefill($img, 0, 0, $black);//设置验证码$code="";for($i=0;$i$code.=rand(0,9);}//验证码写到图片中imagestring($img, 5, 20, 15, $code, $white)...

PHP验证码不显示只有一个小红叉的解决方法_PHP教程【图】

最近想自学PHP ,做了个验证码,但不知道怎么搞的,总出现一个如下图的小红叉,但验证码就是显示不出来,原因如下 未修改之前,出现如下错误; (1)修改步骤如下,原因如下,原因是apache权限没开, (2)点击打开php.int., 搜索extension=php_gd2.dll 打开?去掉前面分号重启apache,就OK了 ,万事大吉了。 希望各位朋友遇到这样的问题的时候,能给与帮助http://www.bkjia.com/PHPjc/313514.htmlwww.bkjia.comtruehttp://www...

正弦 - 相关标签