I understand this is a complex issue and there’s no silver bullet so to speak but I’m looking for ideas on how maybe I could improve things.
Following on from my post yesterday, I’m now recording view of an object with the IP and object ID hasn’t been entered into the DB within the last hour,
It works nicely for genuine visitors.
The issue I have is I’m getting ‘bots’ in my DB
I started to block them and I might have blocked some of googles but I’m still getting more and I’ve not even looked at other popular bots. If I was to continue down this path I would end up managing a long list of IP’s.
**As an idea
Most of my visitors are from 5 or 6 countries as it’s content specific.
Is there a quick and simple way (free) to look-up and IP and confirm what country it’s from? Maybe I’ll only enter these countries?
“`
$ipRanges = array(
array(‘min’ => ip2long(‘64.233.160.0’), ‘max’ => ip2long(‘64.233.191.255’)),
array(‘min’ => ip2long(‘66.102.0.0’), ‘max’ => ip2long(‘66.102.15.255’)),
array(‘min’ => ip2long(‘66.249.64.0’), ‘max’ => ip2long(‘66.249.95.255’)),
array(‘min’ => ip2long(‘72.14.192.0’), ‘max’ => ip2long(‘72.14.255.255’)),
array(‘min’ => ip2long(‘74.125.0.0’), ‘max’ => ip2long(‘74.125.255.255’)),
array(‘min’ => ip2long(‘209.85.128.0’), ‘max’ => ip2long(‘209.85.255.255’)),
array(‘min’ => ip2long(‘216.239.32.0’), ‘max’ => ip2long(‘216.239.63.255’)),
array(‘min’ => ip2long(‘64.18.0.0’), ‘max’ => ip2long(‘64.18.15.255’)),
array(‘min’ => ip2long(‘108.177.8.0’), ‘max’ => ip2long(‘108.177.15.255’)),
array(‘min’ => ip2long(‘172.217.0.0’), ‘max’ => ip2long(‘172.217.31.255’)),
array(‘min’ => ip2long(‘173.194.0.0’), ‘max’ => ip2long(‘173.194.255.255’)),
array(‘min’ => ip2long(‘207.126.144.0’), ‘max’ => ip2long(‘207.126.159.255’)),
array(‘min’ => ip2long(‘216.58.192.0’), ‘max’ => ip2long(‘216.58.223.255’)),
array(‘min’ => ip2long(‘64.68.90.1’), ‘max’ => ip2long(‘ 64.68.90.255’)),
array(‘min’ => ip2long(‘64.233.173.193’), ‘max’ => ip2long(‘64.233.173.255’)),
array(‘min’ => ip2long(‘66.249.64.1’), ‘max’ => ip2long(‘66.249.79.255’)),
array(‘min’ => ip2long(‘216.239.33.96’), ‘max’ => ip2long(‘216.239.59.128’)),
);
$bot = false;
foreach ($ipRanges as $IpRange){
if ($ip <= $IpRange[‘max’] && $IpRange[‘min’] <= $ip) {
$bot = true;
}
}