Advertisement
Guest User

determinant3/ucapcha

a guest
Jul 13th, 2011
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.22 KB | None | 0 0
  1. <?php
  2. class determinant3
  3. {
  4.  
  5.     function generate_image($canvas)
  6.     {
  7.         global $captcha_font_path,$captcha_img_path;
  8.         $hit = "Считай детерминант, неуч!";
  9.         $a11=rand(0,9);
  10.         $a12=rand(0,9);
  11.         $a13=rand(0,9);
  12.         $a21=rand(0,9);
  13.         $a22=rand(0,9);
  14.         $a23=rand(0,9);
  15.         $a31=rand(0,9);
  16.         $a32=rand(0,9);
  17.         $a33=rand(0,9);
  18.         $color = imagecolorallocate($canvas, rand(100,255), rand(100,255), rand(100,255));
  19.         imageline($canvas, 20, 10, 20, 60, $color);
  20.         imageline($canvas, 160, 10, 160, 60, $color);
  21.         $rand=" =?";
  22.         for($i=0;$i<strlen($rand);$i++)
  23.         {
  24.             $color = imagecolorallocate($canvas, rand(100,255), rand(100,255), rand(100,255));
  25.             imagefttext($canvas, 20, rand(-45,45), 144+20*$i, 50, $color, $captcha_font_path."/LiberationMono-Bold.ttf", $rand[$i]);
  26.         }
  27.         $color = imagecolorallocate($canvas, rand(100,255), rand(100,255), rand(100,255));
  28.         imagefttext($canvas, 16, rand(-5,5), 40, 20, $color, $captcha_font_path."/LiberationMono-Bold.ttf", $a11);
  29.         imagefttext($canvas, 16, rand(-5,5), 80, 20, $color, $captcha_font_path."/LiberationMono-Bold.ttf", $a12);
  30.         imagefttext($canvas, 16, rand(-5,5), 120, 20, $color, $captcha_font_path."/LiberationMono-Bold.ttf", $a13);
  31.         imagefttext($canvas, 16, rand(-5,5), 40, 35, $color, $captcha_font_path."/LiberationMono-Bold.ttf", $a21);
  32.         imagefttext($canvas, 16, rand(-5,5), 80, 35, $color, $captcha_font_path."/LiberationMono-Bold.ttf", $a22);
  33.         imagefttext($canvas, 16, rand(-5,5), 120, 35, $color, $captcha_font_path."/LiberationMono-Bold.ttf", $a23);
  34.         imagefttext($canvas, 16, rand(-5,5), 40, 50, $color, $captcha_font_path."/LiberationMono-Bold.ttf", $a31);
  35.         imagefttext($canvas, 16, rand(-5,5), 80, 50, $color, $captcha_font_path."/LiberationMono-Bold.ttf", $a32);
  36.         imagefttext($canvas, 16, rand(-5,5), 120, 50, $color, $captcha_font_path."/LiberationMono-Bold.ttf", $a33);
  37.         imagefttext($canvas, 8, rand(-5,5), 15, 75, $color, $captcha_font_path."/LiberationMono-Bold.ttf", $hit);
  38.         $nme=$this->ucaptcha->get_filename();
  39.         imagepng($canvas);
  40.         //$ans=($a*$d)-($b*$c);
  41.         $ans=($a11*$a22*$a33) - ($a11*$a23*$a32) - ($a12*$a21*$a33) + ($a12*$a23*$a31) + ($a13*$a21*$a32) - ($a13*$a22*$a31)
  42.         $captcha[0]=$nme;
  43.         $captcha[1]=$ans;
  44.         return $captcha;
  45.     }
  46. }
  47. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement