Home > Backend Development > PHP Tutorial > PHP认证码解决方案

PHP认证码解决方案

WBOY
Release: 2016-06-13 10:03:36
Original
827 people have browsed it

PHP认证码
谁给我写个认证码,如果实现通过现金谢~~~现金200元人民币~~~QQ:357816807

------解决方案--------------------
写的太早了,你自己调试下。

PHP code
<?php /**       Filename:   authimg.php*       Author:       唯她*       Date:           2003年6月3日*       @Copyleft   www.vitalstudio.cn*/session_start();srand((double)microtime()*1000000);while(($authnum=rand()%10000) < 1000);//生成四位随机整数验证码$_SESSION['auth']=$authnum;//生成验证码图片Header("Content-type:   image/png");$im   =   imagecreate(45,16);$black   =   ImageColorAllocate($im,   200,10,0);$white   =   ImageColorAllocate($im,   255,255,255);$gray   =   ImageColorAllocate($im,   230,230,230);   //将这两行提前至   $im   ..下面imagefill($im,68,30,$gray);//将四位整数验证码绘入图片//位置交错for   ($i   =   0;   $i   <   strlen($authnum);   $i++)   {if   ($i%2   ==   0)   $top   =   0;else   $top   =   2;imagestring($im,   5,   10*$i+3,   $top,   substr($authnum,$i,1),   $black);}for($i=0;$i<250;$i++)       //加入干扰象素{imagesetpixel($im,   rand()%70   ,   rand()%30   ,   $black);}ImagePNG($im);ImageDestroy($im);?><div class="clear">
                 
              
              
        
            </div>
Copy after login
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template