I trimmed it down a bit, but was unable to test it. Let me know if it works!
<!-- This script shows real-time postings whether the office is open or closed. -->
<?php
//connect to the database -- CONVERT THIS TO A FILE //
$connect = mysql_connect("localhost", "username", "password") or
die ("Could not connect to server. Please check connection.");
mysql_select_db ("database");
?>
<html>
<head>
<title> </title>
</head>
<body>
<?php
//caluculate current time from GMT time by unix timestamp
list($hour, $min, $sec, $day, $month, $date, $year, $dayoftheyear) = explode(',', gmdate('H,i,s,w,n,d,Y,z'));
$conversion = ($hour*60)+$min; // converts time to minutes
$query = "SELECT * FROM holidays WHERE doty=$dayoftheyear LIMIT 1";
$results = mysql_query($query)
or die(mysql_error());
echo "Our office is currently ";
if ($row = mysql_fetch_array($results)) {
extract ($row);
echo "closed for ".$reason."."; //example: New Year's Eve = 365
} elseif ($day==0 || $day == 6) { // day of the week conditions
echo "closed for the weekend.";
} elseif ($conversion<=779 || $conversion>=1291) { //converted time: closed 12:00AM - 7:59AM & 4:31PM - 11:59PM
echo "closed for the day.";
} else { //converted time: open 8:00AM - 4:30PM
echo "open.";
}
// testing variables //
echo "doty: ",$doty,"<br>";
echo "dayoftheyear: ",$dayoftheyear,"<br>";
echo "conversion: ",$conversion,"<br>";
echo "day: ",$day,"<br>";
?>
</body>
</html>