-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathusers.php
More file actions
72 lines (58 loc) · 2.04 KB
/
Copy pathusers.php
File metadata and controls
72 lines (58 loc) · 2.04 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="homepage.css">
<title>User</title>
</head>
<body>
<h1>User</h1>
<?php
require("connector.php");
?>
<div class="table-container">
<table border="1px">
<th>User ID</th>
<th>Username</th>
<th>Email</th>
<th>Password</th>
<th>Role</th>
<th>Action</th>
<?php
$db = new DBConnection;
$users = $db->getAllUsers();
foreach ($users as $row) {
echo "<tr>";
echo "<td>" . $row["user_id"] . "</td>";
echo "<td>" . $row["user_name"] . "</td>";
echo "<td>" . $row["email"] . "</td>";
echo "<td>" . $row["password"] . "</td>";
echo "<td>" . $row["role"] . "</td>";
echo "<td>
<a class='edit-btn' href='edit_user.php?id=" . $row["user_id"] . "'>Edit</a>
<a class='delete-btn' href='delete_user.php?id=" . $row["user_id"] . "'>Delete</a>
</td>";
echo "</tr>";
}
?>
</table>
</div>
<h2>Add New User</h2>
<form action="add_user_process.php" method="post">
<label for="user_name">Username:</label><br>
<input type="text" id="user_name" name="user_name"><br>
<label for="email">Email:</label><br>
<input type="text" id="email" name="email"><br>
<label for="password">Password:</label><br>
<input type="text" id="password" name="password"><br>
<label for="role">Role :</label><br>
<select id="role" name="role">
<option value="-">------</option>
<option value="admin">Admin</option>
</select>
<br><br>
<input type="submit" value="Add User">
</form>
</body>
</html>