quartznet-info/admin/users.php

61 lines
1.4 KiB
PHP

<?php require_once("./auth.php"); auth();
// Select all users
$connection = connect();
$sql = "SELECT * FROM users";
$result = pg_query($connection, $sql);
if (!result)
{
die("pg_query error: " . pg_last_error($db));
}
$rows = pg_num_rows($result);
?>
<!DOCTYPE html>
<html lang="en">
<title>Quartznet | Users</title>
<?php include "../includes/head.php" ?>
<?php include "../includes/header.php" ?>
<main class="container">
<section class="content">
<!-- Should this still use tables -->
<table width="100%">
<thead>
<tr>
<th>Id</th>
<th>Name</th>
<th>Password</th>
</tr>
</thead>
<tbody>
<!-- User info --->
<?php while($row=pg_fetch_assoc($result)) { ?>
<tr>
<td><?php echo $row["id"]?></td>
<td><?php echo $row["name"]?></td>
<td><?php echo $row["password"]?></td>
<?php } ?>
</tr>
</tbody>
</table>
<!--Insert new user-->
<form method="post" action="users.php" name="login">
<div class="form-group">
<input name="username" type="text" required placeholder="username" maxlength="30">
<input name="password" type="password" required placeholder="password" maxlength="30">
</div>
</form>
</section>
</main>
<?php include "../includes/footer.php" ?>
</html>