session_start();
if (!session_is_registered("LLC"))
{
// if session check fails, invoke error handler
header("Location: ../loginform.php");
exit();
}
$user = $_SESSION['UNAME'];
include("../include/dbconfig.php");
$connection = mysql_connect($db_host, $db_user, $db_pass) or die ("Unable to connect!");
mysql_select_db($db_name);
?>
Language Learning Center Reservation Management
HISTORY |
From |
To |
Reservation started |
|
$query = "SELECT Semester, Year, StartDate, EndDate, Opendate from SR_semester WHERE EndDate < CURDATE()";
$result = mysql_query($query, $connection) or die ("Error in query: $query. " . mysql_error());
while ($row = mysql_fetch_row($result))
{
list ($startyear, $startmonth, $startday) = split ('-', $row[2]);
list ($endyear, $endmonth, $endday) = split ('-', $row[3]);
list ($openyear, $openmonth, $openday) = split ('-', $row[4]);
print <<
$row[0] $row[1] |
$startmonth/$startday/$startyear |
$endmonth/$endday/$endyear |
$openmonth/$openday/$openyear |
Delete |
END;
}
?>
CURRENT |
From |
To |
Reservation starts |
|
$query = "SELECT Semester, Year, StartDate, EndDate, OpenDate from SR_semester WHERE EndDate >= CURDATE()";
$result = mysql_query($query, $connection) or die ("Error in query: $query. " . mysql_error());
$i = mysql_num_rows($result);
while ($row = mysql_fetch_row($result))
{
list ($startyear, $startmonth, $startday) = split ('-', $row[2]);
list ($endyear, $endmonth, $endday) = split ('-', $row[3]);
list ($openyear, $openmonth, $openday) = split ('-', $row[4]);
print <<
$row[0] $row[1] |
$startmonth/$startday/$startyear |
$endmonth/$endday/$endyear |
$openmonth/$openday/$openyear |
|
END;
}
?>
if ($i<2)
{
$today = getdate();
$thisyear = $today['year'];
$nextyear = $thisyear + 1;
print <<
END;
}
print <<
|
Add |
Room No. |
Title |
Description |
Status |
END;
$query = "SELECT RoomNo, Title, Description, Status from SR_room";
$result = mysql_query($query, $connection) or die ("Error in query: $query. " . mysql_error());
while ($row = mysql_fetch_row($result))
{
if ($row[3] == '1'){$rstatus = 'Enabled';}
else {$rstatus = 'Disabled';}
print <<
Edit |
Delete |
$row[0] |
$row[1] |
$row[2] |
$rstatus |
END;
}
print <<
Add |
Department |
Number of Instructors |
Report |
END;
$query = "SELECT Department from SR_department";
$result1 = mysql_query($query, $connection) or die ("Error in query: $query. " . mysql_error());
while ($row1 = mysql_fetch_row($result1))
{
$query = "SELECT count(*) from SR_instructor where SR_instructor.Department='$row1[0]'";
$result = mysql_query($query, $connection) or die ("Error in query: $query. " . mysql_error());
$row = mysql_fetch_row($result);
print <<
Delete |
$row1[0] |
$row[0] |
 |
END;
}
$query = "SELECT count(*) from SR_instructor";
$result = mysql_query($query, $connection) or die ("Error in query: $query. " . mysql_error());
$row = mysql_fetch_row($result);
print <<
 |
Total: |
$row[0] |
 |
END;
?>