Author Topic: Great PHP Script - Random File Puller.  (Read 9317 times)

0 Members and 1 Guest are viewing this topic.

Offline TidusTopic starter

  • Lazy
  • Administrator
  • *
  • *
  • Posts: 1291
  • Activity:
    0%
  • Reputation Power: 15
  • Tidus is working their way up.Tidus is working their way up.Tidus is working their way up.
  • Gender: Male
  • Mind Blown
  • Respect: +151
  • Referrals: 2
    • View Profile
    • Ultimate Apparel
Great PHP Script - Random File Puller.
« on: July 08, 2008, 01:43:00 PM »
+1
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
For those who have fought for it, freedom has a taste the protected will never know ~ Anonymous, Vietnam, 1968

Tags: