rotator but not random

Discussion in 'Cloaking and Content Generators' started by oscarslater, Jun 22, 2009.

  1. oscarslater

    oscarslater Regular Member

    Joined:
    Mar 13, 2008
    Messages:
    401
    Likes Received:
    152
    Hi all

    I use a dmr to hide my referer from most cpa networks and I use a small program to make the pages

    it give two pages like this

    1st.php and 2nd.php

    this is how it works

    I put in my aff links and press go

    1st.php is a simple meta refresh that send the visitor to the 2nd.php

    the 2nd.php has all my links and some code that randomly picks a destination url as long as the referrer was not present.

    My question is this - how do I write some php code that means the 2nd.php just simply goes down a list of urls instead of taking them randomly.

    like this

    1st.php--->2nd.php--->landing page (which was url1 then url2 thenurl3 and so on)

    Here is the code for each page

    1st.php

    <?php
    echo "<meta http-equiv=\"refresh\" content=\"0;url=2nd.php\">";
    ?>

    2nd.php

    <?php
    $page1 ="http://google.com";
    $page2 ="http://msn.com";
    $page3 ="http://yahoo.com";
    $referer = $_SERVER['HTTP_REFERER'];
    $mypages = array($page1, $page2, $page3);
    $myrandompage = $mypages[mt_rand(0, count($mypages) -1)];
    if($referer == "")
    {
    echo "<meta http-equiv=\"refresh\" content=\"0;url=$myrandompage\">";
    }
    else
    {
    echo "<meta http-equiv=\"refresh\" content=\"0;url=1st.php\">";
    }
    ?>

    hope someone can help me with this

    oscar...
     
  2. ruler0fall

    ruler0fall Power Member

    Joined:
    May 17, 2009
    Messages:
    565
    Likes Received:
    263
    Write the number to a file and increase it every time, till it hits the max, then reset it back to zero.
     
  3. oscarslater

    oscarslater Regular Member

    Joined:
    Mar 13, 2008
    Messages:
    401
    Likes Received:
    152
    Has anyone else got any ideas for me here?

    I'd like to get this sorted today.

    oscar...
     
  4. qcp860

    qcp860 Jr. VIP Jr. VIP

    Joined:
    Dec 16, 2008
    Messages:
    258
    Likes Received:
    83
    Gender:
    Male
    Occupation:
    marketing
    Location:
    PA
    Home Page:
    umm.. ruler0fall's post is correct.

    write all the destination urls to a file - redirect.txt
    have another file called count.txt - the only thing in the file is "0" to start

    so now you

    $c = trim(file_get_contents("count.txt"));
    $urls = file("redirect.txt");
    $url_to_use = $urls[$c];

    $c = ($c + 1) % count($urls);
    file_put_contents("count.txt", $c);

    then you can check for referrer and redirect as needed using

    NOTE: I just wrote this without cutting/pasting code. There are probably errors but this is the basic technique short of using a database.
     
  5. oscarslater

    oscarslater Regular Member

    Joined:
    Mar 13, 2008
    Messages:
    401
    Likes Received:
    152
    Hi there ruler0fall and qcp960

    Thanks for the help.

    I think I get this but I have never been shown coding.

    Are you saying that in the destination folder i have index.php with my original php code and the above code in it along with 2 other files count and redrect

    If that is the case I will try and put it together.

    oscar...