<?php
SESSION_START();

include 'login_mysql.php';

if(isset($_SESSION['admin'])){
  header('Location: add_image.php');
}
require_once '../includes/header.html';
?>

<body>

<div class="container-fluid">
  <div class="row" style="display: flex; justify-content: center;">
    <div class="col-12 col-md-2">


      <form id="login-form" method="post" role="form" action="">

      <?php if(!empty($field_err)): ?>
        <div class="alert alert-danger" role="alert">
          <ul>
            <li><?php echo implode( "</li><li>", $field_err); ?></li>
        </ul>
      </div>
      <?php endif; ?>

        <h1> Login </h1>
        <div class="form-group">
          <label for="username">Username</label>
          <input type="username" class="form-control" name="username" placeholder="username" value="<?php if(isset($_POST['username'])) echo htmlspecialchars($_POST['username']); ?>">
        </div>

        <div class="form-group">
          <label for="exampleInputPassword1">Password</label>
          <input type="password" name="password" class="form-control" placeholder="Password">
        </div>

        <div class="form-group">
           <script src="https://www.google.com/recaptcha/api.js" async defer></script>
           <div class="g-recaptcha" data-sitekey="6LcKfjsUAAAAAMcjWsr9QfsyCQKoXer0t40H8ETJ"></div>
        </div>

        <div class="form-group">
          <input type="hidden" name="login" value="yes" >
          <input type="submit" name="submit" class="btn btn-info" value="Login">
        </div>

      </form>
    </div>
  </div>
</div>
<body>
  </html>
<?php include '../includes/scripts.html'; ?>