Volkova

PHP Captcha

Jun 22nd, 2011
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.85 KB | None | 0 0
  1. <?php
  2.  
  3. $capt = substr(md5(time()),0,4);
  4. $capt .= " " . substr(md5(time()),4,4);
  5.  
  6. $im = imagecreatetruecolor(125, 45);
  7. $colour = imagecolorallocate($im, 255, 255, 255);
  8.  
  9. imagefill($im, 0, 0, $colour);
  10.  
  11. $text_colour1 = imagecolorallocate($im, 80, 80, 80);
  12. $text_colour = imagecolorallocate($im, 160, 160, 160);
  13. $line_colour = imagecolorallocate($im, rand(0, 100), rand(0, 100), rand(150, 255));
  14. $line_colour1 = imagecolorallocate($im, rand(0, 100), rand(0, 100), rand(150, 255));
  15.  
  16. imagestring($im, 3, 30, 16,  $capt, $text_colour);
  17. imagestring($im, 20, 23, 15,  $capt, $text_colour1);
  18.  
  19. imageline($im, rand(0, 45), rand(20, 45), rand(0, 145), rand(0, 45), $line_colour);
  20. imageline($im, rand(0, 45), rand(20, 45), rand(0, 145), rand(0, 45), $line_colour1);
  21.  
  22. header('Content-Type: image/jpeg');
  23.  
  24. imagejpeg($im, NULL, 100);
  25.  
  26. imagedestroy($im);
  27. ?>
Advertisement
Add Comment
Please, Sign In to add comment