forked from mjdalton/Project-Butler
-
Notifications
You must be signed in to change notification settings - Fork 0
/
exam3.php
116 lines (95 loc) · 3.57 KB
/
exam3.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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
<?php
include_once 'header.php';
include_once 'includes/dbh-inc.php'; //connection to the database
?>
<?php
if (!isset($_SESSION['u_id'])) {
echo "<h2>WARNING: Your data will not be saved unless you login</h2><br><br><br>";
}
?>
<center>
<h3>Question 1</h3><br>
<a href = "Exam3Pages/Q1.php"><img src="Exam3/Q1.png" alt="Question 1" class="imgLink"></a><br><br>
<?php
//search to see if question number is answered
$qnum = 'Q1';
$test = 'exam3';
if(!isset($_SESSION[$test])){
$_SESSION[$test] = ''; //set answerholder to empty string if not set yet
}
$answerholder = $_SESSION[$test]; //get current answerholder variable
$pos = strpos($answerholder, ($qnum . ','));
//display solution if question is answered
if($pos !== false){
echo '<a href="Exam3/Solutions/Q1s.PNG"><button class="submitBtn">Solution</button></a>';
}
?><br><br>
<h3>Question 2</h3><br>
<a href = "Exam3Pages/Q2.php"><img src="Exam3/Q2.png" alt="Question 2" class="imgLink"></a><br><br>
<?php
//search to see if question number is answered
$qnum = 'Q2';
$test = 'exam3';
if(!isset($_SESSION[$test])){
$_SESSION[$test] = ''; //set answerholder to empty string if not set yet
}
$answerholder = $_SESSION[$test]; //get current answerholder variable
$pos = strpos($answerholder, ($qnum . ','));
//display solution if question is answered
if($pos !== false){
echo '<a href="Exam3/Solutions/Q2s.PNG"><button class="submitBtn">Solution</button></a>';
}
?><br><br>
<h3>Question 3</h3><br>
<a href = "Exam3Pages/Q3.php"><img src="Exam3/Q3.png" alt="Question 3" class="imgLink"></a><br><br>
<?php
//search to see if question number is answered
$qnum = 'Q3';
$test = 'exam3';
if(!isset($_SESSION[$test])){
$_SESSION[$test] = ''; //set answerholder to empty string if not set yet
}
$answerholder = $_SESSION[$test]; //get current answerholder variable
$pos = strpos($answerholder, ($qnum . ','));
//display solution if question is answered
if($pos !== false){
echo '<a href="Exam3/Solutions/Q3s.PNG"><button class="submitBtn">Solution</button></a>';
}
?><br><br>
<h3>Question 4</h3><br>
<a href = "Exam3Pages/Q4.php"><img src="Exam3/Q4.png" alt="Question 4" class="imgLink"></a><br><br>
<?php
//search to see if question number is answered
$qnum = 'Q4';
$test = 'exam3';
if(!isset($_SESSION[$test])){
$_SESSION[$test] = ''; //set answerholder to empty string if not set yet
}
$answerholder = $_SESSION[$test]; //get current answerholder variable
$pos = strpos($answerholder, ($qnum . ','));
//display solution if question is answered
if($pos !== false){
echo '<a href="Exam3/Solutions/Q4s.PNG"><button class="submitBtn">Solution</button></a>';
}
?><br><br>
<h3>Question 5</h3><br>
<a href = "Exam3Pages/Q5.php"><img src="Exam3/Q5.png" alt="Question 5" class="imgLink"></a><br><br>
<?php
//search to see if question number is answered
$qnum = 'Q5';
$test = 'exam3';
if(!isset($_SESSION[$test])){
$_SESSION[$test] = ''; //set answerholder to empty string if not set yet
}
$answerholder = $_SESSION[$test]; //get current answerholder variable
$pos = strpos($answerholder, ($qnum . ','));
//display solution if question is answered
if($pos !== false){
echo '<a href="Exam3/Solutions/Q5s.PNG"><button class="submitBtn">Solution</button></a>';
}
?><br><br>
</center>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
<?php
include_once 'footer.php';
?>