0

我们有一个注册表,人们可以在其中注册参加调查以获得少量补偿。最近我们发现了很多可疑条目。我找到了一个我通过谷歌翻译的中文网站,它基本上是一个“如何”注册这些网站的方法。从那以后,我一直在努力寻找一种自动过滤掉虚假信息的方法。

注册有一个“验证码”,希望能阻止非人类,但在许多情况下,输入的数据是非常真实的。该调查针对调酒师,所有字段均使用合法位置和地址填写。电话号码可能已关闭,但他们可能正在使用手机并搬到该地区。我一直在尝试通过使用以下功能捕获 IP 信息和国家/地区数据来进行筛选:

// this function is necessary since allow_url_fopen is disabled by default in php.ini in PHP >5.
function my_file_get_contents($file_path) {
    $ch = curl_init();
    curl_setopt ($ch, CURLOPT_URL, $file_path);
    curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, 1);
    $buffer = curl_exec($ch);
    curl_close($ch);
    return $buffer;  
}

function getInfoFromIP(){

// get correct IP in case of a proxy
if (!empty($_SERVER['HTTP_CLIENT_IP'])){                   // shared ip
    $real_ip=$_SERVER['HTTP_CLIENT_IP'];
}
elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])){       // ip is from proxy
    $real_ip=$_SERVER['HTTP_X_FORWARDED_FOR'];
}
else{
    $real_ip=$_SERVER['REMOTE_ADDR'];
}

//verify the IP address for the
ip2long($real_ip)== -1 || ip2long($real_ip) === false ? trigger_error("Invalid IP Passed: ", E_USER_ERROR) : "";

$ipDetailArray=array(); //initialize a blank array
$ipDetailArray['ip'] = $real_ip; //assign ip number to the array

//get the XML result from hostip.info using custom lookup function
$xml = my_file_get_contents("http://api.hostip.info/?ip=".$real_ip);

//regex to get the country name from <countryName>INFO</countryName>
preg_match("@<countryName>(.*?)</countryName>@si",$xml,$countryInfoArray);
$ipDetailArray['country'] = $countryInfoArray[1];    //assign country name to the array

//get the country name inside the node <countryName> and </countryName>
preg_match("@<countryAbbrev>(.*?)</countryAbbrev>@si",$xml,$ccInfoArray);
$ipDetailArray['country_code'] = $ccInfoArray[1];     //assign country code to array

//return the array containing ip, country and country code
return $ipDetailArray; 
}

然后我一直在手动检查和删除出现在美国以外的那些(这是酒吧和调查员必须参与的地方)。我仍然发现许多带有美国 IP 列表的可疑 IP(我确定这些 IP 是被欺骗的)。

不确定我的代码是否不完整,或者我找不到更好的解决方案。谢谢

4

1 回答 1

0

唐,我们做了一些类似的事情,这是我们不得不求助的一些事情:

  1. 将页面隔离为它自己的虚拟服务器。使用 Apache 来阻止屡犯者。
  2. 很好地使用 Capcha,但如果他们通过它,你就有问题了。考虑使用任何机器人都无法绕过的东西来改进验证码,例如模糊图形或人类挑战问题。如果它继续下去,那么你手上有一些坚定的人。
  3. 定期更改页面名称。它可能会阻止关注“操作方法”链接的人
  4. 插入谷歌分析并观察流量。它可以帮助您发现问题明显的模式和时间。有时,它可以带来更有趣的解决方法。
  5. 仔细检查日志。使用在线工具检查 IP 地址。向 ISP 报告违规者。

也许检查他们是否支持浏览器地理定位,并尝试一下。(http://www.browsergeolocation.com/) 但是,按位置进行封锁很困难,因为许多黑客拥有其他僵尸计算机可供他们使用,而且如今区号等信息非常便于携带。

于 2010-09-28T21:26:59.333 回答