PHP verification code class

From , 5 Years ago, written in PHP, viewed 164 times.
URL https://pastebin.vip/view/3e60e09c
  1. <?php
  2.     session_start();
  3.     Header("Content-type: image/gif");
  4.        
  5.     class SecurityCode
  6.     {
  7.         private $codes = '';
  8.                
  9.         function __construct()
  10.         {
  11.             $code = '0-1-2-3-4-5-6-7-8-9-A-B-C-D-E-F-G-H-I-J-K-L-M-N-O-P-Q-R-S-T-U-V-W-X-Y-Z';
  12.             $codeArray = explode('-',$code);
  13.             shuffle($codeArray);
  14.             $this->codes = implode('',array_slice($codeArray,0,4));
  15.         }
  16.                
  17.         public function CreateImg()
  18.         {
  19.             $_SESSION['check_pic'] = $this->codes;
  20.             $img = imagecreate(70,25);
  21.             imagecolorallocate($img,222,222,222);
  22.             $testcolor1 = imagecolorallocate($img,255,0,0);
  23.             $testcolor2 = imagecolorallocate($img,51,51,51);
  24.             $testcolor3 = imagecolorallocate($img,0,0,255);
  25.             $testcolor4 = imagecolorallocate($img,255,0,255);
  26.                        
  27.             for ($i = 0; $i < 4; $i++)
  28.             {
  29.                 imagestring($img,rand(5,6),8 + $i * 15,rand(2,8),$this->codes[$i],rand(1,4));
  30.             }
  31.             imagegif($img);
  32.         }
  33.     }
  34.        
  35.     $code = new SecurityCode();
  36.     $code->CreateImg();
  37.        
  38.         $code = NULL;
  39. ?>
  40.  

Reply to "PHP verification code class"

Here you can reply to the paste above

captcha

https://burned.cc - Burn After Reading Website