anyone know where i can get a script that will pick a random html file from a folder on my server once a day for a "story of the day"?
any help is greatly appreciated, thanks!
any help is greatly appreciated, thanks!

function randompage($folder){
$or = opendir($folder);
$htmls = array();
while($file = readdir($or)){
if(ereg(".+\.html$") || ereg(".+\.htm$")) $htmls[] = $file;
}
$rint = mt_rand(0, count($htmls)-1);
return $htmls[$rint];
}
//replace "/storieS" with the path to your stories dirctory
echo randompage("/stories") ;
function randompage($folder){
$or = opendir($folder);
$htmls = array();
while($file = readdir($or)){
if(ereg(".+\.html$") || ereg(".+\.htm$")) $htmls[] = $file;
}
$rint = mt_rand(0, count($htmls)-1);
return $htmls[$rint];
}
//replace "/storieS" with the path to your stories dirctory
echo randompage("/stories") ;

Comment