-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathyears.php
More file actions
executable file
·69 lines (64 loc) · 2.12 KB
/
years.php
File metadata and controls
executable file
·69 lines (64 loc) · 2.12 KB
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<?php
session_start();
require_once "inc/database.inc.php";
if(isset($_SESSION['currentUser']) && $_SESSION['currentAccessLevel'] == 1) {} else {
header("Location:".dirname($_SERVER['PHP_SELF'])."/index.php");
exit;
}
?>
<!-- Marina Shchukina, 1014481
BEM methodology is behind all the html elements naming conventions
http://bem.info/method/
-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN" "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:og="http://opengraphprotocol.org/schema/" xml:lang="en-GB">
<head>
<link rel="stylesheet" type="text/css" href="css/main.css" />
</head>
<body>
<div id="textbooksApp-years">
<fieldset class="back">
<a href="courses.php" class="btn">< Back</a>
</fieldset>
<div class="innerWrapper">
<h1 class="tableTitle">Years</h1>
<!-- Table markup-->
<table class="databaseResults">
<!-- Table header -->
<thead>
<tr>
<th scope="col" class="wide" >Year</th>
</tr>
</thead>
<!-- Table body -->
<tbody>
<!-- Start of Sam Cussons code -->
<?php
try {
$courses = htmlentities($_GET['courses']);
$sql="SELECT *
FROM courses
WHERE courses.cid = \"". $courses . "\"
ORDER BY courses.title";
$stmt = $conn->prepare($sql);
if ($stmt->execute(array())) {
echo "<tr><td><a href=\"modules.php?courses=".$courses."&years=select-year\">All</a></td></tr>";
while ($row = $stmt->fetch()) {
for ($i=$row['startYear'] ; $i<=$row['duration']+$row['startYear']-1 ; $i++) {
echo "<tr><td><a href=\"modules.php?courses=".$courses."&years=".$i."\">".$i."</a></td></tr>";
}
}
}
} catch ( PDOException $e ) {
echo "Query failed: " . $e->getMessage();
}
$conn = null;
?>
<!-- End of Sam Cussons code -->
</tbody>
</table>
</div>
<?php include_once('inc/footer.inc.php'); ?>
</div>
</body>
</html>