$dir = "gfx/home_pic_large/";
if (is_dir($dir)) {
if ($dh = opendir($dir)) {
$numberitems=0;
while (($file = readdir($dh)) !== false) {
$numberitems++;
}
}
}
// Open a known directory, and proceed to read its contents
if (is_dir($dir)) {
if ($dh = opendir($dir)) {
$j=0;
while (($file = readdir($dh)) !== false) {
if (strpos($file,'jpg',0) || strpos($file,'jpeg',0) || strpos($file,'gif',0))
{
$filename[$j]=$file;
//echo $j.$filename[$j]."
";
$j++;
}
}
closedir($dh);
$time_to_mod=date('U');
$random=rand(0,count($filename)-1);
$random_image=$filename[$random];
//echo $random_image;
//echo $numberitems;
$caption_query=mysql_query("select * from picture_captions where pic_path='$random_image'");
$caption=mysql_fetch_array($caption_query);
echo "
";
}
}
?>