Advertisement
vicendominguez

Getting headers from server to discover your browse ip

Apr 15th, 2013
450
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.83 KB | None | 0 0
  1. <pre>
  2.  
  3. YOUR INFO ----
  4.  
  5. HTTP_USER_AGENT => <? print getenv("HTTP_USER_AGENT") . "\n"; ?>
  6. HTTP_CLIENT_IP => <? print getenv("HTTP_CLIENT_IP") . "\n"; ?>
  7. HTTP_X_FORWARDED_FOR => <?print getenv("HTTP_X_FORWARDED_FOR") . "\n"; ?>
  8. SERVER HTTP_X_FORWARDED_FOR => <? print $_SERVER['HTTP_X_FORWARDED_FOR'] . "\n"; ?>
  9. REMOTE_ADDR: => <? print getenv("REMOTE_ADDR") . "\n"; ?>
  10. SERVER REMOTE_ADDR => <? print $_SERVER['REMOTE_ADDR'] . "\n"; ?>
  11. SERVER_VARS => <? print $HTTP_SERVER_VARS ['REMOTE_ADDR'] . "\n"; ?>
  12. HTTP_X_FORWARDED => <? print getenv("HTTP_X_FORWARDED") . "\n"; ?>
  13. SERVER HTTP_X_FORWARDED => <? print $_SERVER['HTTP_X_FORWARDED'] . "\n"; ?>
  14. HTTP_FORWARDED => <? print getenv("HTTP_FORWARDED") . "\n"; ?>
  15. SERVER HTTP_FORWARDED =>  <? print $_SERVER['HTTP_FORWARDED'] . "\n"; ?>
  16. HTTP_VIA => <? print getenv("HTTP_VIA") . "\n"; ?>
  17. SERVER HTTP_VIA => <? print $_SERVER['HTTP_VIA'] . "\n"; ?>
  18. HTTP_PROXY_CONNECTION =>  <? print getenv("HTTP_PROXY_CONNECTION") . "\n"; ?>
  19. SERVER HTTP_PROXY_CONNECTION => <? print $_SERVER['HTTP_PROXY_CONNECTION'] . "\n"; ?>
  20.  
  21. <?php
  22. //Find the IP of the visitor
  23.      if (getenv("HTTP_CLIENT_IP") && strcasecmp(getenv("HTTP_CLIENT_IP"), "unknown"))
  24.      {
  25.         $rip = getenv("HTTP_CLIENT_IP");
  26.      }
  27.      else if (getenv("HTTP_X_FORWARDED_FOR") && strcasecmp(getenv("HTTP_X_FORWARDED_FOR"), "unknown"))
  28.      {
  29.         $rip = getenv("HTTP_X_FORWARDED_FOR");
  30.      }
  31.      else if (getenv("REMOTE_ADDR") && strcasecmp(getenv("REMOTE_ADDR"), "unknown"))
  32.      {
  33.         $rip = getenv("REMOTE_ADDR");
  34.      }
  35.      else if (isset($_SERVER['REMOTE_ADDR']) && $_SERVER['REMOTE_ADDR'] && strcasecmp($_SERVER['REMOTE_ADDR'], "unknown"))
  36.      {
  37.         $rip = $_SERVER['REMOTE_ADDR'];
  38.      }
  39.      else
  40.      {
  41.         $rip = "unknown";
  42.      }
  43.  
  44. //Display the IP of the Visitor
  45. echo "Your IP is $rip";
  46. ?>
  47.  
  48. </pre>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement