Random Avatar
Posted: Sat Oct 04, 2003 2:57 am
I got the script from Nigma a few weeks back. I kept on re-writing it to suit me. I've come up with this:
I'm wondering why I need to use:
I put the images into a string, then explode() to make them an array. But before I do that, I need to use substr() to get rid of some dots in front of the string. Before making them into an array, the string is:
Thanks,
-Nay
Code: Select all
<?php
header("Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0");
header("Expires: Thu, 19 Nov 1981 08:52:00 GMT");
header("Pragma: no-cache");
header("Content-Type: image/jpeg");
$dir = "/home/chaosdre/public_html/external/signature/images";
$dh = opendir($dir);
$images;
while (($file = readdir($dh)) !== false) {
$images .= $file . "-";
}
$images = substr($images, 5);
$images = explode("-", $images);
$max = count($images);
$i = rand(0, $max);
floor($i);
$image = "images/" . $images[$i];
readfile($image);
closedir($dh);
?>Code: Select all
$images = substr($images, 5);Those aren't the real image names, lol. Anyhow, it's .-.. since I added the - before I made them into a string. So basicly, what I'm asking is where are these two dots coming from? I have NO files in the images/ directory other than the images themselves..-..-myimage1.jpg-myimage2.jpg
Thanks,
-Nay