Quote:
|
Originally Posted by lookslikeapuma
function f_GetIP() { // Get the true IP of the user, runs through various methods of getting the IP
if (isSet($_SERVER)) {
if (isSet($_SERVER["HTTP_X_FORWARDED_FOR"])) {
$realip = $_SERVER["HTTP_X_FORWARDED_FOR"];
} elseif (isSet($_SERVER["HTTP_CLIENT_IP"])) {
$realip = $_SERVER["HTTP_CLIENT_IP"];
} else {
$realip = $_SERVER["REMOTE_ADDR"];
}
} else {
if ( getenv( 'HTTP_X_FORWARDED_FOR' ) ) {
$realip = getenv( 'HTTP_X_FORWARDED_FOR' );
} elseif ( getenv( 'HTTP_CLIENT_IP' ) ) {
$realip = getenv( 'HTTP_CLIENT_IP' );
} else {
$realip = getenv( 'REMOTE_ADDR' );
}
}
return $realip; // Return the IP.
}
|
Although this is a good idea, I tested five proxy servers, and none of them sent the HTTP_CLIENT_IP or the HTTP_X_FORWARDED_FOR... (They are anonymous proxies though...)
I would still recommending you do something like this though Calvin, because you should take many precaussions