LST or Local Server Time Image Object:

Good Afternoon
The above image is one of three images, selected by the local server time. Here is the object code:
<?
$image_base = "/images/objects/";
$image_array = array("morning.gif", "noon.gif", "night.gif");
$msg_array = array("Good Morning", "Good Afternoon", "Good Evening", "Good Night");
if (!$lst_key)
$lst_key = date("G");
// conditionalize $lst_key
// to allow query_string values
// G - hour, 24-hour format
// without leading zeros; i.e. "0" to "23"
if ($lst_key > 6 && $lst_key <= 11) {
$img_key = 0;
} elseif ($lst_key > 11 && $lst_key <= 18) {
$img_key = 1;
} else {
$img_key = 2;
if ($lst_key <= 22)
$msg_key = 3;
}
echo "<img src=$image_base$image_array[$img_key]><br>";
if (!$msg_key)
$msg_key = $img_key;
echo $msg_array[$msg_key];
?>
1
Article Navigation: [
Prev 1 2 3 4 5 6 7 Next ]