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

rydg187

Registered Member
Joined
Jun 26, 2009
Messages
87
Reaction score
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\">";  
}
?>
 
I forgot, but again, it wouldn't matter much because it won't remember the person again, so thus when you refresh it it'll start all new again. That's the reason why its randomize, so that if they do it again, it doesn't have to remember the user, it just remembers that the thing they have to do is...randomize!

Although its possible, it takes extensive php coding, maybe not that extensive, but someone with good PHP knowledge that can apply cookies/ip-logging/sessions?

I know php, but not a lot, so I can't help you much. sorry!


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:
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.

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.
 
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
 
Come on! someone has to know something. I know it cant be THAT hard! Help me out fellas!
 
Last edited:
Back
Top