This works for me, just make sure your file paths are correct (includes/), put this at the top of index.php and browse.php (keeps out hotlinkers too) for glype:
Originally Posted by Chuman
It was posted on another thread somewhere before (maybe even this one).
// THIS IS THE GEOIP COUNTRY BLOCKING CODE
include('includes/geoip.inc'); //this file must exist in your directory
// Uncomment if querying against GeoIP/Lite City.
$gi = geoip_open('includes/GeoIP.dat',GEOIP_STANDARD);
// get the ip of the visitor
$addr = getenv('REMOTE_ADDR');
// translate his ip to a country code
$country = geoip_country_code_by_addr($gi, $addr);
// close the geo database
$badcountry = array('IR', 'CN', 'NG') // redirect them if they suck
header('Location: http://www.youarebanned.info'); //enter a url or page on your site
// END OF COUNTRY BLOCKING CODE