FRIHOSTFORUMSFAQTOSBLOGSDIRECTORY
You are invited to Log in or Register a Frihost Account!

CAPTCHA and GDLib

 


eznet
Hello All...

I am having some "issues" with a new Igloo install. Igloo is an open-source community CMS that is seemingly in its infancy. I can find little help through them and have found only one post here relating to GDlib.

My problem is with my user registration. The CAPTCHA php script calls on the GDlib to create the captcha (best I understand anyways). There seems to be an issue with the script not being able to access the GDlib. Here is the script barnraiser included:
Code:
 <?php
 class captcha
  {

    var $Length;
    var $CaptchaString;
    var $ImageType;
    var $Font;
    var $CharWidth;

    function captcha ($length = 6, $type = 'png', $letter = '')
    {
   
      $this->Length    = $length;
      $this->ImageType = $type;
      $this->Font      = 'font/FreeSerifItalic.ttf';
      $this->CharWidth = 19;

      if ($letter == '')
      {

        $this->StringGen();

      }
      else
      {

        $this->Length = strlen($letter);
        $this->CaptchaString = $letter;

      }

      $this->SendHeader();

      $this->MakeCaptcha();

    }

    function StringGen ()
    {
     //some chars confuse people so we have replaced the following to remove i-1, 0-o etc
      //$uppercase  = range('A', 'Z');
      //$numeric    = range(0, 9);
      //$CharPool   = array_merge($uppercase, $numeric);
     $CharPool   = array (2,3,4,7,8,9,'A','B','C','D','E','F','G','H','K','M','N','P','Q','R','T','W','U','Y');
    
    
    
    
      $PoolLength = count($CharPool) - 1;

      for ($i = 0; $i < $this->Length; $i++)
      {

        $this->CaptchaString .= $CharPool[mt_rand(0, $PoolLength)];

      }
   
    }

    function SendHeader ()
    {

      switch ($this->ImageType)
      {

        case 'jpeg': header('Content-type: image/jpeg'); break;
        case 'png':  header('Content-type: image/png');  break;
        default:     header('Content-type: image/png');  break;

      }

    }

    function MakeCaptcha ()
    {

      $imagelength = $this->Length * $this->CharWidth + 16;
      $imageheight = 40;

      $image       = imagecreate($imagelength, $imageheight);

      $bgcolor     = imagecolorallocate($image, 222, 222, 222);

      $stringcolor = imagecolorallocate($image, 0, 0, 0);
      $linecolor   = imagecolorallocate($image, 0, 0, 0);

      imagettftext($image, 20, -4, 12, 22,
                   $stringcolor,
                   $this->Font,
                   $this->CaptchaString);

      switch ($this->ImageType)
      {

        case 'jpeg': imagejpeg($image); break;
        case 'png':  imagepng($image);  break;
        default:     imagepng($image);  break;

      }

    }

    function GetCaptchaString ()
    {

      return $this->CaptchaString;

    }

  }

?>


I am clueless here. I simply get the error that my captcha word did not work. But you can tell from my registration page that the captcha isnt actually working.

Any help is appriciated!

Ez[/url]
Reply to topic    Frihost Forum Index -> Support and Web Hosting -> Web Hosting Support

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2007 Frihost, forums powered by phpBB.