1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

[GET] DMR + Rotator + GEOTARGETING SCRIPT

Discussion in 'Black Hat SEO' started by Siek, Dec 23, 2008.

  1. Siek

    Siek Regular Member

    Joined:
    Feb 4, 2008
    Messages:
    456
    Likes Received:
    294
    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).

    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
     
    • Thanks Thanks x 6
    Last edited: Dec 23, 2008
  2. bbyte

    bbyte Registered Member

    Joined:
    Oct 24, 2008
    Messages:
    86
    Likes Received:
    70
    Your rotator should work, DMR too if you refresh to this page. Checks for a blank ref are in place, so dmr should be working properly and not leaking.

    // Country name is not used so commented
    // Get Country Name based on source IP
    //$country = geoip_country_name_by_addr($gi, "$ip");

    You actually use the country name lol. "US", "CA" etc., that's the country name/country code. Anyway, the geo-targeting should work, the maxmind database is very accurate :)
     
  3. supermat007

    supermat007 Regular Member

    Joined:
    May 8, 2008
    Messages:
    261
    Likes Received:
    401
    Ah thanks for this!

    I was going to make one using the database from here.

    Code:
    http://www.ip2nation.com/ip2nation
    Its a mySQL job.
     
  4. zone69

    zone69 Junior Member

    Joined:
    Nov 24, 2008
    Messages:
    196
    Likes Received:
    1,290

    Actually $country would be "Canada", "United States", "United Kingdom" etc. That is not used in this script. It is using the 2 letter $country_code.
     
  5. bbyte

    bbyte Registered Member

    Joined:
    Oct 24, 2008
    Messages:
    86
    Likes Received:
    70
    Oh soz, I didn't see the //$country = geoip_country_name_by_addr($gi, "$ip"); part :)
     
  6. cristianraiber

    cristianraiber Regular Member

    Joined:
    Nov 22, 2008
    Messages:
    293
    Likes Received:
    381
    Occupation:
    Onliner
    Location:
    Internet
    thanks for the script man I'm already thinking of new ways to integrate it into an existing script I was working on ...
     
  7. bbyte

    bbyte Registered Member

    Joined:
    Oct 24, 2008
    Messages:
    86
    Likes Received:
    70
    To be honest, the rotator doesn't really work all that well. The reason for that is that you use a random value, which, as the name implies, is random. This means that it's possible to have your visitors go to the same offer like thrice in a row. For a solid method, you could hook it up to an SQL database and keep a counter there. Then you fill in the counter in the array and add 1 to the counter.

    Before all of this, you do a check to see if the counter is still smaller then the size, and if so, you reset it to 0, so you never go out of bounds.
     
  8. dashad

    dashad Newbie

    Joined:
    Mar 10, 2007
    Messages:
    30
    Likes Received:
    91
    Location:
    Germany
    i get following error
    Code:
    Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in blablabla on line 74