-
Notifications
You must be signed in to change notification settings - Fork 45
/
adminpanel.php
411 lines (349 loc) · 14.3 KB
/
adminpanel.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
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
<?php
session_start();
if(!isset($_SESSION['useremail'])){
echo "Access denied";
}
else{
include('includes/conn.php');
$t= $_SESSION['useremail'];
$q = "SELECT * FROM admin where email = '$t' ";
$r = mysqli_query($con,$q);
while($row = mysqli_fetch_assoc($r)){
$name = $row['name'];
$type = $row['type'];
}
if(@$type == "admin"){
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<title><?php echo "Welcome $name to admin panel";?></title>
<!-- Bootstrap -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="theme/admin.css" rel="stylesheet">
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<style>
.nav-tabs>li.active>a, .nav-tabs>li.active>a:focus, .nav-tabs>li.active>a:hover{
background:#E90303;
color:white;
}
.nav-tabs>li>a{
color:black;
border-bottom:red;
}
.nav-tabs{
border-bottom:1px solid #E90303;
}
.tt td{
width:500px;
border:1px solid #005173;
padding:5px;
}
.tt th{
border:1px solid #005173;
padding:5px;
}
</style>
<body>
<div class="ad nav navbar-inverse navbar-top-fixed">
<button type="button" style="background:#E62C2C; border-color:#E62C2C;" class="navbar-toggle" data-toggle="collapse" data-target="#coo">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<div class="collapse navbar-collapse" id="coo">
<div class="row container">
<div class="col-md-2">
<img width="60px" class="img-responsive" id="ba" title="Doctor Patient Portal" src="img/logom.png"/>
</div>
<div class="col-md-3">
<a style="margin-top:2.2%;" class="br navbar-brand">Welcome <?php echo "$name";?></a>
</div>
<div class="col-md-offset-6">
<ul style="margin-top:1%;" align="center" class="nav navbar-nav">
<li class="la active"><a href="#"><span class="glyphicon glyphicon-info-sign"></span> Dashboard</a></li>
<li ><a href="index.php"><span class="glyphicon glyphicon-home"></span> Home</a></li>
<li ><a href="logout.php"><span class="glyphicon glyphicon-log-out"></span> Logout</a></li>
</ul>
</div>
<div class="col-md-offset-1">
<a style="margin-top:0.9%;" class="pull-right navbar-brand"><span style="color:white;" class="glyphicon glyphicon-user"></span> Admin Panel</a>
</div>
</div>
</div>
</div>
<div style="margin-top:0.2%;" class="container jumbotron">
<ul style="margin-top:-3%;" class="nav nav-tabs" role="tablist">
<li role="presentation" class="active"><a href="#static" aria-controls="home" role="tab" data-toggle="tab"><span class="glyphicon glyphicon-stats"></span> Site Statics</a></li>
<li role="presentation"><a href="#mdoc" aria-controls="mdoc" role="tab" data-toggle="tab"><span class="glyphicon glyphicon-cog"></span> Manage Doctors</a></li>
<li role="presentation"><a href="#verify" aria-controls="verify" role="tab" data-toggle="tab"><span class="glyphicon glyphicon-ok-circle"></span> Verify Doctor</a></li>
<li role="presentation"><a href="#patient" aria-controls="patient" role="tab" data-toggle="tab"><span class="glyphicon glyphicon-cog"></span> Manage Patients</a></li>
<li role="presentation"><a href="#feed" aria-controls="feed" role="tab" data-toggle="tab"><span class="glyphicon glyphicon-cog"></span> Manage Feedbacks</a></li>
</ul>
<div class="tab-content">
<div style="margin-top:1%;" role="tabpanel" class="tab-pane fade in active well" id="static">
<h2 style="margin-top:-0.5%;">Site Statics</h2>
<div class="row">
<div class="col-md-6">
<div class="panel panel-primary">
<div class="panel-heading"><span class="glyphicon glyphicon-signal"></span> User Statics</div>
<div class="panel-body">
<?php
$con = mysqli_connect("localhost", "root", "",'dpp');
$doccnt = mysqli_query($con,"SELECT COUNT(*) as cnt FROM doctor");
$res = mysqli_fetch_array($doccnt);
$doc = $res ['cnt'];
$docvr = mysqli_query($con,"SELECT COUNT(*) as cnt FROM doctor WHERE status='success'");
$res = mysqli_fetch_array($docvr);
$docv = $res ['cnt'];
$docunv = mysqli_query($con,"SELECT COUNT(*) as cnt FROM doctor WHERE status='fail'");
$res = mysqli_fetch_array($docunv);
$docuv = $res ['cnt'];
$patcnt = mysqli_query($con,"SELECT COUNT(*) as cnt FROM patient");
$res = mysqli_fetch_array($patcnt);
$pat = $res ['cnt'];
$total = $doc + $pat;
?>
<table width="400px" cellpadding="2" border="0">
<tr><td style="padding:5px;">Total Doctor Registered : </td><td style="padding:5px;"><span class="badge"><?php echo $doc;?></span></td></tr>
<tr><td style="padding:5px;">Verified Doctor Registered : </td><td style="padding:5px;"><span class="badge"><?php echo $docv;?></span></td></tr>
<tr><td style="padding:5px;">Unverified Doctor Registered :</td><td style="padding:5px;"> <span class="badge"><?php echo $docuv;?></span></td></tr>
<tr><td style="padding:5px;">Total Patient Registered : </td><td style="padding:5px;"> <span class="badge"><?php echo $pat;?></span></td></tr>
<tr><td style="padding:5px;">Total Registered : </td><td style="padding:5px;"> <span class="badge"><?php echo $total;?></span></td></tr>
</table>
</div>
</div>
</div>
<div class="col-md-6">
<div class="panel panel-primary">
<div class="panel-heading"><span class="glyphicon glyphicon-equalizer"></span> Appointment Statics</div>
<div class="panel-body">
<?php
$con = mysqli_connect("localhost", "root", "",'dpp');
$totalp = mysqli_query($con,"SELECT COUNT(*) as cnt FROM appointments where status='pending'");
$res = mysqli_fetch_array($totalp);
$pen = $res ['cnt'];
$totalca = mysqli_query($con,"SELECT COUNT(*) as cnt FROM appointments where status='Completed'");
$res = mysqli_fetch_array($totalca);
$com = $res ['cnt'];
$totalcan = mysqli_query($con,"SELECT COUNT(*) as cnt FROM appointments where status='Canceled'");
$res = mysqli_fetch_array($totalcan);
$can = $res ['cnt'];
$totalap = mysqli_query($con,"SELECT COUNT(*) as cnt FROM appointments");
$res = mysqli_fetch_array($totalap);
$ap = $res ['cnt'];
?>
<table width="400px" cellpadding="2" border="0">
<tr><td style="padding:5px;">Total Pending Appointments : </td><td style="padding:5px;"><span class="badge"><?php echo $pen;?></span></td></tr>
<tr><td style="padding:5px;">Total Completed Appointments : </td><td style="padding:5px;"><span class="badge"><?php echo $com;?></span></td></tr>
<tr><td style="padding:5px;">Total Canceled Appointments : </td><td style="padding:5px;"><span class="badge"><?php echo $can;?></span></td></tr>
<tr><td style="padding:5px;">Total Appointments :</td><td style="padding:5px;"> <span class="badge"><?php echo $ap;?></span></td></tr>
</table>
</div>
</div>
</div>
</div>
</div>
<div role="tabpanel" class="tab-pane fade" id="mdoc">
<br>
<table class="tt table-hover" border="1" cellspacing="0">
<tr>
<th width="15%" style="text-align:center; color:white; background:#E90303;">Profile pic</th>
<th width="10%" style="text-align:center; color:white; background:#E90303;">ID</th>
<th width="20%" style="text-align:center; color:white; background:#E90303;">Name</th>
<th width="20%" style="text-align:center; color:white; background:#E90303;">Email</th>
<th width="20%" style="text-align:center; color:white; background:#E90303;">Specialist in</th>
<th width="25%" style="text-align:center; color:white; background:#E90303;">Status</th>
<th style="text-align:center; color:white; background:#E90303;">Delete?</th>
</tr>
<?php
$sql = "SELECT * FROM doctor";
$r1= mysqli_query($con,$sql);
while($row = $r1->fetch_array())
{
$docid = $row['docid'];
?>
<tr >
<?php
$dir = "doctor/".$docid."/img/";
$open = opendir($dir);
while(($files = readdir($open)) != FALSE){
if($files!="."&&$files!=".."&&$files !="Thumbs.db"){
echo "<tr><center><td style='padding:5px' align='center'>
<img class='imgs2' width='50px' title='$docid' src='$dir/$files'></td></center>";
}
}
?>
<td style="text-align:center; "><?php echo $row['did']; ?></td>
<td style="text-align:center; "><?php echo $row['name'];?></td>
<td style="text-align:center; "><?php echo $row['email'];?></td>
<td style="text-align:center; "><?php echo $row['specialist'];?></td>
<td style="text-align:center; "><?php echo $row['status'];?></td>
<th style="text-align:center; "><a href="delete3.php?did=<?php echo $row['docid'];?>" onclick="return confirm('Are you sure want to delete?')">
<span class="glyphicon glyphicon-trash"></span></a></th></tr>
<?php
}
?>
</table>
</div>
<div role="tabpanel" class="tab-pane fade" id="verify">
<br>
<table class="tt table-hover" border="1" cellspacing="0">
<tr>
<th width="15%" style="text-align:center; color:white; background:#E90303;">Profile pic</th>
<th width="10%" style="text-align:center; color:white; background:#E90303;">ID</th>
<th width="20%" style="text-align:center; color:white; background:#E90303;">Name</th>
<th width="20%" style="text-align:center; color:white; background:#E90303;">Email</th>
<th width="20%" style="text-align:center; color:white; background:#E90303;">Specalist in</th>
<th width="35%" style="text-align:center; color:white; background:#E90303;">Docs Path</th>
<th style="text-align:center; color:white; background:#E90303;"> Verify? </th>
</tr>
<?php
$sql = "SELECT * FROM `doctor` WHERE `status`='fail'";
$r1= mysqli_query($con,$sql);
while($row = $r1->fetch_array())
{
$docid = $row['docid'];
?>
<tr >
<?php
$dir = "doctor/".$docid."/img/";
$open = opendir($dir);
while(($files = readdir($open)) != FALSE){
if($files!="."&&$files!=".."&&$files !="Thumbs.db"){
echo "<tr><center><td style='padding:5px' align='center'>
<img class='imgs2' width='50px' title='$docid' src='$dir/$files'></td></center>";
}
}
?>
<input type="hidden" name="did" value="<?php echo $row['did'];?>"/>
<td style="text-align:center; "><?php echo $row['did']; ?></td>
<td style="text-align:center; "><?php echo $row['name'];?></td>
<td style="text-align:center; "><?php echo $row['email'];?></td>
<td style="text-align:center; "><?php echo $row['specialist'];?></td>
<td style="text-align:center; "><?php echo $row['docs'];?></td>
<th style="text-align:center; "><a href="verify.php?did=<?php echo $row['did'];?>" onclick="return confirm('Are you sure want to verify?')">
<span style="font-size:25px; color:green;" class="glyphicon glyphicon-ok-circle"></span></a></th></tr>
<?php
}
?>
</table>
</div>
<div role="tabpanel" class="tab-pane fade" id="feed">
<br>
<table style="text-align:center;" align="center" class="tt table-hover" border="1" cellspacing="0">
<tr>
<th width="15%" style="text-align:center; color:white; background:#E90303;">S.No</th>
<th width="25%" style="text-align:center; color:white; background:#E90303;">Feedback To</th>
<th width="25%" style="text-align:center; color:white; background:#E90303;">Feedback From</th>
<th width="35%" style="text-align:center; color:white; background:#E90303;">Feedback</th>
<th style="text-align:center; color:white; background:#E90303;"> Delete? </th>
</tr>
<?php
$qu1 = "SELECT * FROM feedback";
$res1 = mysqli_query($con,$qu1);
$i=0;
while($row = mysqli_fetch_assoc($res1)){
$d = $row['did'];
$p= $row['pid'];
$i++;
$qu2 = "SELECT * FROM doctor WHERE did='$d' ";
$ru2 = mysqli_query($con,$qu2);
$qu3 = "SELECT * FROM patient WHERE pid='$p' ";
$ru3 = mysqli_query($con,$qu3);
while($rr1 = mysqli_fetch_assoc($ru3)){
$pname = $rr1['name'];
while($rr = mysqli_fetch_assoc($ru2)){
$dname = $rr['name'];
?>
<tr>
<td><?php echo $i;?></td>
<td><?php echo $dname;?></td>
<td><?php echo $pname;?></td>
<td><?php echo $row['feed'];?></td>
<td><form action="" method="POST">
<input type="hidden" name="getid" value="<?php echo $row['id'];?>"/>
<input type="submit" value="Delete" name="delf" class="btn btn-danger" onclick="return confirm('Delete Feedback?');"/>
</form>
</td>
<?php
}
}
}
?>
</table>
<?php
if(isset($_POST['delf'])){
$id = $_POST['getid'];
$q = "DELETE FROM feedback where id = '$id'";
if($r = mysqli_query($con,$q)){
echo '<script>';
echo 'alert("Feedback deleted");';
echo 'window.location.href="adminpanel.php"';
echo '</script>';
}
}
?>
</div>
<div role="tabpanel" class="tab-pane fade" id="patient">
<br>
<table class="tt table-hover" border="1" cellspacing="0">
<tr>
<th width="15%" style="text-align:center; color:white; background:#E90303;">Profile pic</th>
<th width="15%" style="text-align:center; color:white; background:#E90303;">ID</th>
<th width="35%" style="text-align:center; color:white; background:#E90303;">Name</th>
<th width="35%" style="text-align:center; color:white; background:#E90303;">Email</th>
<th style="text-align:center; color:white; background:#E90303;"> Delete? </th>
</tr>
<?php
$sql = "SELECT * FROM patient";
$r1= mysqli_query($con,$sql);
while($row = $r1->fetch_array())
{
$adr = $row['adharno'];
?>
<tr >
<?php
$dir = "patient/".$adr."/img/";
$open = opendir($dir);
while(($files = readdir($open)) != FALSE){
if($files!="."&&$files!=".."&&$files !="Thumbs.db"){
echo "<tr><center><td style='padding:5px' align='center'>
<img class='imgs2' width='50px' title='$adr' src='$dir/$files'></td></center>";
}
}
?>
<td style="text-align:center; "><?php echo $row['pid']; ?></td>
<td style="text-align:center; "><?php echo $row['name'];?></td>
<td style="text-align:center; "><?php echo $row['email'];?></td>
<th style="text-align:center; "><a href="delete2.php?pid=<?php echo $row['pid'];?>" onclick="return confirm('Are you sure want to delete?')">
<span class="glyphicon glyphicon-trash"></span></a></th></tr>
<?php
}
?>
</table>
</div>
</div><!--content of tabs end-->
</div>
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="js/bootstrap.min.js"></script>
</body>
</html>
<?php
}else{
echo "Access Denied";
}
}
?>