Search the Community
Showing results for tags 'show image by time php script'.
-
Can any body help me with the script below, i call it to a web page via Includes newtime.php and it should show a open or closed gif between the hours ive set for each day on that web page 11am - 3am open 3am - 11am Closed <?php $h = date('G'); //set variable $h to the hour of the day $d = date('w'); //set variable $d to the day of the week. $year = date('Y'); //set variable $year to the current year //G is the date key for hours in 24 format (not 12), with no leading 0s, like 02. // MONDAY SCHEDULE if ($d == 1 && $h >= 11 && $h < 3) $img = 'open.gif'; else if ($d == 1 && $h >= 3 && $h < 11) $img = 'closed.gif'; else if ($d == 2 && $h < 11) $img = 'open.gif'; // TUESDAY SCHEDULE if ($d == 2 && $h >= 11 && $h < 3) $img = 'open.gif'; else if ($d == 2 && $h >= 3 && $h < 11) $img = 'closed.gif'; else if ($d == 3 && $h < 11) $img = 'open.gif'; // WEDNESDAY SCHEDULE if ($d == 3 && $h >= 11 && $h < 3) $img = 'open.gif'; else if ($d == 3 && $h >= 3 && $h < 11) $img = 'closed.gif'; else if ($d == 4 && $h < 11) $img = 'open.gif'; // THURSDAY SCHEDULE if ($d == 4 && $h >= 11 && $h < 3) $img = 'open.gif'; else if ($d == 4 && $h >= 3 && $h < 11) $img = 'closed.gif'; else if ($d == 5 && $h < 11) $img = 'open.gif'; // FRIDAY SCHEDULE if ($d == 5 && $h >= 11 && $h < 3) $img = 'open.gif'; else if ($d == 5 && $h >= 3 && $h < 11) $img = 'closed.gif'; else if ($d == 6 && $h < 11) $img = 'open.gif'; // SATURDAY SCHEDULE if ($d == 6 && $h >= 11 && $h < 3) $img = '/open.gif'; else if ($d == 6 && $h >= 3 && $h < 11) $img = '/closed.gif'; else if ($d == 7 && $h < 11) $img = '/open.gif'; // SUNDAY SCHEDULE if ($d == 7 && $h >= 11 && $h < 3) $img = '/open.gif'; else if ($d == 7 && $h >= 3 && $h < 11) $img = '/closed.gif'; else if ($d == 1 && $h < 11) $img = '/open.gif'; ?> <html> ... <body> ... <img src="<?php echo $img; ?>"> ... </html>