PHP allows the same kind of trick.
If you have a dir full of gifs, rename them all to start with "banner" (banner_blah.gif for example) and this script will output the image for you, cycling through the available images depending on the time of the day:
PHP Code:
<?php
function imagesel( $max )
{
$h=strftime("%H");
$m=strftime("%M");
$t=($h*60)+$m;
$n=1440/$max;
$r=$t/$n;
$r=floor($r);
return $r;
}
$i = 0;
$d = dir(".");
while($entry=$d->read())
if (substr($entry,0,6) == "banner") {
$array[$i++] = $entry;
}
$d->close();
/* pick a banner at random
*/
$r = imagesel( $i );
/* Send a no-cache header, and the gif type header, and output the file.
*/
Header( "Pragma: no-cache" );
Header( "Expires: Monday 01-Jan-80 12:00:00 GMT" );
Header( "Content-type: image/gif");
$im = fopen("./".$array[$r], "r");
fpassthru($im);
?>
It only needs a small modification of the imagesel function to make it random.