GeoIP doesn't seem to be working?
Hey,
I have GeoIP installed with the following code on my Index:
PHP Code:
include('geoip/geoip.inc'); //this file must exist in your directory
// Uncomment if querying against GeoIP/Lite City.
// include('geoip/geoip.inc');
$gi = geoip_open('geoip/geoip.dat',GEOIP_STANDARD);
// get the ip of the visitor
$addr = getenv('REMOTE_ADDR');
// translate his ip to a country code
$country = geoip_country_name_by_addr($gi, $addr);
// close the geo database
geoip_close($gi);
$badcountry = array('Iran','Islamic Republic of Iran','China','Russian Federation','Saudi Arabia');
if(in_array($country, $badcountry))
header('Location: http://www.proxlists.com'); //enter a url or page on your site
Lately, a lot of Iran traffic seems to have been slipping past it. Adversal is starting to get annoyed.
Can anybody help me out? I don't know if I'm doing something wrong.