-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathaccount_management.php
More file actions
46 lines (46 loc) · 1.12 KB
/
account_management.php
File metadata and controls
46 lines (46 loc) · 1.12 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
<?php require_once("header.php"); ?>
<h1>帳號管理</h1>
<?php
if(isset($_SESSION['isAuth']) && $_SESSION['isAdmin'])
{
require_once("db.php");
$sql = "SELECT * FROM User";
$users = $db->prepare($sql);
$users->execute();
?>
<table style="width:500px">
<tr>
<td> account </td>
<td> identity </td>
</tr>
<?php
while($user = $users->fetchObject())
{
?>
<tr>
<td> <?= $user->account ?> </td>
<td> <?= ($user->is_admin ? "admin" : "user") ?> </td>
<form action="edit_user_func.php" method="post">
<input type="hidden" name="id" value="<?= $user->id ?>">
<td><?php if(!$user->is_admin) { ?> <button type="submit"> 更改權限 </button><?php } ?></td>
</form>
<form action="delete_user_func.php" method="post">
<input type="hidden" name="id" value="<?= $user->id ?>">
<td> <button type="submit"> 刪除 </button></td>
</form>
</tr>
<?php } ?>
</table>
<a href="add_user.php"> <button type="button">新增</button></a>
<?php
} else if(isset($_SESSION['isAuth'])){
?>
permission denied
<?php
} else {
?>
please login first
<?php
}
?>
<?php require_once("footer.php"); ?>