Just a simple script, which tries to find the real ip even when a proxy is used...
GeSHi (php):
<?php
// Simple script to retrieve the ip even when a proxy is used
function GetIP(){
if (getenv('HTTP_CLIENT_IP')) { $IP =
getenv('HTTP_CLIENT_IP');
} elseif (getenv('HTTP_X_FORWARDED_FOR')) { $IP =
getenv('HTTP_X_FORWARDED_FOR');
} elseif (getenv('HTTP_X_FORWARDED')) { $IP =
getenv('HTTP_X_FORWARDED');
} elseif (getenv('HTTP_FORWARDED_FOR')) { $IP =
getenv('HTTP_FORWARDED_FOR');
} elseif (getenv('HTTP_FORWARDED')) { $IP =
getenv('HTTP_FORWARDED');
} else {
$IP = $_SERVER['REMOTE_ADDR'];
}
return $IP;
}
?>
Created by GeSHI 1.0.7.20
I also wrote a script to get the proxy-ip and the user-ip...
GeSHi (php):
<?php
$proxy = "No Proxy-Server used or found!";
if (isset($_SERVER['REMOTE_ADDR'])) $ip =
$_SERVER['REMOTE_ADDR'];
else $ip =
'Unknown';
//Proxy detection
foreach (array('HTTP_X_FORWARDED_FOR',
'HTTP_X_FORWARDED',
'HTTP_FORWARDED_FOR',
'HTTP_FORWARDED',
'HTTP_CLIENT_IP') as $x) {
if (!
isset($_SERVER[$x])) continue;
$proxy = $ip;
$ip = $_SERVER[$x];
}
echo 'IP-Adress : ' .
$ip .
"<br />";
echo 'Proxy : ' .
$proxy .
"<br />";
?>
Created by GeSHI 1.0.7.20