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

Randomized DMR

Discussion in 'PHP & Perl' started by MrDetails, Apr 13, 2010.

  1. MrDetails

    MrDetails Regular Member

    Joined:
    Nov 16, 2009
    Messages:
    252
    Likes Received:
    70
    Occupation:
    Bots, lots of bots
    Location:
    ...unknown
    I've been using this for a while now to rotate offers while blanking the ref, but it seems to prefer going to 1 url over the rest (not by much but it's noticeable in tests). Basically all I wanted to know is if this is the best way of going about doing this, or if there are better, more reliable ones out there.

    Anyway, here's the code I've been using. (I didn't make this, I just got it from an old eBook I bought.)

    PHP:
    <?php 
        $page1 
    "LINK #1"
        
    $page2 "LINK #2"
        
    $page3 "LINK #3";  
        
    $referer $_SERVER['HTTP_REFERER']; 
        
    $mypages = array($page1$page2$page3); 
        
    $myrandompage $mypages[mt_rand(0count($mypages) -1)]; 
        
        if(
    $referer == ""

    { echo 
    "<meta http-equiv=\"refresh\" content=\"0;url=$myrandompage\">"; } 

    else { echo 
    "<meta http-equiv=\"refresh\" content=\"0;url=index.php\">"; } 

    ?>
    All suggestions are appreciated :)