This is my code, which displays either an image, or message depending on the time:
<?php
$b = time();
$hour = date("g",$b);
$m = date ("A", $b);
if ($m == "AM")
{
if ($hour == 12)
{
echo "Good Evening!";
}
elseif ($hour < 4)
{
echo "Good Evening!";
}
elseif ($hour > 3)
{
echo "Good Morning!";
}
}
elseif ($m == "PM")
{
if ($hour == 12)
{
echo "Good Afternoon!";
}
elseif ($hour < 7)
{
echo "Good Afternoon!";
}
elseif ($hour > 6)
{
// echo "Good Evening!";
echo "<img src=\"http://www.mysitehere.com/test1.jpg\">";
}
}
?>
I'm using this as a script in my radio station site, displaying images at the times when presenters are on-air.
This is from schedule.php (a dynamically updated page which extracts info from the database):
Monday - Friday
12:00am John Doe
3:00am Joe Bloggs 1
5:30am Breakfast Show
9:00am Non Stop Music
10:00am Joe Blow
2:00pm Jane Doe
6:00pm Joe Q Public
10:00pm AN Other
Saturday
12:00am John Doe
6:00am Joe Public
10:00am Saturday Morning
12:30pm Non Stop Saturday Music
2:00pm AN Other
6:00pm Non Stop Music
10:00pm Love Songs
Sunday
12:00am Night Trax
4:00am AN Other
6:00am Placeholder1
10:00am Presenter
1:00pm Presenter2
4:00pm Chart Show
7:00pm Night Trax
9:00pm Love Songs
All the above shows have images associated with them; it's just getting them to display, especially for ones where they're at odd hours (e.g. 5:30am etc.)
Anyone able to help me with this, with how to get it right for images appearing at times like 5:30am etc? Your help would be much appreciated!