<?php
include('/GeoIP/geoip.inc'); //this file must exist in your directory
$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_code_by_addr($gi, $addr);
// close the geo database
geoip_close($gi);
$badcountry = array('CN','KW','RU','IR','NG','PK','TR','SA');
// redirect them if they suck
if(in_array($country, $badcountry))
header('Location: http://www.google.com'); //enter a url or page on your site
?>
Bookmarks