include("geoip.inc");
include("geoipcity.inc");
include("geoipregionvars.php");
$gi = geoip_open("GeoLiteCity.dat", GEOIP_STANDARD);
$rsGeoData = geoip_record_by_addr($gi, $_SERVER['REMOTE_ADDR']);
$country = $rsGeoData->country_code;
geoip_close($gi);
if ($country == "CN") { $redirect = "1"; }
@josearmando thanks man, appreciate it. But can that be done through htaccess, as I want to make the block sitewide.
I have shit ton of ips in there already but I still get visitors. Is there a definitive list of ips that blocks most of the traffic? Also wont adding lots of ips affect load times?Yes. For one of my website I blocked India and China using .htaccess. You just need to add the country IP ranges of the countries to the deny list
I can understand the desire to block hackers, but blocking out chinese traffic is dumb imo. I get a lot of sales from there. India - not so much. At all really.
You can easily block countries with cloudflare.