First off, I’d like to let you all know that my web design experience is at most moderate.
Now, my problem…
I don’t know what it is.
I am trying to load random flash files on this page: http://www.nsgaming.us/random/
the files are located in …/files/flash/
my code for random.php is:
[php]<?php
$imglist=’’;
//$img_folder is the variable that holds the path to the swf files.
// see that you dont forget about the “/” at the end
$img_folder = “…/files/flash/”;
mt_srand((double)microtime()*1000);
//use the directory class
$imgs = dir($img_folder);
//read all files from the directory, ad them to a list
while ($file = $imgs->read()) {
if (eregi(“swf”, $file))
$imglist .= "$file “;
} closedir($imgs->handle);
//put all images into an array
$imglist = explode(” ", $imglist);
$no = sizeof($imglist)-2;
//generate a random number between 0 and the number of images
$random = mt_rand(0, $no);
$image = $imglist[$random];
//display random swf
echo ‘’;
?>[/php]
I call it in the index,
<head>
<title>test</title>
<?php
include("../menu.php");
include_once('random2.php');
?>
</head>
(Yes, it is random2.php, I tried two different base codes.)
Any help is appreciated.