ScriptUO

Casa de TrailMyx => Programming / Operating Systems => Scripting Languages => Topic started by: Tidus on July 08, 2008, 01:43:00 PM

Title: Great PHP Script - Random File Puller.
Post by: Tidus on July 08, 2008, 01:43:00 PM
So you want people to be able to randomly pull up a file or picture anything?  Say a random script?  All you need to change are the endings of the files.  Say you want a .JPG file to pull up.  or a .GIF file.

Code: [Select]
<?php
$files 
glob('{*.PNG,*.png,*.JPG,*.jpg,*.GIF,*.gif}'GLOB_BRACE);
readfile($files[array_rand($files)]);
?>


Say it is a random assortment of .php files.  add that to the list.

Whatever you do all you do is put this little snippet as it's own .php file and place it is a directory you want to use it in.  So say you want your file of My Pictures to randomly show up.   You put your .php file in there and direct yourself to it.  My Pictures/random.php    Works wonders and i'm sure you'll love it.

ruaduck/Tidus