Hey Corrupt,
For the script to work, you need to remove the tab "\t" that's added to the CountryCode variable returned by the geoip script. Otherwise the string comparison won't work and all traffic will be treated as international.
This means line 9 of index.php should be:
Code:
$CountryCode = geoip_country_code_by_addr($gi, $IP);
Also, there's a lot of unnecessary whitespace in the index.php file that's caused by putting everything within separate <?php ?> tags. It caused issues on my web server, and I presume it will with other peoples' servers as well. PHP short tags are also used, which are not universally supported.
I would suggest removing all extraneous <?php ?> tags and using php echo for reproducing plain text.
Here's my updated index.php code:
Code:
<?php
$IP = $_SERVER["REMOTE_ADDR"];
include("geo/geoip.inc");
$gi = geoip_open("geo/GeoIP.dat", GEOIP_MEMORY_CACHE);
$CountryCode = geoip_country_code_by_addr($gi, $IP);
geoip_close($gi);
// ****DO NOT TOUCH ABOVE THIS LINE.******
//***Consult the Readme if you aren't sure what you're doing****
if ($CountryCode=="US"){
//US offers go here
}
//Add or remove these else if statements depending on which countries you have offers for
else if($CountryCode=="GB")
{
//UK offers go here
}
else if($CountryCode=="AU")
{
//AU offers go here
}
else if($CountryCode=="DE")
{
//DE offers go here
}
else {
//Change this to reflect your international offers for country codes not listed above
echo 'INTERNATIONAL OFFERS GO HERE';
}
?>
Bookmarks