![]() |
random url script
does anyone have a random url script?i just need it to grab a random url from a text file
|
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]"); |
thanks :thumbsup
|
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 trick |
All times are GMT -7. The time now is 12:30 PM. |
Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123