MLT

PHP - Dynamic Image IP grabber

MLT
Nov 10th, 2013
679
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.15 KB | None | 0 0
  1. <?php
  2. $log = 'logger.html';
  3. $ip = $_SERVER['REMOTE_ADDR'];
  4. $page = $_SERVER['REQUEST_URI'];
  5. $refer = $_SERVER['HTTP_REFERER'];
  6. $date_time = date("l j F Y  g:ia", time() - date("Z")) ;
  7. $agent = $_SERVER['HTTP_USER_AGENT'];
  8. $fp = fopen("logger.html", "a");
  9. fputs($fp, "
  10. <b>$date_time</b> <br> <b>IP: </b>$ip<br><b>Page: </b>$page<br><b>Refer: </b>$refer<br><b>Useragent:
  11.  
  12. </b>$agent <br><br>
  13. ");
  14. flock($fp, 3);
  15. fclose($fp);
  16.  
  17.  
  18. $my_img = imagecreate( 200, 80 );
  19. $background = imagecolorallocate( $my_img, 255, 0, 255 );
  20. $text_colour = imagecolorallocate( $my_img, 200, 200, 0 );
  21. $line_colour = imagecolorallocate( $my_img, 128, 255, 0 );
  22. imagestring( $my_img, 4, 30, 25, "MLT was here lol",
  23.   $text_colour );
  24. imagesetthickness ( $my_img, 5 );
  25. imageline( $my_img, 30, 45, 165, 45, $line_colour );
  26.  
  27. header( "Content-type: image/png" );
  28. imagepng( $my_img );
  29. imagecolordeallocate( $line_color );
  30. imagecolordeallocate( $text_color );
  31. imagecolordeallocate( $background );
  32. imagedestroy( $my_img );
  33.  
  34. // mod_rewrite to .htaccess to point jpg to dynamic image
  35. // set .jpg as xat avatar, outputted image will display and will run php code alongside :)
  36.  
  37. ?>
Advertisement
Comments
  • Comment was deleted
Add Comment
Please, Sign In to add comment