View Full Version : Script To Select A Random Image
CeleronXT
Sun 8th Sep '02, 7:50pm
On my forum, I'd like to make a sig.php for myself and have it randomly select an image to display. What code would be used to do this? I've seen it done before on another vB which is why I wanted to do this as well, but I'm not sure of the coding to use.
Chen
Mon 9th Sep '02, 10:23am
This should work:
srand ((float) microtime() * 10000000);
$images = array('./image1.gif', './image2.gif', './image3.gif');
$rand_image = array_rand($images);
header('Content-type: image/gif');
readfile($images["$rand_image"]);
vBulletin® v3.8.0 Release Candidate 1, Copyright ©2000-2008, Jelsoft Enterprises Ltd.