-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathusers.php
80 lines (74 loc) · 2.04 KB
/
users.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
<?php
include_once('core.php');
if (!isset($_SESSION['userEmail'])) {
header('Location: /login.php');
}
if ($_SESSION['userRole'] !='admin') {
header('Location: /accessControl.php');
}
if (isset($_POST['del'])) {
$user = new UserController;
$user = $user->destroy($_POST['del']);
if ($user == true) {
$message = message(1, 'User deleted successfully!');
} else {
$message = message(0, 'You cannot delete admin!');
}
}
$users = new Model\User;
$users = $users->all('users');
$pageTitle = 'Users';
include 'header.php';
if (isset($message)) {
echo $message;
}
?>
<!-- Data Table area Start-->
<div class="data-table-area">
<div class="container">
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
<div class="data-table-list">
<div class="basic-tb-hd">
<h2>Users</h2>
</div>
<div class="table-responsive">
<table id="data-table-basic" class="table table-striped">
<thead>
<tr>
<th style="width: 50px;">#ID</th>
<th>Name</th>
<th>Email</th>
<th>Role</th>
<th style="width: 100px;">Action</th>
</tr>
</thead>
<tbody>
<?php foreach ($users as $user) { ?>
<tr>
<td><?php echo $user['id'];?></td>
<td><a href="user.php?id=<?php echo $user['id'];?>"><?php echo $user['name'];?></a></td>
<td><?php echo $user['email'];?></td>
<td><?php echo $user['role'];?></td>
<td>
<form method="post">
<a href="user.php?id=<?php echo $user['id'];?>" class="btn btn-default btn-icon-notika waves-effect"><i class="fa fa-pencil"></i></a>
<button name="del" value="<?php echo $user['id'];?>" class="btn btn-default btn-icon-notika waves-effect"><i class="fa fa-trash"></i></button>
</form>
</td>
</tr>
<?php } ?>
</tbody>
<tfoot>
<tr>
</tr>
</tfoot>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Data Table area End-->
<?php include 'footer.php'; ?>