-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathadmin.php
More file actions
80 lines (69 loc) · 1.97 KB
/
Copy pathadmin.php
File metadata and controls
80 lines (69 loc) · 1.97 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
73
74
75
76
77
78
79
<?php
include 'session.php';
include 'config.php';
?>
<!DOCTYPE html>
<html>
<head>
<style>
h1 {text-align: center;}
</style>
<title>Admin</title>
</head>
<body>
<?php
// include the menu and page header
include './menu.php';
include './header.php';
// Are we high enough level ?
if ( !isset($_SESSION['login_user']) ) {
header("location: ./logout.php");
echo '<p>Not logged in</p>';
}
else {
if ($_SESSION['level'] > 9) {
// Then show the forms
?>
<br><br>
<p><form action="./adduser.php" method="post">
<center>
<h3>Create new user</h3>
<table>
<tr><td>email:</td><td><input type="text" name="emailaddr" required></td></tr>
<tr><td>password:</td><td><input type="password" name="password" required></td></tr>
</table>
<input type="submit" value="submit" name="submit"><br>
</center>
</form></p>
<hr width="50%" />
<?php
// List users
$sql = "SELECT * FROM users ORDER BY id;";
if ($result = mysqli_query($con,$sql)) {
echo '<center><p><h3>Edit user</h3></p><p><table><tr>';
echo '<th>id</th><th>username</th><th>password</th><th>level</th><th>delete</th><th>edit</th></tr><tr>';
while ( $row = $result->fetch_assoc()) {
echo '<tr><td align="right">';
echo $row['id'];
echo '</td><td>';
echo $row['username'];
echo '</td><td align="center">';
echo '<a href="">set</a>';
echo '</td><td align="right">';
echo $row['lvl'];
echo '</td><td align="center">';
echo '<a href="./deluser.php?val=';
//echo '"';
echo $row['id'];
//echo '"';
echo '">del</a>';
echo '</td><td align="center">';
echo '<a href="">ed</a>';
echo '</td></tr>';
}
echo '</table><p></center>';
}
}
}
include 'footer.php';
?>