<?php
$pages = "
index1.html
index2.html
index3.html
index4.html
";
$indexes = explode("\n", $pages);
foreach ($indexes as $key => $line) {
$line = trim(str_replace("\r", '', $line));
if (!empty($line)) $files[] = $line;
}
$randomKey = rand(0, (count($files)-1));
include ($files[$randomKey]);
?>
Coolnat2004 said:Assuming your server supports PHP... this is a simple way to do it:
PHP:<?php $pages = " index1.html index2.html index3.html index4.html "; $indexes = explode("\n", $pages); foreach ($indexes as $key => $line) { $line = trim(str_replace("\r", '', $line)); if (!empty($line)) $files[] = $line; } $randomKey = rand(0, (count($files)-1)); include ($files[$randomKey]); ?>
(I included extra code to make it easier on you if you don't know PHP)
Just put each index file between the quotes, each on a new line, and it will include a random one of those.
nsutt22 said:Thanks a bunch. since the server auto loads an index.html file how do i make it load the index.php file?
Also how do I preview to see if this works. Cause i cant just open th index.php file in a browser? or can I?