[ Index ]

PHP Cross Reference of Nuke-Evolution v2.0.5

title

Body

[close]

/images/ -> captcha.php (source)

   1  <?php
   2  if(defined('NUKE_EVO')) return;
   3  define('NO_DISABLE', true);
   4  
   5  define('ROOT', dirname(dirname(__FILE__)) . '/');
   6  require_once (ROOT.'mainfile.php');
   7  //error_reporting(0);
   8  require_once(NUKE_CLASSES_DIR.'class.php-captcha.php');
   9  define('FONTS', NUKE_INCLUDE_DIR.'fonts/');
  10  
  11  if ($handle = opendir(FONTS)) {
  12      while (FALSE !== ($file = readdir($handle))) {
  13          if ($file !== "." && $file != "..") {
  14              $aFonts[] = FONTS.$file;
  15          }
  16      }
  17  }
  18  
  19  $size = (isset($_GET['size'])) ? $_GET['size'] : 'normal';
  20  
  21  switch ($size) {
  22      case 'normal':
  23          $width = 140;
  24          $height = 60;
  25          $length = 5;
  26      break;
  27      case 'large':
  28          $width = 200;
  29          $height = 60;
  30          $length = 6;
  31      break;
  32      case 'small':
  33          $width = 100;
  34          $height = 30;
  35          $length = 4;
  36      break;
  37  }
  38  
  39  $file = (isset($_GET['file'])) ? $_GET['file'] : '';
  40  //Look for invalid crap
  41  if (preg_match("/[^\w_\-]/i",$file)) {
  42      die();
  43  }
  44  
  45  if (!is_array($aFonts)) {
  46      die('Fonts Not Found');
  47  }
  48  global $nukeurl, $capfile;
  49  $oVisualCaptcha = new PhpCaptcha($aFonts, $width, $height);
  50  $oVisualCaptcha->SetNumChars($length);
  51  if ($size != 'small') {
  52      $oVisualCaptcha->SetOwnerText(str_replace('http://', '', $nukeurl));
  53  }
  54  if (!empty($file) && $file != 'default') {
  55      if (file_exists(dirname(__FILE__).'/captcha/'.$file.'.jpg')) {
  56          $oVisualCaptcha->SetBackgroundImages('captcha/'.$file.'.jpg');
  57      }
  58  } else if (!empty($capfile) && $file != 'default') {
  59      if (file_exists(dirname(__FILE__).'/captcha/'.$capfile.'.jpg')) {
  60          $oVisualCaptcha->SetBackgroundImages('captcha/'.$capfile.'.jpg');
  61      }
  62  }
  63  
  64  $oVisualCaptcha->Create();
  65  
  66  ?>


Generated: Wed Jun 6 11:38:01 2007 Cross-referenced by PHPXref 0.7