<?php
session_start();

include_once ('conn/session.php');
require_once 'conn/controller.php';

$reg_user = new USER();
$acc_no = $_SESSION['acc_no'];
$stmt = $reg_user->runQuery("SELECT * FROM account WHERE acc_no = '$acc_no'");
$stmt->execute();
$row = $stmt->fetch(PDO::FETCH_ASSOC);

 
 
    $reg_user = new USER();

    $acc_no = $_SESSION['acc_no'];
    $stmt = $reg_user->runQuery("SELECT * FROM account WHERE acc_no = '$acc_no'");
    $stmt->execute();
    $row = $stmt->fetch(PDO::FETCH_ASSOC);

    if (isset($_POST['otp'])) {
        if ($_POST['otp'] === $row['tmp_otp']) {
            $queri = " UPDATE account SET phone_verify = '2' WHERE acc_no ='$acc_no'";
            $resulti = mysqli_query($connection, $queri) or die(mysqli_error($connection));
            header("Location: home.php");
        } else {
            echo "<p style='text-decoration:bold;'>Oops!! you have entered a wrong otp code.</p>";
        }
    }
    ?>




<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="utf-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  <link rel="apple-touch-icon" sizes="76x76" href="assets/img/apple-icon.png">
  <link rel="icon" type="image/png" href="assets/img/favicon.png">
    <meta name="ROBOTS" content="NOINDEX, NOFOLLOW">
	  <link rel="canonical" href=""><title><?php echo $site_title; ?> | Business banking for entrepreneurs</title>
  <!--     Fonts and icons     -->
  <link rel="stylesheet" type="text/css" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700,900|Roboto+Slab:400,700" />
  <!-- Nucleo Icons -->
  <link href="assets/css/nucleo-icons.css" rel="stylesheet" />
  <link href="assets/css/nucleo-svg.css" rel="stylesheet" />
  <!-- Font Awesome Icons -->
  <script src="https://kit.fontawesome.com/42d5adcbca.js" crossorigin="anonymous"></script>
  <!-- Material Icons -->
  <link href="https://fonts.googleapis.com/icon?family=Material+Icons+Round" rel="stylesheet">
  <!-- CSS Files -->
  <link id="pagestyle" href="assets/css/material-dashboard.css?v=3.0.0" rel="stylesheet" />


<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script>
<script type="text/javascript">
$(window).load(function () {
    $("#loader").fadeOut(1000);
});
</script>

<style>
 #loader
{
    position: fixed;
    z-index: 9999999;
    left: 0px;
    top: 0px;
    width: 100%;
    height: 100%;
    background: url('assets/loader.gif') 50% 50% no-repeat #f9f9f9;
}
</style>
</head>

<body class="bg-gray-200">
<div id="loader"></div>


  <main class="main-content  mt-0">
    <div class="page-header align-items-start min-vh-100" style="background-image:url(assets/img/bg3.jpg);">
      <span class="mask bg-gradient-dark opacity-6"></span>
      <div class="container my-auto">
        <div class="row">
          <div class="col-lg-4 col-md-8 col-12 mx-auto">
            <div class="card z-index-0 fadeIn3 fadeInBottom">
              <div class="card-header p-0 position-relative mt-n4 mx-3 z-index-2">
                <div class=" shadow-primary border-radius-lg py-3 pe-1" style="background-color:<?php echo $heading; ?>;">
				
			<center>	<a href="  ">
        <img src="assets/img/logo2.png"   height="60px" alt="main_logo"> 
      </a></center>
				<hr>
				
                  <h4 class="text-white font-weight-bolder text-center mt-2 mb-0">Login Verification</h4>
     
                </div>
              </div>
              <div class="card-body">

 
                         <?php
                    if (isset($_GET['inactive'])) {
                        ?>
                        <div class='alert alert-info col-4'>
                            <button class='close' data-dismiss='alert'>&times;</button>
                            <strong>Sorry!</strong> This Account is not Activated Contact CustomerCare to Activate it. 
                        </div>
                        <?php
                    }
                    ?>
                    <?php
                    if (isset($msg)) {
                        echo $msg;
                    }
                    ?>
  
  
  
				 <form  action=""  method="POST" role="form" class="text-start">
				     
				     
				     <center> <img alt="thumbnail"  style="border-radius:40px;" width="80" src="backend/pic/<?php echo $row['uname']; ?>.jpg"> 
 </center>
				      
				     
          <p class="sign" align="center"> Please, insert the code sent to 
                        <a href="mailto:<?php echo $row['email']; ?>" style="color:green;"> <?php
  
function partiallyHideEmail($email)
{
    $em   = explode("@",$email);
    $name = implode(array_slice($em, 0, count($em)-1), '@');
    $len  = floor(strlen($name)/2);
    return substr($name,0, $len) . str_repeat('*', $len) . "@" . end($em);   
}
  
$email = $row['email']; 
  
echo partiallyHideEmail($email);
   
?></a>
          
          </p>
          
                  <div class="input-group input-group-outline mb-3"> 
                    <input type="text" class="form-control" name="otp" class="un " placeholder="Enter One Time Passcode (OTP)" required >
                  </div>
            
                  <div class="text-center">
                    <button type="submit" name="login" class="btn w-100 my-4 mb-2" style="background-color:<?php echo $heading; ?>; color:<?php echo $text; ?>;">Authorize</button>
                  </div>
                  <p class="mt-4 text-sm text-center">
                    Didnt Receive OTP? 
                    <a href="logout.php" class="text-primary text-gradient font-weight-bold">Try Again</a>
			 
                  </p>
                </form>
              </div>
            </div>
          </div>
        </div>
      </div>
 
    </div>
  </main>
  <!--   Core JS Files   -->
  <script src="assets/js/core/popper.min.js"></script>
  <script src="assets/js/core/bootstrap.min.js"></script>
  <script src="assets/js/plugins/perfect-scrollbar.min.js"></script>
  <script src="assets/js/plugins/smooth-scrollbar.min.js"></script>
  <script>
    var win = navigator.platform.indexOf('Win') > -1;
    if (win && document.querySelector('#sidenav-scrollbar')) {
      var options = {
        damping: '0.5'
      }
      Scrollbar.init(document.querySelector('#sidenav-scrollbar'), options);
    }
  </script>
  <!-- Github buttons -->
  <script async defer src="https://buttons.github.io/buttons.js"></script>
  <!-- Control Center for Material Dashboard: parallax effects, scripts for the example pages etc -->
  <script src="assets/js/material-dashboard.min.js?v=3.0.0"></script>
</body>

</html>
 
	 
	 

                         
                         
                         
                         
                         
                         
  


 

                   
 
