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

How can I make this DMR rotation script visit the URL's in sequential order?

Discussion in 'CPA' started by rydg187, Oct 30, 2009.

  1. rydg187

    rydg187 Registered Member

    Joined:
    Jun 26, 2009
    Messages:
    87
    Likes Received:
    4
    How can I make this DMR rotation script visit the URL's in sequential order? I really need this script to run in sequential order through the URL's in links.txt file.


    index.php
    PHP:
    <?php
    echo "<meta http-equiv=\"refresh\" content=\"0;url=second.php\">";
    ?>
    second.php
    PHP:
    <?php

    // Open our links file
    $sites array_map("trim"file("links.txt"));

    // Grab a random URL
    $redirect $sites[array_rand($sites)];

    $referer $_SERVER['HTTP_REFERER']; if($referer == "")

    // Redirect to our Random URL
    echo "<meta http-equiv=\"refresh\"content=\"0;url=http://".$redirect."\">"
      
    else
    {
    // Referrer is not blank send traffic to our homepage
    echo "<meta http-equiv=\"refresh\" content=\"0;url=http://www.microsoft.com\">";  
    }
    ?> 
     
  2. rydg187

    rydg187 Registered Member

    Joined:
    Jun 26, 2009
    Messages:
    87
    Likes Received:
    4

    I don't need the script to remember users/cookies/ip's/sessions. I just need the script to run in sequential order in a loop regardless of who the visiting user is.


    link1, link2 ,link3 , link4, link5, link1, link2, link3, link4, new visitor >>> link5 , link 1, link2 , link3, new visitor >>> link4, link5, link1, new visitor >>>, link 2 etc.
     
    Last edited: Oct 30, 2009
  3. BunThings

    BunThings Registered Member

    Joined:
    Jun 17, 2009
    Messages:
    91
    Likes Received:
    14
    Location:
    Toronto
    Home Page:
    This should be really easy if i got it right..

    You need to use a loop with a stored integer. Google php while/for loop.
     
    • Thanks Thanks x 1
  4. kimkils

    kimkils Power Member

    Joined:
    Jan 10, 2009
    Messages:
    663
    Likes Received:
    225
    Here you go buddy, this is what i use ;)

    Code:
    $random_url = array("http://www.google.com", "http://www.yahoo.com");
    
    			srand(time());
    			$random = (rand()%count($random_url));
    		
    			header ("Location: $random_url[$random]");
    Self explanatary, just add as many links as you want in :cool:

    EDIT: oops, just read the thread again... this isnt exactly what you need but i hope it helps
     
  5. rydg187

    rydg187 Registered Member

    Joined:
    Jun 26, 2009
    Messages:
    87
    Likes Received:
    4

    Thank you, I did the search Google and found a few things that look useful. However I know nothing about PHP coding. Can someone help?


    Here is what I found on Google http://www.tizag.com/phpT/whileloop.php
     
    Last edited: Oct 30, 2009
  6. rydg187

    rydg187 Registered Member

    Joined:
    Jun 26, 2009
    Messages:
    87
    Likes Received:
    4
    Come on! someone has to know something. I know it cant be THAT hard! Help me out fellas!
     
    Last edited: Nov 1, 2009