GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   random url script (https://gfy.com/showthread.php?t=682829)

cyber_ninja 12-01-2006 10:59 PM

random url script
 
does anyone have a random url script?i just need it to grab a random url from a text file

mikeyddddd 12-01-2006 11:13 PM

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]");

cyber_ninja 12-01-2006 11:14 PM

thanks :thumbsup

quantum-x 12-01-2006 11:22 PM

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