⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 passcode.php

📁 Download you own three BR
💻 PHP
字号:
<?php
/*
Header("Content-type: image/PNG");
//生成新的四位整数验证码
$authnum = ''; 
$str = 'ABCDEFGHMNPQRSTWXYZ123456789'; 
$l = strlen($str); 
for($i=1;$i<=4;$i++)
{ 
$num=rand(0,$l); 
$authnum.= $str[$num]; 
}
setcookie('authnum',$authnum);
//生成验证码图片
srand((double)microtime()*1000000);
$im = imagecreate(45,22);
$black = ImageColorAllocate($im, 0,0,0);
$white = ImageColorAllocate($im, 255,255,255);
$gray = ImageColorAllocate($im, 200,200,200);
imagefill($im,68,30,$gray);
//将四位整数验证码绘入图片
imagestring($im, 5, 6, 3, $authnum, $white);
for($i=0;$i<90;$i++) //加入干扰象素
{
imagesetpixel($im, rand()%70 , rand()%30 , $gray);
}
ImagePNG($im);
ImageDestroy($im);
session_unregister('authnum');
session_register('authnum');
$_SESSION['authnum']=$authnum;
*/
  session_start();
  $img_width=50;
  $img_height=16;
  srand(microtime() * 100000);
  for($ti=0;$ti<4;$ti++){
    $new_number.=dechex(rand(0,15));
  }
  $new_number=strtolower($new_number);
  $_SESSION["verifycode"]=$new_number;
  $number_img=imageCreate($img_width,$img_height);
  ImageColorAllocate($number_img,255,255,255);
  for($i=1;$i<=128;$i++){
    imageString($number_img,1,mt_rand(1,$img_width),mt_rand(1,$img_height),"*",imageColorAllocate($number_img,mt_rand(200,255),mt_rand(200,255),mt_rand(200,255)));
  }
  for($i=0;$i<strlen($new_number);$i++){
    imageString($number_img,mt_rand(3,5),$i*$img_width/4+mt_rand(1,4),mt_rand(1,$img_height/5), $new_number[$i],imageColorAllocate($number_img,mt_rand(0,100),mt_rand(0,150),mt_rand(0,200)));
  }
  //header("Content-type: image/png");
  ImagePng($number_img);
  ImageDestroy($number_img);
?>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -