<?php
include 'config/index.php';
$data = new Database;
if(!isset($_SESSION['id'])){
   echo $data->redirect('login');
}
if(isset($_POST['sub'])){
   $pin = $_POST['pin'];

   if($pin != $_SESSION['otp']){
      $error = 'The verification code is incorrect';
   }else{
         echo $data->redirect('index?home=home');
   }
}
?>
<!DOCTYPE html>
<html lang="en">
  <head>
		<meta charset="utf-8">
      <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title> Login | Vaultmore Bank Ltd. </title>
    <link rel="shortcut icon" href="assets/img/favicon.png">
		<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.7.1/css/all.css">
		<link href="style.css" rel="stylesheet" type="text/css">
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.0/dist/css/bootstrap.min.css">
	</head>
  <style>
     #ba{
      background-image: url('../assets/background.jpg');
     }
  </style>
<body>
   <div id="ba" class="d-flex align-items-center" style="min-height:100vh;">
      <div class="container">
          <div class="col-md-9 col-lg-4 mx-auto">
            <!-- Sign In Form -->
            <br>
            <form method="post" action=''>
               <div class="card py-4 px-3">
                  <div class="card-body">

                     <h5 style="text-align:center">Customer verification</h5>
                     <p class="mobile-text" style="text-align:center;font-size:12px">Enter the Access code received in your email</p>
                     <?php
                        if(isset($error)){
                        echo "<small style='color:red'>$error</small> <br>";
                        }
                     ?>
                     <div class="form-group">
                        <input type="text" class="form-control" name="pin" id="pin" placeholder='enter code'>
                     </div>
                     <br>
                     <button class='btn btn-primary btn-sm' name="sub">Submit</button>
                  </div>
               </div>
            </form>
          </div>
        <!-- Your content goes here -->
      </div>
    </div>
 </div>
</body>
</html>