Quote:
Originally Posted by mikeyddddd
I do it like this:
<?
$urls = file ("random.txt"); //replace with the name of your file
srand(time());
$count = count($urls);
$random = (rand()%$count);
Header("Location: $urls[$random]");
?>
random.txt contains a list of URLs.
You could put the URLs into an array in the code if you prefer. I have them in a separate file so I can use them from other code.
Example is in my sig.
|
this is pretty much the best way to do it, personally i'd just make the code like this if you just need simple
PHP Code:
<?php
$urls = file("./random.txt");
exit(header("Location: " . $urls[rand(0, (count($urls)-1))]));
?>