-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcourse.php
33 lines (28 loc) · 814 Bytes
/
course.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?php
require("superinclude.php");
require_login();
if(!isset($_GET["courseid"])) error("Missing course id");
print_r($_GET);
$pg = $GLOBALS['pg'];
$eCID = pg_escape_literal($_GET["courseid"]);
$result = pg_query($pg, "SELECT coursename FROM db.course WHERE courseid=$eCID");
if(!$result) die("Database error");
$row = pg_fetch_row($result);
if($row === false) error("Bad course ID");
$courseName = $row[0];
?>
<html>
<head>
<title>LMS <?php echo $courseName; ?></title>
</head>
<body>
<?php print_r($_SESSION); ?>
<h1><?php echo $courseName; ?> <a href="logout.php">log out</a></h1>
<?php
$result = pg_query($pg, "SELECT assignmentname, assignmenttext, assignmentid, visible FROM db.assignment WHERE courseid=$eCID");
while($row = pg_fetch_row($result)) {
print_r($row);
}
?>
</body>
</html>