-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathusers.php
70 lines (52 loc) · 1.55 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
<?php session_start(); ?>
<?php require_once('includes/connection.php'); ?>
<?php
// checking if a user is logged in
if (!isset($_SESSION['user_id'])) {
header('Location: index.php');
}
$userlist = '';
$query = "SELECT * FROM ums_tb WHERE is_deleted = 0 ORDER BY first_name";
$users = mysqli_query($connection, $query);
if($users){
while($user = mysqli_fetch_assoc($users)){
$userlist .="<tr>";
$userlist .="<td>".$user['first_name']."</td>";
$userlist .="<td>".$user['last_name']."</td>";
$userlist .="<td>".$user['last_login']."</td>";
$userlist .="<td>"." <a href=\"modify-user.php?user_id={$user['id']}\">Edit</a>" . "</td>";
$userlist .="<td>"." <a href=\"delete-user.php?user_id={$user['id']}\">Delete</a>" . "</td>";
$userlist .="</tr>";
}
}else{
echo "query is not successful.";
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Users</title>
<link rel="stylesheet" href="css/main.css">
</head>
<body>
<header>
<div class="appname">User Management System</div>
<div class="loggedin"> Welcome <?php echo $_SESSION['first_name']; ?>! <a href="logout.php">Log Out</a></div>
</header>
<main>
<h1><img src="img\Login.png" alt="" height="100px"> Users<span><a href="add-user.php">+Add_New</a></span></h1>
<table class="masterlist">
<tr>
<th>First_Name</th>
<th>Last_Name</th>
<th>Last_Login</th>
<th>Edit</th>
<th>Delete</th>
</tr>
<?php echo $userlist ;?>
</table>
</main>
<?php require_once('includes/footer.php');?>
</body>
</html>