前 次 新10 1- 板 カキコミ
[5]管理人 ★ 03/07/22 07:50 ID:???
rndimg.phpのソースです
<?php
$dir = opendir("img");
while (($file = readdir($dir)) !== false) {
if ($file != "." && $file != "..") {
$img[] = $file;
}
}
closedir($dir);
$count = count($img) - 1;
list($usec, $sec) = explode(' ', microtime());
$seed = (float) $sec + ((float) $usec * 100000);
srand($seed);
$randval = rand(0, $count);
$name = $img[$randval];
$ext = substr($name, -3);
if ($ext == jpg) {$ext = "jpeg";}
header ("Content-type: image/$ext");
readfile ("img/$name");
exit;
?>
前 次 カキコミ
r.php ver2.5 (2005/03/28)