PHP Photo Changer
The header picture on this website changes based on the time of day. You can change your website photo automagically throughout the day too. It isn’t very hard with a few photos and a bit of PHP. This is similar to what Google does on their customized home pages.
<?php
// This neat piece of code changes the header image
// based on the the time of day, EST.
date_default_timezone_set("America/New_York");
$hour = date("G");
if ($hour < 6){
$pic = "twentyfour.jpg";
}elseif ($hour < 9){
$pic = "six.jpg";
}elseif ($hour < 12){
$pic = "nine.jpg";
}elseif ($hour < 15){
$pic = "twelve.jpg";
}elseif ($hour < 18){
$pic = "fifteen.jpg";
}elseif ($hour < 21){
$pic = "eighteen.jpg";
}elseif ($hour < 24){
$pic = "twentyone.jpg";
}
?>
<img src="./images/<?php echo $pic; ?>"/>
Tags: php