Hello all thanks for reading my post I was wonding if anyone knows the best was to ban Proxy surfing from a website.
I first thought of something like this
1.
$IP = ( getenv('HTTP_CLIENT_IP') ? getenv('HTTP_CLIENT_IP') : getenv('REMOTE_ADDR') );
If false then the user is hiding their IP right? but then echo'd HTTP_CLIENT_IP and it seem to be empty for some reason or another?
Then I thought maybe something like this may work
2.
IF ( getenv("HTTP_CLIENT_IP") && strcasecmp( getenv("HTTP_CLIENT_IP"), "unknown" ) )
$IP = getenv("HTTP_CLIENT_IP");
ELSEIF ( getenv("HTTP_X_FORWARDED_FOR") && strcasecmp( getenv("HTTP_X_FORWARDED_FOR"), "unknown" ) )
$IP = getenv("HTTP_X_FORWARDED_FOR");
ELSEIF ( getenv("REMOTE_ADDR") && strcasecmp( getenv("REMOTE_ADDR"), "unknown" ) )
$IP = getenv("REMOTE_ADDR");
ELSEIF ( isset( $_SERVER['REMOTE_ADDR'] ) && $_SERVER['REMOTE_ADDR'] && strcasecmp( $_SERVER['REMOTE_ADDR'], "unknown" ) )
$IP = $_SERVER['REMOTE_ADDR'];
ELSE
$IP = FALSE;
I'm trying to figure out a way to stop hackers using proxy servers on my site, I figure if they hide the IP address via proxy then that is probably best.
I had hoped something as simple as this would work
3.
IF (getenv('HTTP_CLIENT_IP') != getenv('REMOTE_ADDR') )
$IP = FALSE;
ELSE $IP = getenv('REMOTE_ADDR');
But HTTP_CLIENT_IP is always empty??
So does anyone have an easy way to detect a vistor's IP and if the real IP is being hidden via proxy?
I want to stay away from maintaining a list of IP proxy servers because that requires a huge amount of time to maintain.
any suggestions or help would be great..thank