This php based script willl randomly select a
file in a folder and display it. This script does not require MySQl to
retrieve the files. Once the file is selected it can be viewed through
HTML format or if it's an image, as an <img> tag.
Random File Picker
The script simply takes the name of a directory and returns a random
file from within that directory. An example of its use is provided by
means of script to play the game Scissors/Paper/Stone.
For a live use of this application, I use it to simply manage links
from my site, it's quick and easy to add,amend and delete the html link
code into files in several directories, and keep thus the links
separate from the html formatting of the page.
Once a random filename has been selected, the uses of it are vast, as
in the example the contents of the file can be displayed or parsed, or
for an image file the contents could be displayed via an IMG tag.
|