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/08/07


Tagged

html random links


Versions (?)


Who likes this?

2 people have marked this snippet as a favorite

vali29
basicmagic


random links with description and dupe checking


Published in: PHP 


  1. <?
  2. $file = "links.txt";
  3. // $url|$desc
  4. $open = "$file";
  5. $fcontents = file($open);
  6. while (list ($line_num, $line) = each ($fcontents)) {
  7. $ct[$count] = "$line";
  8. $count++;
  9. }
  10. shuffle($ct);
  11. for($i = 0; $i < $count; $i++) {
  12. $ln = explode ('|', $ct[$i]);
  13. $u = $ln[0];
  14. $d = $ln[1];
  15. echo "<a href=\"$u\">$d</a><br/>";
  16. }
  17. ?>

Report this snippet 

You need to login to post a comment.