GeoIP targeting and wordpress problem
To do that, I got 2 files from maxmind: GeoIP.dat and geoip.inc, which can be used to return the visitor's location based on ip. A friend gave me this code, which I doesn't work properly:
In header.php:
<?php
include("geoip.inc");
$gi = geoip_open("GeoIP.dat",GEOIP_STANDARD);
$ip=$_SERVER['REMOTE_ADDR'];
$cc=geoip_country_code_by_addr($gi, $ip);
geoip_close($gi);
?>
Wherever I want adsense (index.php):
<?php if ($cc<>"US"): ?>
The adsense code HERE
<?php endif; ?>
The problem is that if I place the code echo $cc in the header it will show my country, but it won't work in index.php
Anyone knows why ?
The 2nd Amendment, 1789 - The Original Homeland Security.
Gun control means never having to say, "I missed you."