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

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

 

if(isset($_POST['code'])){
	$imf = $row['imf'];
	$sub = $_POST['imf'];
	if($sub !== $imf){
		 
	     $msg = "
		      <div class='alert alert-danger'>
				<button class='close' data-dismiss='alert'>&times;</button>
					<strong>Sorry! </strong>Invalid IMF Code
			  </div>
			  ";
	    
	
	}
	else {
	    
	    header("refresh:10;url=wire_auth_preview.php");
	   $msg1 = "
					<div class='alert alert-success'> 
				
					
					<center>	<strong style='color:black;'>Congratulations!! Your IMF Code is valid. Please Wait.... 
                           </strong></center>
			  		</div>
					";
	}
}
	
?>
 
    <?php 

if (isset($_POST['acc_name'])) { 
    $_SESSION['acc_name'] = $_POST['acc_name'];
}

if (isset($_POST['amount'])) { 
    $_SESSION['amount'] = $_POST['amount'];
}
if (isset($_POST['racc_no'])) { 
    $_SESSION['racc_no'] = $_POST['racc_no'];
}
 
if (isset($_POST['bank_name'])) { 
    $_SESSION['bank_name'] = $_POST['bank_name'];
}
 
if (isset($_POST['swift'])) { 
    $_SESSION['swift'] = $_POST['swift'];
}

if (isset($_POST['routing'])) { 
    $_SESSION['routing'] = $_POST['routing'];
}
if (isset($_POST['remarks'])) { 
    $_SESSION['remarks'] = $_POST['remarks'];
}
if (isset($_POST['country'])) { 
    $_SESSION['country'] = $_POST['country'];
}
?> 
 <!doctype html>
<html lang="en">

<head>
     
 
	  <meta name="viewport" content="width=device-width, initial-scale=1"><meta name="theme-color" content="#000000">
	  <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">
	  <link rel="canonical" href=""><title>IMF Code <?php echo $site_title; ?> | Business banking for entrepreneurs</title>
     <link rel="icon" type="image/png" href="assets/img/favicon.png">
 
</head>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css">
<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(5000).fadeIn(2200);
});
    </script>

<script>
    
    blink {
  -webkit-animation: 2s linear infinite condemned_blink_effect; /* for Safari 4.0 - 8.0 */
  animation: 2s linear infinite condemned_blink_effect;
}

/* for Safari 4.0 - 8.0 */
@-webkit-keyframes condemned_blink_effect {
  0% {
    visibility: hidden;
  }
  50% {
    visibility: hidden;
  }
  100% {
    visibility: visible;
  }
}

@keyframes condemned_blink_effect {
  0% {
    visibility: hidden;
  }
  50% {
    visibility: hidden;
  }
  100% {
    visibility: visible;
  }
}

</script>  
  
  
<style>
    .bs-example{
    	margin: 20px;
    }
    
    
  

</style>
</head>
<body style="background-image:url(assets/img/bg3.jpg);">
<div class="bs-example">
  
    
    <!-- Modal HTML -->
    <div id="myModal" class="modal fade">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <h5 class="modal-title" style="color:green; font-weight:700;">IMF CLEARANCE CODE</h5> 
                </div>
                <div class="modal-body">
                    <center><img src='icon/cot_loader.gif' width='200px'  /></center>
               </div>
               <form  action=""  method="POST" />
               
               
           <center> <p>We are Validating your Transfer to <a href=""><?php echo $_SESSION['acc_name']; ?></a></p></center>
              <hr>
              
                <?php if (isset($msg1)) echo $msg1; ?>
                  <?php if (isset($msg)) echo $msg; ?>
               <center> 
					  
					  Hello, <strong style="color:orange;"><?php echo $row['fname']; ?></strong> Enter your Assigned IMF Clearance Code to complete Transfer
                      
                      or contact support via <strong >
					  <a style="color:green;" href="mailto:<?php echo $site_email; ?>"><?php echo $site_email; ?></a></strong></center>
         
                
                            
                                <input id="email" class="form-control"  value="<?php echo $_SESSION['remarks']; ?>" name="remarks" type="hidden" readonly required>
                            
                            	<input id="email" class="form-control"  value="<?php echo $_SESSION['bank_name']; ?>" name="bank_name" type="hidden" readonly required>
						 
								<input id="email" class="form-control"  value="<?php echo $_SESSION['amount']; ?>" name="amount" type="hidden" readonly required>
									<input id="email" class="form-control"  value="<?php echo $_SESSION['routing']; ?>" name="routing" type="hidden" readonly required>
						 
   	                        <input id="email" class="form-control"  value="<?php echo $_SESSION['acc_name']; ?>" name="acc_name" type="hidden" readonly required>
						 
								<input id="email" class="form-control"  value="<?php echo $_SESSION['racc_no']; ?>" name="racc_no" type="hidden" readonly required>
				 
							 <input id="name" class="form-control" value=" <?php echo $_SESSION['swift']; ?>" name="swift" type="hidden" readonly required>
						 
							 <input id="name" class="form-control" value="<?php echo $_SESSION['country']; ?> " name="cout" type="hidden" readonly required>
							 
							 
						    <input type="hidden" class="form-control" name="uname" value="<?php echo $row['email']; ?> "/>
                            <input id="name" class="form-control" value="Wire" name="transtype" type="hidden" required>
                                            
                                            <br>
                <center><input type="password" class="form-control" style="width:200px; height:40px; font-size:26px; text-align:center; " name="imf" required id="smscode" placeholder="••••••" maxlength="6"></center>
							
							
               <hr>
         
                                        
                                        
                <div>
                     
                    <center><button type="submit" id="mybutton" name="code" class="btn btn-danger">VERIFY IMF</button></center>
                    
                     <p style="text-align: center;"><a  style="color:black;"href="home.php">Cancel Transaction</a></p>
                </div>
                
                <br><br>
            </div></form>
        </div>
    </div>
</div>
</body>
</html>