Hi,
I’m having some problems with a spammer who is coming to my site thru various proxy servers so the IP is different all the time. I did a bit of googling and I found this code shown below.
I read that there is no way of tracking someone who’s using a proxy server. Is this true? Will the code below not work? I’m waiting on the spammer coming back, but in the mean time I thought I’ll post on here. ?
[code=php]/**
* Call as: $userp = GetUserIP();
*/
function GetUserIP() {
if (isset($_SERVER)) {
if (isset($_SERVER[“HTTP_X_FORWARDED_FOR”]))
return $_SERVER[“HTTP_X_FORWARDED_FOR”];
if (isset($_SERVER[“HTTP_CLIENT_IP”]))
return $_SERVER[“HTTP_CLIENT_IP”];
return $_SERVER[“REMOTE_ADDR”];
}
if (getenv(‘HTTP_X_FORWARDED_FOR’))
return getenv(‘HTTP_X_FORWARDED_FOR’);
if (getenv(‘HTTP_CLIENT_IP’))
return getenv(‘HTTP_CLIENT_IP’);
return getenv(‘REMOTE_ADDR’);
}
If this code doesn’t work, is there any way of banning traffic using proxy’s? I’ll put a temp ban on them :-))
Peace!