    <?php
    session_start();
    //error_reporting(E_ALL); 
    //ini_set('display_errors', 1);
    include('functions/userfunctions.php');
  include('config/dbcon.php');
  
  include('authenticate.php');
    include('includes/header.php');

      if(isset($_SESSION['auth']))

      {

        $_SESSION['message'] = "You are already logged in.";

        header('Location: index.php');

        exit();

      }

      ?>

<div class="container py-5">

  <div class="row justify-content-center">

    <div class="col-md-6">

        <?php if(isset($_SESSION['message'])) { ?>

          <div class="alert alert-warning alert-dismissible fade show" role="alert">

             <?= $_SESSION['message']; ?>

            <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>

          </div>



        <?php

        unset($_SESSION['message']);

         } ?>

      <div class="card">

        <div class="card-header">

          <h4>Login</h4>

        </div>

        <div class="card-body">

            <form action="functions/authcode.php" method="POST">

            <div class="mb-3">

              <label for="exampleInputEmail1" class="form-label">Email address</label>

              <input type="email" name="email" class="form-control" id="exampleInputEmail1" placeholder="Enter Your Email" aria-describedby="emailHelp">

            </div>

            <div class="mb-3">

              <label for="exampleInputPassword1" class="form-label">Password</label>

              <input type="password" name="password" class="form-control" placeholder="Enter Your Password" id="exampleInputPassword1">

            </div>

            <button type="submit" name="login_btn" class="btn btn-primary">Login</button><span class="text-info" style="font-size:smaller;margin-left:40%;"><a href="register.php">Register</a></span><span class="text-info" style="font-size:smaller;margin-left:10%;"><a href="forgotpassword.php">Forgot password?</a></span>

          </form>

        </div>

      </div>



    </div>

  </div>

</div>







    <?php include('includes/footer.php');?>