Got an iPhone or iPad? We have a brand new Pastebin App for both devices, and it's totally free! Click here to download the new Pastebin App for iOS.
Guest

Sam Yong

By: a guest on Jan 13th, 2009  |  syntax: PHP  |  size: 0.48 KB  |  hits: 55  |  expires: Never
download  |  raw  |  embed  |  report abuse
Copied
  1. function getIP() {
  2. $IP = '';
  3.     if (getenv('HTTP_CLIENT_IP')) {$IP =getenv('HTTP_CLIENT_IP');}
  4.       elseif (getenv('HTTP_X_FORWARDED_FOR')) {$IP =getenv('HTTP_X_FORWARDED_FOR');}
  5.       elseif (getenv('HTTP_X_FORWARDED')) {$IP =getenv('HTTP_X_FORWARDED');}
  6.       elseif (getenv('HTTP_FORWARDED_FOR')) {$IP =getenv('HTTP_FORWARDED_FOR');}
  7.       elseif (getenv('HTTP_FORWARDED')) {$IP = getenv('HTTP_FORWARDED');}
  8.       else {
  9.         $IP = $_SERVER['REMOTE_ADDR'];
  10.     }
  11. return $IP;
  12. }