Essential PHP class to filter various bad actors for your site.
- Block VPNs, TORs, Proxies, Abusers, Datacenters
- Blacklist Countries, Regions
- Whitelist - Blacklist IP addresses
- Filter all the bots.
All crawlers, datacenters, VPNs has a bad IP history. This tool will check if IP address marked as VPN, Proxy, Datacenter, proxy etc. Not only blocking VPNs, but also Crawlers, Bogons etc.
When you want your site reachable by real people only. A rule sets exists you to desire which actors to block.
- VPNs, Proxies and Datacenters
- Bogon IPs
- Crawlers - search engine bots
- Specific country or a specific region
include 'antibot.php';
$ip = $_SERVER['HTTP_CLIENT_IP'];
$user_agent = $_SERVER['HTTP_USER_AGENT'];
$antibot = new AntiBot($ip, $user_agent);
/*
Additional paramaters (default all true)
*/
$antibot->block_tor = true;
$antibot->block_vpn = true;
$antibot->block_bogon = true;
$antibot->block_abuse = true;
/*
Blocklisting IPs and Countries
*/
// * Example: Blocking countries:
$antibot->blacklisted_countries = ["finland", "germany", "estonia", "turkey"];
// * Example 2: Blocking region (block whole EU)
$antibot->blacklisted_regions = ["europe"];
// * Example 3: Blocking IP addresses
$antibot->blacklisted_ips = ["45.18.251.25", "28.25.111.58"];
/*
Whitelisting
When you want site reachable by specific IP address only!
This will override block rules
*/
$antibot->whitelisted_ips = ["61.58.68.235"];
// Now execute the checks
$result = $antibot->Execute(); // false|string
// FALSE if check passed, STRING with description if check not passed
if ($result != false) {
// Blocked. $result will contain the reason.
die("\n Bot detected - reason: $result");
}