-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathreview.php
More file actions
124 lines (110 loc) · 4.42 KB
/
review.php
File metadata and controls
124 lines (110 loc) · 4.42 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
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
117
118
119
120
121
122
123
124
<?php
session_start();
extract($_POST);
extract($_SESSION);
include("database.php");
//echo "<h1>Review Test</h1>";
if(isset($_POST['Finish']))
{
echo "hello";
mysqli_query($con,"delete from mst_useranswer where sess_id='".session_id()."'");
unset($_SESSION['qn']);
//header("location:index.php");
echo "<script type='text/javascript'> window.location='index.php' </script>";
exit;
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Review Questions</title>
<!--Import Google Icon Font-->
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<!--Import materialize.css-->
<link type="text/css" rel="stylesheet" href="css/materialize.min.css" media="screen,projection"/>
<!--Let browser know website is optimized for mobile-->
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
</head>
<body bgcolor="#c1e4fa">
<!--Import jQuery before materialize.js-->
<script type="text/javascript" src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
<script type="text/javascript" src="js/materialize.min.js"></script>
<?php
echo "<center><h2 style='display: inline;'><font color=purple>Review Test</font></h1></center>";
if(!isset($_SESSION['qn']))
{
$_SESSION['qn']=0;
}
else if($submit=='Next Question')
{
$_SESSION['qn'] = $_SESSION['qn']+1;
}
else if($submit=='Finish')
{
//echo "hi";
mysqli_query($con,"delete from mst_useranswer where sess_id='".session_id()."'");
unset($_SESSION['qn']);
//header("location:index.php");
echo "<script type='text/javascript'> window.location='login.php' </script>";
exit;
}
$sql=mysqli_query($con,"select * from mst_useranswer where sess_id='".session_id()."'") or die(mysqli_error());
mysqli_data_seek($sql,$_SESSION['qn']);
$row = mysqli_fetch_row($sql);
echo "<form action='review.php' method='post' style='margin-top: 20px; margin-left: 400px; '>";
echo "<table align='center'>";
//$n = $_SESSION['qn']+1;
//echo "<tr><td><font color=red><b>Que : ".$n." $row[2]</b></font></td></tr>";
echo "<tr><td><h4 style='display: inline;'><font color=red><b>Que : $row[2]</b></font></h2></td></tr>";
echo "<tr><td><h5 style='display: inline;'><font color=blue><b>1. $row[3]</b></font></h3></td></tr>";
echo "<tr><td><h5 style='display: inline;'><font color=blue><b>2. $row[4]</b></font></h3></td></tr>";
echo "<tr><td><h5 style='display: inline;'><font color=blue><b>3. $row[5]</b></font></h3></td></tr>";
echo "<tr><td><h5 style='display: inline;'><font color=blue><b>4. $row[6]</b></font></h3></td></tr>";
if($row[8]==0)
{
echo "<tr><td><h5><font color=brown><b>You Skipped this Question </b></font></h3></td></tr>";
echo "<tr><td><h5><font color=green><b>Correct answer is option : $row[7] </b></font></h3></td></tr>";
}
else
{
echo "<tr><td><h5><font color=brown><b>Your answer is option : $row[8] </b></font></h3></td></tr>";
echo "<tr><td><h5><font color=green><b>Correct answer is option : $row[7] </b></font></h3></td></tr>";
}
/*if($row[7]==$row[8])
{
$result=mysqli_query($con,"select * from correctimage");
if(mysqli_num_rows($result)>0)
{
while($row=mysqli_fetch_array($result))
{
//echo "<tr><td><img height='50' width='50' src='correctimagedisplay.php? id=".$row['id']."'></td></tr>";
echo '<tr><td><img height=50 width=50 src="data:image/png;base64,'.base64_encode( $row['image'] ).'"/></td></tr>';
}
}
}*/
/*else
{
$result=mysqli_query($con,"select * from wrongimage");
if(mysqli_num_rows($result)>0)
{
while($row=mysqli_fetch_array($result))
{
//echo "<tr><td><img height='50' width='50' src='wrongimagedisplay.php? id=".$row['id']."'></td></tr>";
echo '<tr><td><img height=50 width=50 src="data:image/png;base64,'.base64_encode( $row['image'] ).'"/></td></tr>';
}
}
}*/
if($_SESSION['qn']<mysqli_num_rows($sql)-1)
{
echo "<tr><td><button class='btn waves-effect waves-light' name='submit' value='Next Question'>Next Question</button></td></tr>";
}
else
{
echo "<tr><td><button class='btn waves-effect waves-light' name=submit value='Finish'>Finish</button></td></tr>";
}
echo "</table>";
echo "</form>";
?>
</body>
</html>