-
Notifications
You must be signed in to change notification settings - Fork 0
/
dashboard.php
273 lines (256 loc) · 15.1 KB
/
dashboard.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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
<?php
include_once 'database.php';
session_start();
if(!(isset($_SESSION['email'])))
{
header("location:login.php");
}
else
{
$name = $_SESSION['name'];
$email = $_SESSION['email'];
include_once 'database.php';
}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Dashboard | Online Quiz System</title>
<link rel="stylesheet" href="css/bootstrap.min.css"/>
<link rel="stylesheet" href="css/bootstrap-theme.min.css"/>
<link rel="stylesheet" href="css/welcome.css">
<link rel="stylesheet" href="css/font.css">
<script src="js/jquery.js" type="text/javascript"></script>
<script src="js/bootstrap.min.js" type="text/javascript"></script>
</head>
<style>
body
{
background: rgb(18, 19, 19);
}
.textad
{
color: white;
font-weight: bolder;
}
@media only screen and (max-width: 500px) {
#wave {
margin-top: 40% !important;
}
@media only screen and (min-width: 768px) {
#wave {
margin-top: 3% !important;
}
#wave2{
margin-bottom: 0% !important;
}
</style>
<body>
<nav class="navbar navbar-inverse navbar-fixed-top title1">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="Javascript:void(0)"><b> Quiz Club</b></a>
</div>
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav navbar-left">
<li <?php if(@$_GET['q']==0) echo'class="active"'; ?>><a href="dashboard.php?q=0">Home<span class="sr-only">(current)</span></a></li>
<li <?php if(@$_GET['q']==1) echo'class="active"'; ?>><a href="dashboard.php?q=1">User</a></li>
<li <?php if(@$_GET['q']==2) echo'class="active"'; ?>><a href="dashboard.php?q=2">Ranking</a></li>
<li class="dropdown <?php if(@$_GET['q']==4 || @$_GET['q']==5) echo'active"'; ?>">
<li><a href="dashboard.php?q=4">Add Quiz</a></li>
<li><a href="dashboard.php?q=5">Remove Quiz</a></li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li <?php echo''; ?> > <a href="logout1.php?q=dashboard.php"><span class="glyphicon glyphicon-log-out" aria-hidden="true"></span> Log out</a></li>
</ul>
</div>
</div>
</nav>
<div id="wave" class="wave" style="margin-top: 0%;">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1440 320">
<path fill="#f3f4f5" fill-opacity="1" d="M0,128L48,117.3C96,107,192,85,288,101.3C384,117,480,171,576,170.7C672,171,768,117,864,128C960,139,1056,213,1152,218.7C1248,224,1344,160,1392,128L1440,96L1440,0L1392,0C1344,0,1248,0,1152,0C1056,0,960,0,864,0C768,0,672,0,576,0C480,0,384,0,288,0C192,0,96,0,48,0L0,0Z"></path>
</svg>
</div>
<div class="container">
<div class="row">
<div class="col-md-12">
<?php if(@$_GET['q']==0)
{
echo '<span style="color:white;text-align:center;margin-left:100px; font-size:60px;">Welcome to Admin Panel!</span>';
}
if(@$_GET['q']== 2)
{
$q=mysqli_query($con,"SELECT * FROM rank ORDER BY score DESC " )or die('Error223');
echo '<div class="panel title"><div class="table-responsive">
<table class="table table-striped title1" >
<tr style="color:red"><td><center><b>Rank</b></center></td><td><center><b>Name</b></center></td><td><center><b>Score</b></center></td></tr>';
$c=0;
while($row=mysqli_fetch_array($q) )
{
$e=$row['email'];
$s=$row['score'];
$q12=mysqli_query($con,"SELECT * FROM user WHERE email='$e' " )or die('Error231');
while($row=mysqli_fetch_array($q12) )
{
$name=$row['name'];
$college=$row['college'];
}
$c++;
echo '<tr><td style="color:#99cc32"><center><b>'.$c.'</b></center></td><td><center>'.$e.'</center></td><td><center>'.$s.'</center></td>';
}
echo '</table></div></div>';
}
?>
<?php
if(@$_GET['q']==1)
{
$result = mysqli_query($con,"SELECT * FROM user") or die('Error');
echo '<div class="panel"><div class="table-responsive"><table class="table table-striped title1">
<tr><td><center><b>S.N.</b></center></td><td><center><b>Name</b></center></td><td><center><b>College</b></center></td><td><center><b>Email</b></center></td><td><center><b>Action</b></center></td></tr>';
$c=1;
while($row = mysqli_fetch_array($result))
{
$name = $row['name'];
$email = $row['email'];
$college = $row['college'];
echo '<tr><td><center>'.$c++.'</center></td><td><center>'.$name.'</center></td><td><center>'.$college.'</center></td><td><center>'.$email.'</center></td><td><center><a title="Delete User" href="update.php?demail='.$email.'"><b><span class="glyphicon glyphicon-trash" aria-hidden="true"></span></b></a></center></td></tr>';
}
$c=0;
echo '</table></div></div>';
}
?>
<?php
if(@$_GET['q']==4 && !(@$_GET['step']) )
{
echo '<div class="row"><span class="title1" style="margin-left:40%;font-size:30px;color:#fff;"><b>Enter Quiz Details</b></span><br /><br />
<div class="col-md-3"></div><div class="col-md-6">
<form class="form-horizontal title1" name="form" action="update.php?q=addquiz" method="POST">
<fieldset>
<div class="form-group">
<label class="col-md-12 control-label" for="name"></label>
<div class="col-md-12">
<input id="name" name="name" placeholder="Enter Quiz title" class="form-control input-md" type="text">
</div>
</div>
<div class="form-group">
<label class="col-md-12 control-label" for="total"></label>
<div class="col-md-12">
<input id="total" name="total" placeholder="Enter total number of questions" class="form-control input-md" type="number">
</div>
</div>
<div class="form-group">
<label class="col-md-12 control-label" for="right"></label>
<div class="col-md-12">
<input id="right" name="right" placeholder="Enter marks on right answer" class="form-control input-md" min="0" type="number">
</div>
</div>
<div class="form-group">
<label class="col-md-12 control-label" for="wrong"></label>
<div class="col-md-12">
<input id="wrong" name="wrong" placeholder="Enter minus marks on wrong answer without sign" class="form-control input-md" min="0" type="number">
</div>
</div>
<div class="form-group">
<label class="col-md-12 control-label" for=""></label>
<div class="col-md-12">
<input type="submit" style="margin-left:45%" class="btn btn-primary" value="Submit" class="btn btn-primary"/>
</div>
</div>
</fieldset>
</form></div>';
}
?>
<?php
if(@$_GET['q']==4 && (@$_GET['step'])==2 )
{
echo '
<div class="row">
<span class="title1" style="margin-left:40%;font-size:30px;"><b>Enter Question Details</b></span><br /><br />
<div class="col-md-3"></div><div class="col-md-6"><form class="form-horizontal title1" name="form" action="update.php?q=addqns&n='.@$_GET['n'].'&eid='.@$_GET['eid'].'&ch=4 " method="POST">
<fieldset>
';
for($i=1;$i<=@$_GET['n'];$i++)
{
echo '<b>Question number '.$i.' :</><br /><!-- Text input-->
<div class="form-group">
<label class="col-md-12 control-label" for="qns'.$i.' "></label>
<div class="col-md-12">
<textarea rows="3" cols="5" name="qns'.$i.'" class="form-control" placeholder="Write question number '.$i.' here..."></textarea>
</div>
</div>
<div class="form-group">
<label class="col-md-12 control-label" for="'.$i.'1"></label>
<div class="col-md-12">
<input id="'.$i.'1" name="'.$i.'1" placeholder="Enter option a" class="form-control input-md" type="text">
</div>
</div>
<div class="form-group">
<label class="col-md-12 control-label" for="'.$i.'2"></label>
<div class="col-md-12">
<input id="'.$i.'2" name="'.$i.'2" placeholder="Enter option b" class="form-control input-md" type="text">
</div>
</div>
<div class="form-group">
<label class="col-md-12 control-label" for="'.$i.'3"></label>
<div class="col-md-12">
<input id="'.$i.'3" name="'.$i.'3" placeholder="Enter option c" class="form-control input-md" type="text">
</div>
</div>
<div class="form-group">
<label class="col-md-12 control-label" for="'.$i.'4"></label>
<div class="col-md-12">
<input id="'.$i.'4" name="'.$i.'4" placeholder="Enter option d" class="form-control input-md" type="text">
</div>
</div>
<br />
<b>Correct answer</b>:<br />
<select id="ans'.$i.'" name="ans'.$i.'" placeholder="Choose correct answer " class="form-control input-md" >
<option value="a">Select answer for question '.$i.'</option>
<option value="a"> option a</option>
<option value="b"> option b</option>
<option value="c"> option c</option>
<option value="d"> option d</option> </select><br /><br />';
}
echo '<div class="form-group">
<label class="col-md-12 control-label" for=""></label>
<div class="col-md-12">
<input type="submit" style="margin-left:45%" class="btn btn-primary" value="Submit" class="btn btn-primary"/>
</div>
</div>
</fieldset>
</form></div>';
}
?>
<?php
if(@$_GET['q']==5)
{
$result = mysqli_query($con,"SELECT * FROM quiz ORDER BY date DESC") or die('Error');
echo '<div class="panel"><div class="table-responsive"><table class="table table-striped title1">
<tr><td><center><b>S.N.</b></center></td><td><center><b>Topic</b></center></td><td><center><b>Total question</b></center></td><td><center><b>Marks</b></center></td><td><center><b>Action</b></center></td></tr>';
$c=1;
while($row = mysqli_fetch_array($result)) {
$title = $row['title'];
$total = $row['total'];
$sahi = $row['sahi'];
$eid = $row['eid'];
echo '<tr><td><center>'.$c++.'</center></td><td><center>'.$title.'</center></td><td><center>'.$total.'</center></td><td><center>'.$sahi*$total.'</center></td>
<td><center><b><a href="update.php?q=rmquiz&eid='.$eid.'" class="pull-right btn sub1" style="margin:0px;background:red;color:black"><span class="glyphicon glyphicon-trash" aria-hidden="true"></span> <span class="title1"><b>Remove</b></span></a></b></center></td></tr>';
}
$c=0;
echo '</table></div></div>';
}
?>
</div>
</div>
</div>
</body>
</html>