Code:
$bad_country_codes = Array('CN', 'JP', 'TW');
require_once("geoip.inc");
$gi = geoip_open("/usr/share/GeoIP/GeoIP.dat", GEOIP_STANDARD);
$cc = geoip_country_code_by_addr($gi, $_SERVER['REMOTE_ADDR']);
if(in_array($cc, $bad_country_codes)) {
exit;
}
The above is what I use on one of my websites, so it looks like you're doing it correctly.
Have you checked you're not giving it a US ip all the time?
You can go to maxmind.com and enter the IP there and it will tell you the location of the IP so you will be able to see whether you've given it a US ip or your code is wrong.