-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdashboard.php
More file actions
57 lines (53 loc) · 2.03 KB
/
Copy pathdashboard.php
File metadata and controls
57 lines (53 loc) · 2.03 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
<?php
require_once "header.php";
$con = new connectionmodel();
$con->getconnection();
$result = $con->getAllUsers();
if (!$con->checkAdmin()) {
echo '
<div class="alert alert-danger" role="alert">
YOU ARE NOT AUTHORIZED TO BE HERE
</div>
<a href="./main.php" class="btn btn-primary m-2">Go back to homepage</a>
';
} else {
?>
<a href="./main.php" class="btn btn-primary m-2">Go back to homepage</a>
<table class="table table-striped">
<thead>
<tr>
<th scope="col">ID</th>
<th scope="col">Username</th>
<th scope="col">Password</th>
<th scope="col">Control</th>
</tr>
</thead>
<tbody>
<?php foreach ($result as $row) {?>
<tr>
<th scope="row"><?php echo $row[0] ?></th>
<td><?php echo $row[1] ?></td>
<td><?php echo (isset($_POST['showpass'])) ? $con->showPassword($row[3]) : $row[2] ?></td>
<td>
<button type="button" class="btn btn-primary" name="showpass" data-bs-toggle="modal" data-bs-target="<?php echo "#showpass". $row[0] ?>">Show</button>
</td>
</tr>
<div class="modal fade" id="<?php echo "showpass" . $row[0] ?>" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel"><?php echo $row[1] ?> Site Password</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<?php echo $con->showPassword($row[2]) ?>
</div>
</div>
</div>
</div>
<?php } ?>
</tbody>
</table>
<?php
}
require_once "footer.php" ?>