<?php require_once("./auth.php"); auth(); ?>
<!DOCTYPE html>
<html lang="en">
<head>
  <title>Quartznet | Admin</title>

  <!-- General meta tags -->
  <meta charset="utf-8">
  <meta content='text/html; charset=utf-8' http-equiv='Content-Type'>
  <meta http-equiv='X-UA-Compatible' content='IE=edge'>
  <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  <meta name="description" content="A software and game studio.">
  <meta name="keywords" content="quartznet, software, games, tools"/>
  <meta name="author" content="quartznet"/>

  <!-- Open Graph tags -->
  <meta property="og:title" content="quartznet" />
  <meta property="og:description" content="We are software and game developers." />

  <!-- Load CSS -->
  <link rel="stylesheet" href="/quartznet/assets/css/bootstrap.min.css" defer>
  <link href="/quartznet/assets/css/stylesheet.css" rel="stylesheet">
  <link href="/quartznet/assets/css/themes.css" rel="stylesheet">

  <link href="https://fonts.googleapis.com/css2?family=Open+Sans&display=swap" rel="stylesheet">
  <link rel="icon" href="/quartznet/assets/favicon.ico">

  <!-- Load javascript -->
  <script src="/quartznet/assets/js/jquery-3.5.1.min.js" defer></script>
</head>

<body>
  <header>
    <div class="container">
      <nav class="navbar navbar-expand-md">
        <div class="navbar-collapse order-1 order-md-0 dual-collapse2">
          <ul class="navbar-nav mr-auto">
            <li><a href="/quartznet/">Quartznet</a></li>
            <li><a href="/quartznet/about">About</a></li>
            <li><a href="https://quartznet.info/sound">Sound</a></li>
            <li><a href="https://quartznet.info/status">Status</a></li>
            <li><a href="https://quartznet.info/git">Git</a></li>
            <li><a href="https://quartznet.info/sql">SQL</a></li>
          </ul>
        </div>
        <div class="navbar-collapse collapse w-100 order-3 dual-collapse2">
          <ul class="navbar-nav ml-auto">
          <li><a href="/quartznet/admin/logout.php">Logout</a></li>
          </ul>
        </div>
      </nav>
    </div>
    
    <div class="overlay">
      <div class="description">
        <h1 class="title">Quartznet</h1>
        <p>Software, Games, Science, Space!</p>
      </div>
    </div>
  </header>

  <main>
    <section class="container">
      <h2>Admin</h2>
      <p>Welcome to the super special admin page where you can manage the different parts of quartznet.</p>
      <p><b>UNLIMITED POWER</b></p>
      <h2>Also cats!</h2>
      <img src="../assets/images/friendscats1.png" alt="cats">
    </section>

    <section class="container">
      <h1>Users</h1>
      <!-- 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>

  <footer>
    <div class="container">
      <hr>
      <p>&copy; Quartznet 2020 | <a href="/quartznet/policy">Policy</a></p>
    </div>
  </footer>
</body>
</html>