PDA

View Full Version : Loading a random php file


[Unknown]
04-27-2007, 12:56 PM
I'm looking for a method to randomize the include of a php document.

For example, I have: special1.php, special2.php, special3.php

And I want them to be randomly included in my index file (specials will change either on every refresh or on a time line [every week]).

Any help would be great.

Thanks in advance! :)

rafiki
04-27-2007, 01:04 PM
for a random on refresh

//header("Cache-Control: no-cache, must-revalidate"); blahblah
$rand = rand(1,100); // replace 100 with the amount of special pages you have
$special = 'special' . $rand . '.php';
include "$special";

other wise you would probably use a switch statement for depending on which day/date it was

[Unknown]
04-27-2007, 01:33 PM
Thank you very much! :)