-
Notifications
You must be signed in to change notification settings - Fork 0
/
controlAccountsUsers.php
126 lines (112 loc) · 4.01 KB
/
controlAccountsUsers.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
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
<?php
include_once("includes/functions.php");
if (isLogged() !== 2) {
header("Location: index.php ");
}
$limit = 10;
if (isset($_GET["page"])) {
$page = $_GET["page"];
} else {
$page = 1;
};
$start_from = ($page - 1) * $limit;
?>
<!DOCTYPE html>
<head>
<title>nstumart</title>
<link rel="shortcut icon" type="image/png" sizes="32x32" href="img/favicon-32x32.png">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.1.1/css/all.min.css" integrity="sha512-KfkfwYDsLkIlwQp6LFnl8zNdLGxu9YAA1QvwINks4PhcElQSvqcyVLLD9aMhXd13uQjoXtEKNosOWaZqXgel0g==" crossorigin="anonymous" referrerpolicy="no-referrer" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/ionicons/2.0.1/css/ionicons.min.css">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<link rel="shortcut icon" type="image/png" sizes="32x32" href="img/favicon-32x32.png">
<link rel="stylesheet" type="text/css" href="assets/css/bootstrap.min.css" />
<link rel="stylesheet" type="text/css" href="assets/css/style.css" />
<script>
function getareas(cid) {
$(document).ready(function() {
$.get("getAreas.php?cid=" + cid, function(data, status) {
$("#areaDiv").html(data);
});
});
}
</script>
</head>
<body>
<?php
drawHeader();
?>
<div class="container">
<h2 class="m-3">Users Account </h2>
<table class="table table-striped table-bordered">
<thead>
<tr>
<th>UserID</th>
<th>UserName</th>
<th>Email</th>
<th>Phone</th>
<th>Status</th>
</tr>
</thead>
<tbody>
<?php
$result = mysqli_query($clink, "SELECT * FROM `users` ORDER BY `users`.`UserID` ASC ");
if (mysqli_num_rows($result) > 1) {
//Show them
while ($row = mysqli_fetch_array($result)) {
echo "<tr '>
<td>{$row['UserID']}</td>
<td>{$row['UserName']}</td>
<td>{$row['Email']}</td>
<td>{$row['Phone']}</td>
<td> ";
if ($row['Status'] == 1) {
echo "<a href='usershoworhide.php?UserID={$row['UserID']}' class='btn btn-danger ml-2 ' >Deactivate<a>";
} else if ($row['Status'] == 0) {
echo "<a href='usershoworhide.php?UserID={$row['UserID']}' class='btn btn-primary ml-2 ' >Activate<a>";
}
echo "</td> </tr>";
}
} else {
outputMessage("No Account Users found in our Database", 'warning');
}
?>
</tbody>
</table>
</div>
<?php
global $clink;
$result_db = mysqli_query($clink, "SELECT COUNT(UserID) FROM users");
$row_db = mysqli_fetch_row($result_db);
$total_records = $row_db[0];
$total_pages = ceil($total_records / $limit);
/* echo $total_pages; */
echo '<ul style="margin-top: 50px;position:relative;z-index:1;" class="pagination justify-content-center">';
if ($page > 1) {
echo '<li class="page-item ">
<a class="page-link" href="controlAccountsUsers.php?page=' . ($page - 1) . '">Previous</a>
</li>';
}
for ($i = 1; $i <= $total_pages; $i++) {
if ($i == $page) {
$active = "active";
} else {
$active = "";
}
echo '<li class="page-item ' . $active . ' ">
<a class="page-link" href="controlAccountsUsers.php?page=' . $i . '">' . $i . '</a>
</li>';
}
if ($total_pages > $page) {
echo '<li class="page-item ' . $active . ' ">
<a class="page-link" href="controlAccountsUsers.php?page=' . ($page + 1) . '">Next</a>
</li>';
}
echo '</ul>';
?>
<?php
include_once("footer.php");
?>
<script type="text/javascript" src="assets/js/jquery-3.3.1.min.js"></script>
<script type="text/javascript" src="assets/js/bootstrap.min.js"></script>
</body>
</html>