View Single Post
Old 11-27-2007, 03:07 PM   #4 (permalink)
sdsinc
 
sdsinc's Avatar
 
Name: Kate
Last Online: Today 08:36 PM
iTrader: (29)
Join Date: Jul 2005
Posts: 2,959
DNF$: 12,428
Location: Wonderland
Country:


Here is one example:
I assume you will keep the blocks of code in external files and have 5 pages numbered 1.html thru 5.html in the same directory (you can adapt the $files variable for your purpose).
The script will pick one file at random and display the contents. That's it.
PHP Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>test</title>
</head>
<body>
<?php
srand
((float) microtime() * 10000000); // randomize seed - not needed starting from PHP 4.2.0 and up
$files = array("1.html""2.html""3.html""4.html""5.html");
$random_file array_rand($files); // pick one entry at random

include ($files[$random_file]); // display contents of the selected file 
?>
</body>
</html>
sdsinc is offline   Reply With Quote