Ok, I'm a php newbie and found this script somewhere.. can someone help me fix it please? Thanks!
<?php
$banner_folder_sys = "/www/fury/html/test/header";
$banner_folder_url = "http://fury.qgl.org/test/header";
$mydir = dir("$banner_folder_sys");
$amount = 0;
while($entry = readdir($mydir))
{
$tmp = split(".", $entry, 2);
if ($tmp[1] == "jpg" || $tmp[1] == "JPG")
{
$img[] = $entry;
$amount++;
}
if ($tmp[1] == "gif" || $tmp[1] == "GIF")
{
$img[] = $entry;
$amount++;
}
}
mt_srand((double)microtime()*1000000);
$random_image = mt_rand(0,$amount);
echo "<img src=$banner_folder_url/$img[$random_image] width=750 height=150>";
?>
Now the problem:
Warning: Supplied argument is not a valid Directory resource in /www/fury/html/test/rimage.php on line 7
Warning: mt_rand(): Invalid range: 0..0 in /www/fury/html/test/rimage.php on line 23
Please Help!!
Thanks!