-
Notifications
You must be signed in to change notification settings - Fork 8
/
proofreader.php
71 lines (69 loc) · 2.13 KB
/
proofreader.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
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
70
71
<?php
require_once("initdb.php");
$erlist = '';
// redirect for unauthorised access
if (!isset($_SESSION['type']) || $_SESSION['type'] != "PR")
_exit("You do not have access to this page");
if (isset($_POST['prsubmit']) && $_POST['event']) {
$_SESSION['ecode'] = $_POST['event'];
header("Location: manager.php");
_exit();
} else if (isset($_POST['ersubmit']) && $_POST['event']) {
$erlist = $_POST['event'];
}
if (isset($_SESSION['ecode'])) {
header("Location: manager.php");
_exit();
}
?>
<!DOCTYPE html>
<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title>CMS: Proofreaders Corner</title>
<link rel="shortcut icon" href="taticon.png" type="image/png"/>
<style>
html
{
background-color:#F39C12;
}
</style>
</head>
<body>
<div style="text-align:right"><a href="logout.php">Log out</a></div>
<form action="proofreader.php" method="post">
<select name="event">
<!-- populate the events options field with all event names from the EVENTS table in the database -->
<option value="">--events--</option>
<?php
$res = $mysqli->query("SELECT code, name FROM events");
while($row=$res->fetch_assoc()) {
if ($erlist == $row['code']) $erlname = $row['name'];
echo "<option value='$row[code]'>$row[name]</option>";
}
$res->free();
?>
</select>
<input name="prsubmit" type="submit" value="Proofread">
<input name="ersubmit" type="submit" value="Get Event Reg List">
</form>
<?php
// populating the event reg list from the database
if ($erlist) {
echo "<h3 style='margin:10px 0'>$erlname Registration List</h3>";
$res = $mysqli->query("SELECT e.team_id, e.tat_id, s.name as name, s.phone, s.email, c.name as clg FROM event_reg e INNER JOIN student_reg s ON e.tat_id=s.id INNER JOIN colleges c ON s.clg_id=c.id WHERE e.code='$erlist'");
?>
<table>
<tr><th>Team ID</th><th>ID</th><th>Name</th><th>Phone no.</th><th>eMail</th><th>College</th></tr>
<?php
while($row=$res->fetch_assoc())
echo "<tr><td>$row[team_id]</td><td>$row[tat_id]</td><td>$row[name]</td><td>$row[phone]</td><td>$row[email]</td><td>$row[clg]</td></tr>";
?>
</table>
<?php
$res->free();
}
$mysqli->close();
?>
</body>
</html>