Sorry, you must choose one of the following to make this reservation: Oral Assessment or Random Pairing."; exit(); } if ($Tasks=='' and $Needs=='') { print "

Sorry, you must select the tasks or write down your Brief Lesson Plan to make this reservation.

"; exit(); } //if (isset($_POST['task2'])){$Tasks .= $_POST['task2']."\n";} //$Tasks .= isset($_POST['task1']) ? $_POST['task1']."\n" : ""; if ($StartHour*60+$StartMinute >= $EndHour*60+$EndMinute) { print "

Sorry, your selected time $StartHour:$StartMinute - $EndHour:$EndMinute is invalid because someone has a reservation that overlaps part or all of your request. Please go back and change your time selection.

"; exit(); } include("../include/dbconfig.php"); $connection = mysql_connect($db_host, $db_user, $db_pass) or die ("Unable to connect!"); mysql_select_db($db_name); if ($Weekly == "0") { // $query = "SELECT Date from SR_reservation WHERE InstructorID = '$ID' and RoomNo = '$Room' and ClassID='$Course' and (Status='1' or Status='2') and week(Date)=week('$date')"; $day3 = $day+3; $day2 = $day-3; $query = "SELECT Date from SR_reservation WHERE InstructorID = '$ID' and RoomNo = '$Room' and ClassID='$Course' and (Status='1' or Status='2') and date between '$year-$month-$day2' and '$year-$month-$day3'"; //echo $query; $result = mysql_query($query, $connection) or die ("Error in query: $query. " . mysql_error()); while ($row = mysql_fetch_row($result)) { print "

Sorry, you've had a reservation for this class in that week on $row[0]. You can only have one reservation per class per week. Please go back and change your week selection or call the Front Desk.

"; exit(); } } $query = "SELECT EndDate from SR_semester WHERE CONCAT(Semester, ' ', Year) = '$Semester'"; $result = mysql_query($query, $connection) or die ("Error in query: $query. " . mysql_error()); $row = mysql_fetch_row($result); $LastDay = $row[0]; if ($Weekly == "0") { $query = "SELECT StartTime, EndTime, Date from SR_reservation WHERE Date = '$Date' and RoomNo = '$Room' and (Status='1' or Status='2')"; } else { $query = "SELECT StartTime, EndTime, Date from SR_reservation WHERE Date >= '$Date' and TO_DAYS(Date) <= TO_DAYS('$LastDay') and DAYOFWEEK(date)=DAYOFWEEK('$Date') and RoomNo = '$Room' and (Status='1' or Status='2')"; } $result = mysql_query($query, $connection) or die ("Error in query: $query. " . mysql_error()); while ($row = mysql_fetch_row($result)) { list ($starthour, $startminute, $startsec) = split (':', $row[0]); list ($endhour, $endminute, $endsec) = split (':', $row[1]); if ($starthour*60+$startminute >= $EndHour*60+$EndMinute or $endhour*60+$endminute <= $StartHour*60+$StartMinute) {continue;} else { print "

Sorry, your selected time $StartHour:$StartMinute - $EndHour:$EndMinute on $row[2] is not avaliable because someone has a reservation that overlaps part or all of your request. Please go back and change your time selection.

"; exit(); } } $query = "SELECT Title from SR_room WHERE RoomNo = '$Room'"; $result = mysql_query($query, $connection) or die ("Error in query: $query. " . mysql_error()); $row = mysql_fetch_row($result); $Title = $row[0]; $query = "SELECT CourseTitle from SR_course WHERE ClassID = '$Course' and CONCAT(Semester, ' ', Year) = '$Semester'"; $result = mysql_query($query, $connection) or die ("Error in query: $query. " . mysql_error()); $row = mysql_fetch_row($result); $CourseTitle = $row[0]; list ($Year, $Month, $Day) = split ('-', $Date); $HTMLtasks = str_replace("\n","
",$Tasks); $HTMLneeds = str_replace("\n","
",$Needs); print << Confirm Your Reservation

Confirm Your Reservation


Room: $Room - $Title
Date: $Month/$Day/$Year
Time: $StartHour:$StartMinute - $EndHour:$EndMinute
Course Number: $Course
Course Title: $CourseTitle
Number of Students: $Student
I will use: $HTMLtasks
Brief Lesson Plan: $HTMLneeds
END; if ($Weekly == '1') { $Weekday = date("l", mktime (0,0,0,$Month,$Day,$Year)); print <<This is a WEEKLY reservation for EVERY $Weekday from $Date to $LastDay!

END; } print <<

END; ?>