-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathviewpatients.php
79 lines (60 loc) · 2.83 KB
/
viewpatients.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
<?php include "lib/header.php"; ?>
<?php session_start(); ?>
<?php
if (!isset($_SESSION['loggedin'])) {
header("Location:login.php");
}
?>
<div class="container-fluid">
<br><br>
<div class="row">
<div class="col-md-2" style="border-right:2px blue solid;">
<img src="img/cartoon.jpg" alt="" height="100" width="100" style="border-radius:50%;">
<br><br>
<ul style="list-style-type:none;">
<li><a href="viewstaff.php">View All Staff</a></li>
</ul>
</div>
<div class="col-md-1"></div>
<div class="col-md-6">
<h2 class="text-center text-primary">View All Patients</h2>
<table class="table table-striped">
<thead class="thead-dark">
<tr>
<th>Patient name</th>
<th>Registeration date</th>
</tr>
</thead>
<tbody>
<?php
$allUsers= scandir("db/users/");
$countAllUsers = count($allUsers);
for ($counter = 0; $counter < $countAllUsers; $counter++) {
$currentUser = $allUsers[$counter];
$userString = file_get_contents("db/users/" . $currentUser);
$userObject = json_decode($userString);
$first_name = $userObject->first_name;
$last_name = $userObject->last_name;
$full_name = $first_name . $last_name;
$reg_date = $userObject->reg_date;
$designation = $userObject->designation;
if ($designation == "Patient") { ?>
<tr>
<td scope="col"><?php echo $full_name ;?></td>
<td scope="col"><?php echo $reg_date ;?></td>
</tr>
<?php
}
}
?>
</tbody>
</table>
</div>
<div class="col-md-1"></div>
<div class="col-md-2" style="border-left:2px blue solid;">
<a href="logout.php" class="btn btn-primary">Logout</a>
</div>
</div>
</div>
</body>
</html>