Magic Main Random Lines Anti-Leech Indy Lib Block
(Legal) |
|
|||
|
This little chunk of PHP script loads a text file into an array (one array item per line in the text file) and then randomly prints out a number of items from it, without producing duplicates (unless, of course, there are duplicates in the text file you're loading in). Usage: If you only want to use this in one page, it's easiest to just stick the code where you want it - just paste the contents of this file into your page source and edit the obvious bits (how many lines to pick and the location of the file to load). Alternatively, if you want to use the effect on multiple pages, adjust and upload this file to your site somewhere, use the Include instruction (<? include("/home/username/random.txt"); ?>) in each page where you want the effect to be available, then put <? randLines(3) ?> in your page where you want the random stuff to go in.
|