Advertisement
Guest User

spam.php

a guest
Jun 25th, 2016
275
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  1. <?php
  2. session_start();
  3.  
  4. // generate random number and store in session
  5.  
  6. $randomnr = rand(1000, 9999);
  7. $_SESSION['randomnr2'] = md5($randomnr);
  8.  
  9. //generate image
  10. $im = imagecreatetruecolor(120, 25); // dimensiuni
  11.  
  12. //colors:
  13. $white = imagecolorallocate($im, 255, 255, 255);
  14. $grey = imagecolorallocate($im, 128, 128, 128);
  15. $black = imagecolorallocate($im, 0, 0, 0);
  16.  
  17. imagefilledrectangle($im, 0, 0, 232, 44, $black);
  18.  
  19. //path to font:
  20.  
  21. $font = 'arial.ttf';
  22.  
  23. //draw text:
  24. imagettftext($im, 12, -10, 77, 22, $grey, $font, $randomnr);
  25.  
  26. imagettftext($im, 12, -6, 66,18, $white, $font, $randomnr);
  27.  
  28. // prevent client side caching
  29. header("Expires: Wed, 1 Jan 1997 00:00:00 GMT");
  30. header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
  31. header("Cache-Control: no-store, no-cache, must-revalidate");
  32. header("Cache-Control: post-check=0, pre-check=0", false);
  33. header("Pragma: no-cache");
  34.  
  35. //send image to browser
  36. header ("Content-type: image/gif");
  37. imagegif($im);
  38. imagedestroy($im);
  39. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement