-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuser.php
More file actions
109 lines (82 loc) · 2.99 KB
/
Copy pathuser.php
File metadata and controls
109 lines (82 loc) · 2.99 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
<!-- Include Head -->
<?php include "assest/head.php"; ?>
<?php
// Check if the admin is already logged in, if yes then redirect him to home page
if (!$loggedin) {
header("location: index.php");
exit;
}
$OUT_STRING = array("0"=>"user", "1"=>"admin");
$stmt = $conn->prepare("SELECT * FROM users");
$stmt->execute();
$users = $stmt->fetchAll();
$hashedpassword = password_hash("abcd", PASSWORD_BCRYPT);
$test = password_verify("abcd", $hashedpassword);
// echo $test;
?>
<title>All User</title>
<link type="text/css" rel="stylesheet" href="css/style.css" />
<style>
.fa-twitter,
.fa-github,
.fa-linkedin-square {
font-size: 2.3rem;
}
</style>
</head>
<body>
<!-- Header -->
<?php include "assest/header.php" ?>
<!-- </Header> -->
<!-- Main -->
<main role="main" class="main">
<div class="jumbotron text-center mb-0">
<h1 class="display-3 font-weight-normal text-muted">All Users</h1>
</div>
<div class="bg-white py-3 px-5">
<div class="row">
<div class="col-lg-12 text-center mb-3">
<a class="btn btn-info" href="add_admin.php">Add User/Admin</a>
</div>
</div>
<div class="row">
<table class='table table-striped table-bordered'>
<thead class='thead-dark'>
<tr>
<th scope='col'>Name</th>
<th scope='col'>Email</th>
<th scope='col'>UserType</th>
<th scope='col' colspan="2">Actions</th>
</tr>
</thead>
<tbody>
<?php
foreach ($users as $user) :
echo "<tr>";
?>
<td><?= $user['username'] ?></td>
<td><?= $user['email'] ?></td>
<td><?= $OUT_STRING[$user['userlevel']] ?></td>
<td>
<a class="btn btn-success" href="update_user.php?id=<?= $user['id'] ?>">
<i class="fa fa-pencil " aria-hidden="true"></i>
</a>
</td>
<td>
<a class="btn btn-danger" href="assest/delete.php?type=users&id=<?= $user['id'] ?>">
<i class="fa fa-trash " aria-hidden="true"></i>
</a>
</td>
<?php
echo "</tr>";
endforeach;
?>
</tbody>
</table>
</div>
</div>
</main><!-- </Main> -->
<!-- Footer -->
<!-- <?php include "assest/footer.php" ?> -->
</body>
</html>