Well - I grabbed a bunch of coding on BHW and put it all together. Thanks to all the guys who posted the original coding. Forgot the names sorry lol
When I put them all together - it works on my end. Didn't test to see if the DMR works for sure but I'm pretty sure the way i coded it - it should work. If a more experienced coder can take a look at the DMR for me real quick and to tell me if that works that would be awsome.
Of course have the first page do a meta refresh to the second page (which is the php page below).
Hope this helps someone. Happy holidays!
NOTE: You will need to get these files and put it on your server. Should be in the same location as your php page above
Got these from zone69. Thanks
When I put them all together - it works on my end. Didn't test to see if the DMR works for sure but I'm pretty sure the way i coded it - it should work. If a more experienced coder can take a look at the DMR for me real quick and to tell me if that works that would be awsome.
Of course have the first page do a meta refresh to the second page (which is the php page below).
Code:
<?php
// US Offers
$USurl[]="http://www.yahoo.com";
$USurl[]="http://www.google.com";
$USrnd=rand(0,count($USurl)-1);
$USoffer=$USurl[$USrnd];
// CA Offers
$CAurl[]="http://www.tsn.com";
$CAurl[]="http://www.blackhatworld.com";
$CArnd=rand(0,count($CAurl)-1);
$CAoffer=$CAurl[$CArnd];
// UK Offers
$UKurl[]="http://www.tsn.com";
$UKurl[]="http://www.blackhatworld.com";
$UKrnd=rand(0,count($UKurl)-1);
$UKoffer=$UKurl[$UKrnd];
// AU Offers
$AUurl[]="http://www.tsn.com";
$AUurl[]="http://www.blackhatworld.com";
$AUrnd=rand(0,count($AUurl)-1);
$AUoffer=$AUurl[$AUrnd];
// DEFAULT Offers
$DEFAULTurl[]="http://www.tsn.com";
$DEFAULTurl[]="http://www.blackhatworld.com";
$DEFAULTrnd=rand(0,count($DEFAULTurl)-1);
$DEFAULToffer=$DEFAULTurl[$DEFAULTrnd];
$referer = $_SERVER['HTTP_REFERER'];
include("geoip.inc");
$ip=$_SERVER['REMOTE_ADDR'];
$gi = geoip_open("GeoIP.dat",GEOIP_STANDARD);
$country_code = geoip_country_code_by_addr($gi, "$ip");
// Country name is not used so commented
// Get Country Name based on source IP
//$country = geoip_country_name_by_addr($gi, "$ip");
geoip_close($gi);
switch($country_code)
{
case "US":
if($referer == "") {
echo "<meta http-equiv="refresh" content="0;url=$USoffer">";}
break;
case "CA":
if($referer == "") {
echo "<meta http-equiv="refresh" content="0;url=$CAoffer">";}
break;
case "UK":
if($referer == "") {
echo "<meta http-equiv="refresh" content="0;url=$UKoffer">";}
break;
case "AU":
if($referer == "") {
echo "<meta http-equiv="refresh" content="0;url=$AUoffer">";}
break;
default:
if($referer == "") {
echo "<meta http-equiv="refresh" content="0;url=$DEFAULToffer">";}
break;
}
?>
Hope this helps someone. Happy holidays!
NOTE: You will need to get these files and put it on your server. Should be in the same location as your php page above
Code:
http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz
Code:
http://geolite.maxmind.com/download/geoip/api/php/geoip.inc
Got these from zone69. Thanks
Last edited: