Department of Biological Sciences
Faculty of ScienceUniversity of Alberta
Department of Biological Sciences
"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"); //if date invalid or not supplied, use current time if($useDate == 0) { $useDate = Time(); } /* ** make month selector */ print(""); /* ** make day selector */ print(""); /* ** make year selector */ print(""); } //***********************************END DATE SELECTOR****************************************** $ccid=$_SERVER['PHP_AUTH_USER']; //------ DATABASE VARIABLES --------// $dbuser = 'leclair'; $dbhost = 'www.biology.ualberta.ca'; $dbpass = 'S|ber!an'; $dbname = 'Content'; //----- DATABASE CONNECTION --------// $db = mysqli_connect($dbhost,$dbuser,$dbpass); mysqli_select_db("$dbname", $db); $sql="SELECT * FROM People WHERE ccid='$ccid'"; //echo $sql; $result_faculty=mysqli_db_query('Content', $sql); if($Current_faculty=mysqli_fetch_assoc($result_faculty)) { if($Submit) { $Start_Date=date("Y-m-d", mktime(0, 0, 0, $StartMonth, $StartDay, $StartYear)); $End_Date=date("Y-m-d", mktime(0, 0, 0, $StartMonth+$Length_Months, $StartDay+($Length_Weeks*7), $StartYear)); if(mktime(23, 59, 59, $StartMonth, $StartDay, $StartYear) >= time()) { if($Length_Months>0) { $timevalid=1; $sql="SELECT * FROM Biotron_Chamber, Biotron_Bookings WHERE Biotron_Chamber.ChamberID=Biotron_Bookings.ChamberID AND Biotron_Bookings.ChamberID = ".$ChamberID." AND Approved='Lease'"; $result_Current_Leases=mysqli_db_query('Content', $sql); $init=0; while($Current_Lease=mysqli_fetch_assoc($result_Current_Leases)) { if ($Start_Date >= $Current_Lease["End_Date"] OR $Start_Date < $Current_Lease["Start_Date"]) { if ($End_Date > $Current_Lease["End_Date"] OR $End_Date <= $Current_Lease["Start_Date"]) { if ($Start_Date < $Current_Lease["Start_Date"] AND $End_Date > $Current_Lease["End_Date"]) { $timevalid=0; } }else { $timevalid=0; } } else { $timevalid=0; } } if($timevalid==1) { $sql="INSERT INTO Biotron_Bookings (Start_Date, End_Date, Renewal_Date, CCID, ChamberID, Approved, Percent, Comments) VALUES ('$Start_Date', '$End_Date', '$Renewal_Date', '$ccid', $ChamberID, 'Lease', '$Percent', '$Comments')"; if($result=mysqli_db_query('Content',$sql)) { ?>

Biotron Booking System:

The following lease has been posted for Room#: $Room_Number"; echo "
Start Date: ".$Start_Date; echo "
End Date: ".$End_Date; echo "
Percent Available: ". $Percent; echo "
Comments: ". $Comments; echo "
"; echo "

Return to Biotron Bookings

"; } else { echo "Error Accessing Database"; } } else { echo"

This new lease conflicts with a previous lease

"; } } else { echo "Length of booking must be greater than one week"; } } else { echo "Start Date has already past"; } } else { ?>

Biotron Booking System :

"; echo "

Would you like try and sublease Room: ".$Current_Sublease_Chamber['Room_Number']."

"; echo ""; echo ""; echo ""; echo "

Start Date: "; echo DateSelector("Start", $Start_Date); ?>

Sublease Length:

% of Chamber Available for use:

Notes (If Space leased is less than 100% please enter the appropriate environmental controls):

"; echo ""; $sql="SELECT * FROM Biotron_Chamber, Biotron_Bookings WHERE Biotron_Chamber.ChamberID=Biotron_Bookings.ChamberID AND Biotron_Bookings.CCID = '$ccid' AND Approved='Lease'"; $result_Current_Leases=mysqli_db_query('Content', $sql); $init=0; while($Current_Lease=mysqli_fetch_assoc($result_Current_Leases)) { if($init==0) { echo "

Note Your Current Sub-Leases

"; $init++; } echo "".$Current_Lease['Room_Number'].", Min Start Date: ".$Current_Lease['Start_Date'].", Max End Date:".$Current_Lease['End_Date'].", Percent: ".$Current_Lease['Percent']."
"; $sql="SELECT * FROM Biotron_Bookings WHERE ChamberID=".$Current_Lease['ChamberID']." AND (Approved='Y' OR Approved='n')"; $result_Sub_Leases=mysqli_db_query('Content', $sql); while($Current_Sub_Lease=mysqli_fetch_assoc($result_Sub_Leases)) { if($Current_Sub_Lease['Start_Date']>=$Current_Lease['Start_Date'] && $Current_Sub_Lease['End_Date']<=$Current_Lease['End_Date']) { if($Current_Sub_Lease['Approved']=='Y') { echo"     Appoved Lease:
           UserID: ".$Current_Sub_Lease['CCID']." Start Date: ".$Current_Sub_Lease['Start_Date']." End Date: ".$Current_Sub_Lease['End_Date']."
"; } else { echo"     Pending Lease:
          UserID: ".$Current_Sub_Lease['CCID']." Start Date: ".$Current_Sub_Lease['Start_Date']." End Date: ".$Current_Sub_Lease['End_Date']."
"; } } } } } } echo "


"; } ?>

"; } ?>

contact us
Copyright ©1994-2003, Privacy Policy