We Recommend

Wicked Cool PHP: Real-World Scripts That Solve Difficult Problems Wicked Cool PHP: Real-World Scripts That Solve Difficult Problems
Wicked Cool PHP contains a wide variety of scripts to process credit cards, check the validity of email addresses, template HTML, and serve dynamic images and text.


Posted By

fris on 11/16/07


Tagged

random files


Versions (?)


Who likes this?

1 person has marked this snippet as a favorite

sbbath


redirect to a random url


Published in: PHP 


  1. <?
  2. $file = "urls.txt";
  3. $fp = file($file);
  4. srand((double)microtime()*1000000);
  5. $urls = $fp[array_rand($fp)];
  6. header("Location: $urls");
  7. ?>

Report this snippet 

You need to login to post a comment.