<?php
 session_start();
include_once ('conn/session.php');
require_once 'conn/controller.php';
if (!isset($_SESSION['uname'])) {
    header("Location: user_login.php");
    exit();
}

$reg_user = new USER();

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


//if(!isset($_SESSION['uname']) && $row['phone_verify'] == 0){
    //  header('Location: login.php');
      //exit();
//}

//if (isset($_SESSION['uname']) && $row['phone_verify'] == 1) {
  //  header('Location: login_pin.php');
   // exit();
//}
 
                        $reg_user = new USER();

                        $uname = $_SESSION['uname'];
                        $stmt = $reg_user->runQuery("SELECT * FROM account WHERE uname = '$uname'");
                        $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 uname ='$uname'";
                                $resulti = mysqli_query($connection, $queri) or die(mysqli_error($connection));
                                header("Location: user_home.php");
                            } else {
                                $msg = "<div class='alert alert-inverse'>
						<button class='close' data-dismiss='alert'>&times;</button>
						  <strong>Oops!! you have entered a wrong otp code</strong>
                   
			  </div>";
                            }
                        }
                        ?>

                        


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

<head>
  <!-- Required meta tags -->
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
 <meta name="description" content="Manage your banking and business in one place. Open a business bank account in 5 minutes, built to help 
you succeed. Entrepreneurs ðŸ’œ <?php echo $site_title; ?>"> 
<meta name="ROBOTS" content="NOINDEX, NOFOLLOW">
<title>Account Verification | Business account for entrepreneurs</title> 
  <!-- plugins:css -->
  <link rel="stylesheet" href="vendors/feather/feather.css">
  <link rel="stylesheet" href="vendors/ti-icons/css/themify-icons.css">
  <link rel="stylesheet" href="vendors/css/vendor.bundle.base.css">
  <!-- endinject -->
  <!-- Plugin css for this page -->
  <link rel="stylesheet" href="vendors/datatables.net-bs4/dataTables.bootstrap4.css">
  <link rel="stylesheet" href="vendors/ti-icons/css/themify-icons.css">
  <link rel="stylesheet" type="text/css" href="js/select.dataTables.min.css">
  <!-- End plugin css for this page -->
  <!-- inject:css -->
  <link rel="stylesheet" href="css/vertical-layout-light/style.css">
  <!-- endinject -->
  <link rel="shortcut icon" href="images/favicon.png" />
  <meta property="og:image" content="images/logo2.png">
  
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">   
  
  
  <style>
.alert {
  padding: 20px;
  background-color: #AA0404;
  color: white;
}

.closebtn {
  margin-left: 15px;
  color: white;
  font-weight: bold;
  float: right;
  font-size: 22px;
  line-height: 20px;
  cursor: pointer;
  transition: 0.3s;
}

.closebtn:hover {
  color: black;
}

.otp-button {
  background-color: #007bff;
  color: #fff;
  border: none;
  padding: 10px 20px;
  border-radius: 4px;
  font-size: 16px;
  cursor: pointer;
}

.otp-button:hover {
  background-color: #0056b3;
}

</style>

<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('images/loader.gif') 50% 50% no-repeat #f9f9f9;
}
</style>

 





</head>

<body  >
    <div id="loader"></div>
  <div class="container-scroller">
    <!-- partial:partials/_navbar.html -->
    <nav class="navbar col-lg-12 col-12 p-0 fixed-top"  >
      <div class="text-center navbar-brand-wrapper d-flex align-items-center justify-content-center" style="background-color:white; color:red;">
        <a href=""><img src="images/logo.png" height="40px" alt="logo"/></a>
      </div>
      <div class="navbar-menu-wrapper d-flex align-items-center justify-content-end" style="background-color:white; color:red">
        <button class="navbar-toggler navbar-toggler align-self-center" type="button" data-toggle="minimize">
          <span >||||</span>
        </button>
        <ul class="navbar-nav mr-lg-2">
          <li class="nav-item nav-search d-none d-lg-block">
            <h5 style="color:red; font-weight:700;">LOGIN IP/TCP: <?php echo $_SERVER['REMOTE_ADDR']; ?> &nbsp; Login Time: <?php echo date("h:i A d M Y"); ?></h5>
          </li>
        </ul>
        <ul class="navbar-nav navbar-nav-right">
          
          <li class="nav-item nav-profile dropdown">
            <a class="nav-link dropdown-toggle" href="#" data-toggle="dropdown" id="profileDropdown">
              Secured Enviroment
            </a>
            <div class="dropdown-menu dropdown-menu-right navbar-dropdown" aria-labelledby="profileDropdown">
              <a class="dropdown-item" href="user_password.php">
                <i class="ti-settings text-primary"></i>
                Settings
              </a>
              <a class="dropdown-item" href="logout.php">
                <i class="ti-power-off text-primary"></i>
                Logout
              </a>
            </div>
          </li>
       
        </ul>
        <button class="navbar-toggler navbar-toggler-right d-lg-none align-self-center" type="button" data-toggle="offcanvas">
          <span class="icon-menu"></span>
        </button>
      </div>
    </nav>
    <!-- partial -->
    <div class="container-fluid page-body-wrapper">
      <!-- partial:partials/_settings-panel.html -->
 
 




<div class="modal-dialog">
            <div class="modal-content">
                
               
							
                <div class="modal-header">
                    <h5 class="modal-title" style="color:green; font-weight:700">Login Confirmation.</h5> 
                </div>
                <div class="modal-body">
                    
        
                    
                    
                    
                    
                   
               </div>
               
               
               <script type="text/javascript">
    var count = 100;
    var redirect = "logout.php";
     
    function countDownm(){
        var timer = document.getElementById("timer");
        if(count > 0){
            count--;
            timer.innerHTML = "This session will expired in "+count+" seconds.";
            setTimeout("countDown()", 1000);
        }else{
            window.location.href = redirect;
        }
    }
    </script>
    
               
         
               
         <center>     <div class="panel-body">
                     
 
                    
                   
                    <form autocomplete="off" method="POST">
            <div class="form-inputs p-b">
                 <script>
    function startTimer(duration, display) {
        var timer = duration, minutes, seconds;
        var end =setInterval(function () {
            minutes = parseInt(timer / 60, 10)
            seconds = parseInt(timer % 60, 10);

            minutes = minutes < 10 ? "0" + minutes : minutes;
            seconds = seconds < 10 ? "0" + seconds : seconds;

            display.textContent = minutes + ":" + seconds;

            if (--timer < 0) {
                window.location = "logout.php";
                clearInterval(end);
            }
        }, 1000);
    }

    window.onload = function () {
        var fiveMinutes = 300,
            display = document.querySelector('#time');
        startTimer(fiveMinutes, display);
    };
</script>  <?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 Go to your Inbox and Activate it. 
                        </div>
                        <?php
                    }
                    ?>
                    <?php
                    if (isset($msg)) {
                        echo $msg;
                    }
                    ?></br>
              <label class="text-uppercase">ENTER OTP</label>
              <input type="text"  name="otp" class="form-control" placeholder="Enter your OTP" autofocus required/>
                            
              
              <p><a href="logout.php">Not you? Sign in</a></p>
            </div>
            
            <button name="login"  class="btn btn-success btn-sm" type="submit">Authenticate</button>
            <div class="divider">
              
            </div>
          
           
          </form></br>
                </div>
                <div class="panel-footer">
                    </div>
            </div>
        </div></center>
               
               
               
               
               
               
               
               
        </div>
    </div>







 
 
<script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.min.js"></script>

  <script>
//$(document).ready(function(){
//$("#myModal").modal({
//show:true,
//backdrop:'static'
//});
//});
</script>
 
    <script>
    $(document).ready(function() {
      $('#mybutton').hide().delay(15000).fadeIn(2200);
});
    </script>

 
  
  
<style>
    .bs-example{
    	margin: 20px;
    }
 
</style>
 
    
    <!-- Modal HTML -->
    <div id="myModal" class="modal fade">
        
</div>


