-
Notifications
You must be signed in to change notification settings - Fork 0
/
createPoolSuccess.php
44 lines (39 loc) · 1.49 KB
/
createPoolSuccess.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
<?php
include("cas.php");
include("database_connect.php");
$title = "QuizSplash: Class Administration";
// PREPARE THE TEMPLATE
$template = file_get_contents('./template.html');
// REPLACE THE TITLE
$template = str_replace('<!--XXXTITLEXXX-->', $title, $template);
// REPLACE INSTANCES OF USERNAME
$username = $_SESSION['user'];
$template = str_replace('<!--XXXUSERNAMEXXX-->', $username, $template);
// ADD ADMINISTRATION LINK TO TOPNAV IF ADMINISTRATOR
$sql_adminCheck = "SELECT *
FROM classes
WHERE (instructor = '".$username."')
OR (assistant = '".$username."')
ORDER BY expireDate DESC;";
$res_adminCheck = mysql_query($sql_adminCheck);
$cnt_adminCheck = mysql_num_rows($res_adminCheck);
$adminLink = "<li><a href =\"./classAdmin.php\">Administration</a></li>";
if ($cnt_adminCheck > 0) {
$template = str_replace('<!--XXXADMINISTRATIONXXX-->', $adminLink, $template);
}
// FIND THE SPLITPOINT
$splitpoint = strpos($template,'<!--XXXSPLITPOINTXXX-->');
// ECHO THE TOP BUN
echo substr($template, 0, $splitpoint);
// ECHO THE HEADER
echo "<h2>Successfully added a new pool!</h2>";
?>
<p>Your pool has been successfully added! Now you can either go add some questions to your pool, or go back to manage your class settings.</p>
<ul>
<li><a href="./listQuestionPools.php">Write new questions</a></li>
<li><a href="./classAdmin.php">Class administration</a></li>
</ul>
<?php
// ECHO THE BOTTOM BUN
echo substr($template, $splitpoint);
?>