require( "calendar-functions.php3"); DBInfo(); ?> if (ereg( "MSIE ([0-9]+)",$HTTP_USER_AGENT,$version)) { $ver=(int)$version[1]; } if (ereg( "Mozilla.([0-9]+)",$HTTP_USER_AGENT,$version)) { $ver=(int)$version[1]; } mysql_connect( "$DBHost", "$DBUser", "$DBPass") or die( "Unable to connect to SQL server"); @mysql_select_db( "$DBName") or die( "Unable to select database"); if (empty($year)) $year=date("Y"); if (empty($month)) $month=date("m"); commonHeader( "Calendar for $month/$year"); /* Reset some variables */ $date=28; $day=01; $off=0; /* Figure out how many days are in this month */ while (checkdate($month,$date,$year)): $date++; endwhile; /* Figure out what month it is, convert the number to words, and then create a table with days of the week headers */ echo "
| Sunday | "; echo "Monday | "; echo "Tuesday | "; echo "Wednesday | "; echo "Thursday | "; echo "Friday | "; echo "Saturday | "; /* Start the table data and make sure the number of days does not exceed the total for the month - $date will always be one more than the total number of days in the momth */ echo "
|---|---|---|---|---|---|---|
| \n"; $off++; } if ($ver >= 4) { echo " | $day \n"; $result = mysql("$DBName","SELECT Event,Event_ID from Contents WHERE Month='$month' AND Day='$day' and Year='$year' ORDER BY Start_Period,Start_Time"); while($row = mysql_fetch_row($result)) { $Ev = $row[0]; $EID = $row[1]; echo " "; $Ev=""; $EID=""; } echo " | ";
} else {
echo "$day \n"; $result = mysql("$DBName","SELECT Event,Event_ID from Contents WHERE Month='$month' AND Day='$day' and Year='$year' ORDER BY Start_Period,Start_Time"); while($row = mysql_fetch_row($result)) { $Ev = $row[0]; $EID = $row[1]; echo " "; $Ev=""; $EID=""; } echo " | ";
}
/* Increment the day and the cells to go before the end of the row and end the
row when appropriate */
$day++;
$off++;
if ($off>7) {
echo "||||