does anyone have a random url script?i just need it to grab a random url from a text file
random url script
Collapse
X
-
Tags: None
-
PHP?
<?
$urls = file ("random.txt"); //replace with the name of your file
srand(time());
$count = count($urls);
$random = (rand()%$count);
Header("Location: $urls[$random]");
?>
Or replace Header line with:
print("$urls[$random]"); -
-
Couldnt get it to one line-
<?$u=file('urls.txt'); echo $u[array_rand(file('urls.txt'))]?>
Or for an instant redirect
<?$u=file('urls.txt'); header('Location:'.$u[array_rand(file('urls.txt'))])?>
Should do the trickComment



Comment