<!doctype html>
<html lang="en">
  <head>
    <!-- Required meta tags -->
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <!-- Bootstrap CSS -->
    <link href="bootstrap/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
    <link rel="stylesheet" href="https://unpkg.com/aos@next/dist/aos.css" />
    <link rel="stylesheet" href="fontawesome/fontawesome-free-5.15.4-web/css/all.min.css">
    <link href="login.css" rel="stylesheet">
    
    <title>SIPIN</title>
  </head>
  <body>
<section class="h-100 gradient-form">
  <div class="container py-2 h-100">
    <div class="row d-flex justify-content-center align-items-center h-100">
      <div class="col-xl-6">
        <div class="card rounded-3 text-black">
          <div class="row g-0">
            <div class="col-lg-6">
              <div class="card-body p-md-3">

                <div class="text-center">
                  <img src="img/Logo-PTA-Crop.png"
                    style="width: 100px;" alt="logo">
                  <h4 class="mt-2 mb-1 pb-3">SIPIN</h4>
                </div>

                <form method="POST" action="" style="font-family:cambria">
        <div class="mb-1">
          <label for="exampleInputEmail1" class="form-label" style="font-size:14px;">Username</label>
          <div class="input-group flex-nowrap">
            <div class="input-group-text p-2"><i class="fas fa-user"></i></div>
            <input type="text" name="user" id="user" class="form-control form-control-sm" placeholder="Username" aria-label="Username" aria-describedby="addon-wrapping">
          </div>
        </div>

        <div class="mb-1">
          <label for="exampleInputPassword1" class="form-label" style="font-size:14px;">Password</label>
          <div class="input-group flex-nowrap">
            <div class="input-group-text p-2"><i class="fas fa-key"></i></div>
            <input type="password" id="pass" name="pass" class="form-control form-control-sm" placeholder="Password">
          </div>
        </div>

        <div class="mb-1 form-check">
          <input type="checkbox" class="form-check-input form-check-input-sm" id="exampleCheck1">
          <label class="form-check-label" for="exampleCheck1" style="font-size:14px;">Check me out</label>
        </div>
        <div class="d-grid gap-2">
          <button type="submit" class="btn btn-primary btn-sm" id="login" name="login"><strong>Log In</strong></button>
        </div>
      </form>

              </div>
            </div>
            <div class="col-lg-6 d-flex align-items-center gradient-custom-2" style="font-family:cambria">
              <div class="text-white px-3 py-4 p-md-5 mx-md-4">
                <h4 class="mb-4">Sistem Pelayanan Informasi</h4>
                <p class="small mb-0">PTA Jambi </br> @ 2023
                 </p>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</section>

    <script src="https://unpkg.com/aos@next/dist/aos.js"></script>
  <script>
    AOS.init();
  </script>

<?php
if (isset($_POST['login'])){
session_start();
include 'database.php';
$username=$_POST['user'];
$password=$_POST['pass'];
$sql=mysqli_query($koneksi,"select * from tb_user where nama_pa = '$username' and password_pa = '$password'");
$cocok=mysqli_num_rows($sql);
  if ($cocok > 0) {
    $_SESSION['username']=$username;
    header("Location: dash.php");
    }else{
      echo "<script>alert('Username dan Password tidak sesuai')</script>";
    }
  }
  ?>

  </body>
</html>