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

Source for file captcha_image.php

Documentation is available at captcha_image.php

  1. <?php
  2. /**
  3.  * captcha image
  4.  *
  5.  * @copyright (c) 2004-15 bitweaver.org
  6.  *
  7.  * @package users
  8.  * @subpackage functions
  9.  */
  10.  
  11. /**
  12.  * required setup
  13.  */
  14. require_once'../kernel/setup_inc.php' );
  15.  
  16. // dimensions
  17. $width  @BitBase::verifyId$_REQUEST['width'$_REQUEST['width'140;
  18. $height @BitBase::verifyId$_REQUEST['height'$_REQUEST['height'35;
  19.  
  20. $img @imagecreate$width$height or die"The GD image library doesn't seem to be available or doesn't have JPG support." );
  21.  
  22. // colours
  23. $text[imagecolorallocate$img0  0  128 );
  24. $text[imagecolorallocate$img0  1280   );
  25. $text[imagecolorallocate$img1280  0   );
  26. $text[imagecolorallocate$img0  128128 );
  27. $text[imagecolorallocate$img1281280   );
  28. $text[imagecolorallocate$img1280  128 );
  29. $border imagecolorallocate$img0  0  0   );
  30. $bg     imagecolorallocate$img230240250 );
  31.  
  32. imagefill$img00$bg );
  33. imagerectangle$img11$width 1$height 1$border );
  34. srandtime() );
  35. $number rand1000099999 );
  36. $_SESSION['captcha'md5$number );
  37. for$i 0$i 5$i++ {
  38.     imagestring$img10$width $width $i rand0)rand0$height 22 )substr$number$i)$text[rand0count$text ));
  39. }
  40.  
  41. $gd gd_info();
  42. if$gd["PNG Support"{
  43.     header"Content-type: image/png" );
  44.     imagepng$img );
  45. elseif$gd["GIF Create Support"{
  46.     header"Content-type: image/gif" );
  47.     imagegif$img );
  48. else {
  49.     header"Content-type: image/jpeg" );
  50.     imagejpeg$img );
  51. }
  52. ?>

Documentation generated on Wed, 29 Jul 2015 13:56:14 +0000 by phpDocumentor 1.5.0-lsces