-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuser.php
70 lines (65 loc) · 1.73 KB
/
user.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
<?php
session_start();
if (isset($_SESSION['role']) && isset($_SESSION['id']) && $_SESSION['role'] == "admin") {
include "DB_connection.php";
include "app/Model/User.php";
$users = get_all_users($conn);
?>
<!DOCTYPE html>
<html>
<head>
<title>Manage Users</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="css/style.css">
</head>
<body>
<input type="checkbox" id="checkbox">
<?php include "inc/header.php" ?>
<div class="body">
<?php include "inc/nav.php" ?>
<section class="section-1">
<h4 class="title">Manage Users <a href="add-user.php">Add User</a></h4>
<?php if (isset($_GET['success'])) {?>
<div class="success" role="alert">
<?php echo stripcslashes($_GET['success']); ?>
</div>
<?php } ?>
<?php if ($users != 0) { ?>
<table class="main-table">
<tr>
<th>#</th>
<th>Full Name</th>
<th>Username</th>
<th>role</th>
<th>Action</th>
</tr>
<?php $i=0; foreach ($users as $user) { ?>
<tr>
<td><?=++$i?></td>
<td><?=$user['full_name']?></td>
<td><?=$user['username']?></td>
<td><?=$user['role']?></td>
<td>
<a href="edit-user.php?id=<?=$user['id']?>" class="edit-btn">Edit</a>
<a href="delete-user.php?id=<?=$user['id']?>" class="delete-btn">Delete</a>
</td>
</tr>
<?php } ?>
</table>
<?php }else { ?>
<h3>Empty</h3>
<?php }?>
</section>
</div>
<script type="text/javascript">
var active = document.querySelector("#navList li:nth-child(2)");
active.classList.add("active");
</script>
</body>
</html>
<?php }else{
$em = "First login";
header("Location: login.php?error=$em");
exit();
}
?>