Hello,
I have a script that is too clunky.
I need to have something show on a web site at certain times of the day and week.
This is a snip of what I have been using:
$hourdiff = "5";
$timeadjust = ($hourdiff * 60 * 60);
$day = date("w",time() - $timeadjust);
$time = date("G",time() - $timeadjust);
if (($day == "6") or ($day == "0")) {
$show = "It's the Weekend!";
}else{
if (($time >= "6") and ($time < "10")) {
$show = "The Morning Chat (6am to 10am)";
}
if (($time >= "10") and ($time < "12")) {
$show = "Tom is in Chat (10am to 12pm)";
}
if (($time >= "12") and ($time < "15")) {
$show = "Afternoon Chat with Jim (12pm to 3pm) ";
}
if (($time >= "15") and ($time < "19")) {
$show = "Fun News Chat with Jim (3pm to 7pm)";
}
}
It works but, if I want to have the morning chat start at 6:15 or 6:30 or end at 9:46 then I can't do it with my script.
Anyone have a better idea on how this could be done?
I know there is a better way of doing it than my way.
Thanks in advance
John