-
Notifications
You must be signed in to change notification settings - Fork 0
/
account.php
128 lines (102 loc) · 3.39 KB
/
account.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
127
128
<?php
session_start();
if (!isset($_SESSION['loggedin'])) {
echo '<script>alert("You must sign in as an admin!")</script>';
header("refresh:0.1; url=sign_in.php");
exit();
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="css/style.css" type="text/css">
<title>Index</title>
<style>
table, th{
border: 1px solid black;
margin-left: 10%;
}
footer{
position: relative;
width: 100%;
background-color: rgb(172, 172, 172);
}
body{
font-size: 18px;
background-color: #e0f3ff;
}
input[type = "submit"]{
font-size: large;
background-color: #4CAF50;
border: none;
color: #ffffff;
height: 42px;
margin: 4px 2px;
cursor: pointer;
width : 140px;
text-align: center;
}
</style>
</head>
<body>
<header>
<div class="container_header">
<img src="https://i.ibb.co/vq7sysz/logo.png" alt="logo" class="logo">
<nav>
<ul>
<li><a href="account.php">Account</a></li>
<li><a href="cart.php">Cart</a></li>
<li><a href="product.php">Products</a></li>
<li><a href="event.php">Event</a></li>
<li><a href="sign_out.php">Sign Out</a>
</li>
</ul>
</nav>
</div>
</header>
<h1 align = "center">User Information</h1>
<?php
$conn = mysqli_connect("localhost", "root", "123456", "nozuonodie");
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$sql = "SELECT * FROM `account`";
$result = $conn->query($sql);
?>
<table style="width:80%">
<tr>
<th width="40%">User Email</th>
<th width="35%">Password</th>
<th></th>
</tr>
<?php
while ($row = $result->fetch_assoc()) {
echo "<tr>";
echo "<th>".$row['email']."</th>";
echo "<th>".$row['password']."</th>";
echo '<th>
<form style="float:left;" action = "edit_account.php" method="POST">
<input type = "hidden" name = "e" value = "'.$row['email'] .'">
<input type = "submit" value = "Edit">
</form>
<form style="float:left; margin-left: 3%;" action = "delete_account.php" method="POST">
<input type = "hidden" name = "e" value = "'.$row['email'] .'">
<input type = "submit" value = "Delete">
</form>
</th>';
echo "</tr>";
}
?>
</table>
<br><br><br><br><br><br>
<script src="js/script.js"></script>
<br>
<footer>
<img src="images/logo.png" alt="logo">
<p class="copyright">copyright © <script>document.write(new date().getfullyear())</script> all rights reserved</p>
</footer>
</body>
</html>