This repository has been archived by the owner on Apr 11, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
users.php
69 lines (63 loc) · 2.01 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
<!DOCTYPE html>
<html>
<head>
<?php
session_start();
include_once('template/scripts.html');
require_once('includes/dbconf.php');
if ($_SESSION["ua_isLoggedIn"]) {
$session_userId = $_SESSION["ua_userId"];
$check_exists = pg_query($db,
"SELECT userid FROM users WHERE userid='$session_userId' AND isadmin = true;");
if (pg_num_rows($check_exists) < 1) {
header("Location: index.php?status=not_admin");
}
}
else {
header("Location: index.php?status=not_admin");
}
?>
</head>
<body>
<?php include_once('template/navbar.php'); ?>
<div class="container">
<div class="row">
<div class="col-lg-12"></div>
</div>
</div>
<div class="container">
<div class="row">
<div class="col-lg-12">
<h1 class="display-4">Users</h1>
<hr/>
<?php
$result = pg_query($db, "SELECT * FROM users"); // Query template
$rows = pg_fetch_all($result); // To store the result row
$num_rows = pg_num_rows($result);
// echo $num_rows . " row(s) returned.\n";
echo "<table class='table table-hover' border='1'> <thead class='thead-light'>
<tr>
<th scope='col'>userID</th>
<th scope='col'>name</th>
<th scope='col'>email</th>
</tr> </thead>";
echo "<tbody>";
$i = 0;
while($row = $rows[$i]) {
echo "<tr>";
echo "<td>" . $row['userid'] . "</td>";
echo "<td>" . $row['name'] . "</td>";
echo "<td>" . $row['email'] . "</td>";
echo "</tr>";
$i++;
}
echo "</tbody>";
echo "</table>";
?>
</div>
</div>
</div>
<?php include_once('template/footer.html'); ?>
</body>
<?php include_once('template/end_scripts.html'); ?>
</html>