Guest User

Untitled

a guest
Sep 13th, 2019
121
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.    
  3.     // -------------------------------------------------------------------------------------
  4.     // Captcha Creator PHP Image Displaying Script.
  5.     // Copyright (c) 2007 Alexandru Marias. All rights reserved
  6.     // Web: http://www.captchacreator.com
  7.     // Phone: +40722486348
  8.     // ----------------------------------------------------------------
  9.    
  10.     function RandomCode($min,$max) // Chose the turing code
  11.     {
  12.     // Choosing a random Security Code
  13.     Global $CSrc;  // CSrc contains the characters from which the Captcha Code will be generated
  14.    
  15.     $srclen = strlen($CSrc)-1;
  16.    
  17.     // Chose the length of the turing code
  18.     $length = mt_rand($min,$max); // Between 4 and 8 chars
  19.    
  20.     $Code = '';
  21.    
  22.     // Fill the turing string with characters and numbers from $src
  23.     for($i=0; $i<$length; $i++)
  24.         $Code .= substr($CSrc, mt_rand(0, $srclen), 1);
  25.    
  26.     return $Code;
  27.    
  28.     }
  29.    
  30.     // -------------------------------------------------------------------------------------
  31.     function CheckCaptcha($Turing)
  32.     {
  33.    
  34.     global $ImageCode;
  35.     if ( !isset( $_SESSION['turing_string'] ) ) { $ImageCode = ''; return 1; }
  36.         else if ( strtoupper($_SESSION['turing_string']) == strtoupper($Turing) ) { $ImageCode = 'ok'; return 1; }
  37.             else { $ImageCode = 'wrong'; return 0; }
  38.     }
  39.      
  40.    
  41.     ?>
RAW Paste Data