Text_CAPTCHA
[ class tree: Text_CAPTCHA ] [ index: Text_CAPTCHA ] [ all elements ]

Source for file CAPTCHA_Figlet_test.php

Documentation is available at CAPTCHA_Figlet_test.php

  1. <?php
  2.  
  3. require_once 'Text/CAPTCHA.php';
  4.  
  5. // Set CAPTCHA image options
  6. // font_file can either be an array or a string
  7. // style is optional and specifies inline css to be used
  8.  
  9. $textOptions = array(
  10.     'font_file' => glob('*.flf'),
  11.     'style'     => array('border' => '1px dashed red'
  12.                          'color' => 'yellow',
  13.                          'background' => 'black'),
  14.     );
  15.  
  16. // Set CAPTCHA options
  17. // There is no way to set the 'height' property
  18. // output options are 'javascript', 'html' or 'text' default is html
  19. // default length is 6
  20.  
  21. $options = array(
  22.     'width' => 200,
  23.     'output' => 'javascript',
  24.     'length' => 8,
  25.     'options' => $textOptions
  26. );
  27.                    
  28. // Generate a new Text_CAPTCHA object, Image driver
  29. $c Text_CAPTCHA::factory('Figlet');
  30. $retval $c->init($options);
  31. if (PEAR::isError($retval)) {
  32.     echo 'Error initializing CAPTCHA!';
  33.     exit;
  34. }
  35.     
  36. // Get CAPTCHA secret passphrase
  37. $phrase strtoupper($c->getPhrase());
  38.     
  39. $text $c->getCAPTCHA();
  40. if (PEAR::isError($text)) {
  41.        echo $text->getMessage();
  42.      echo 'Error generating CAPTCHA!';
  43.      exit;
  44. }
  45.     
  46. echo "<pre>$text</pre><br />";
  47. echo "Solution: $phrase";
  48. ?>

Documentation generated on Mon, 11 Mar 2019 14:44:40 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.