<?php
$dir = "fotos/";
$teller=-1;
if ($handle = opendir($dir)) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
$teller++;
$img[$teller] = $file;
}
}
closedir($handle);
}
$random = rand(0, count($img));
echo "<a href=$dir$img[$random] TARGET=_blank><img src=\"$dir$img[$random]\" width=140 height=170 border=0></a>";
?>