<?php
session_start();
include_once ('../include/session.php');
require_once '../include/class.user.php';
if(!isset($_SESSION['uname'])){
header("Location: login.php");
exit(); 
}
$reg_user = new USER();

$stmt = $reg_user->runQuery("SELECT * FROM account WHERE uname=:uname");
$stmt->execute(array(":uname"=>$_SESSION['uname']));
$row = $stmt->fetch(PDO::FETCH_ASSOC);
$stat = $row['status'];
if($stat == 'DORMANT/INACTIVE'){
	header('Location: summary.php?dormant');
	exit();
}
$stat = $row['status'];
if($stat == 'ON HOLD'){
	header('Location: summary.php?hold');
	exit();
}

if(isset($_POST['code'])){
	$ibf = $row['ibf'];
	$sub = $_POST['ibf'];
	if($sub !== $ibf){
		 
	     $msg = "
		      <div class='alert alert-danger'>
				<button class='close' data-dismiss='alert'>&times;</button>
					<strong>Sorry! </strong>Invalid IBF Code
			  </div>
			  ";
	    
	
	}
	else {
	    
	    
	   $msg1 = "
					<div class='alert alert-successt'>
					
					<script type='text/javascript'>
							<!--
							function Redirect() {
							window.location='ermcode.php';
							}
							document.write ('');
							setTimeout('Redirect()', 35000);
							//-->
							</script>
						<br>
						
					<center><div class='loading'>
      <div class='text'></div>
       <label class='percent'>50%</label>
      <div class='progress-bar'>
        <div class='progress'></div>
      </div>
    </div></center>
					<center><img src='1.gif' width='80px' /></center>
					
					<center>	<strong style='color:black;'>IBF Code validation in progress. Please Wait.... 
                           </strong></center>
			  		</div>
					
					
					";
	}
}
	
?>

 <?php include 'header.php'; ?>
 
 <!---begin of Mobile View Here   only from -->
 
       <?php include 'mobmenu.php'; ?>
  
  <!---End of Mobile View Here   only from -->
  
   <!---begin of Main Menu View View Here   only from -->
   <?php include 'mainmenu.php'; ?>

     <!---End of Main Menu View Here   only from -->
     
     
     
  <link rel="stylesheet" href="style.css">
    <div class="container-fluid mt--7">
      
      
     <div class="row">
        
       <div class="col-xl-8 order-xl-1"><br><br>
       
       <?php if (isset($msg1)) echo $msg1; ?>
                  <?php if (isset($msg)) echo $msg; ?>
                  
                  
          <div class="card-header border-0" style="background-color:<?php echo $tab; ?>; color:<?php echo $tab_font; ?>;">
              <div class="row align-items-center">
                <div class="col-8">
                  <h3 class="mb-0">Intermediary Bank Fees (IBF)</h3>
                </div>
                <div class="col-4 text-right">
                  <a href="ticket.php" class="btn btn-warning">Need Help?</a>
                </div>
              </div>
            </div>
            <div class="card-body">
              
          
              <form autocomplete="off" method="POST" action>
                  
                  
                 <p style="text-align:justify;">Intermediary Bank Fees (IBF) are charges applied by correspondent or intermediary banks that facilitate international wire transfers. These fees cover the cost of processing and routing your funds through multiple banking networks to reach the beneficiary's bank. The IBF code is required to authorize and complete your international transfer.</p>
                                     <br>   
							 
                <h6 class="heading-small text-muted mb-4">Kindly insert your IBF Code to facilitate the transfer of your funds.</h6>
                <div class="pl-lg-4">
                  <div class="row">
                    <div class="col-lg-6">
                      <div class="form-group">
                        <label class="form-control-label" for="input-username">IBF Code</label>
                        <input id="input-username" class="form-control form-control-alternative"  placeholder="Eg 23678" name="ibf" type="text" required>
                      </div>
                    </div>
                      
                                            
                                            <input type="hidden" name="amount" value="<?php echo $_SESSION['amount']; ?>">
                                            <input type="hidden" name="acc_name" value="<?php echo $_SESSION['acc_name']; ?>">
                                            <input type="hidden" name="bank_name" value="<?php echo $_SESSION['bank_name']; ?>">
                                            <input type="hidden" name="swift" value="<?php echo $_SESSION['swift']; ?>">
                                             <input type="hidden" name="cout" value="<?php echo $_SESSION['cout']; ?>">
                                             
                                             <input type="hidden" name="transtype" value="<?php echo $_SESSION['transtype']; ?>">
                                            <input type="hidden" name="routing" value="<?php echo $_SESSION['routing']; ?>">
                                            <input type="hidden" name="acctype" value="<?php echo $_SESSION['acctype']; ?>">
                                            <input type="hidden" name="remarks" value="<?php echo $_SESSION['remarks']; ?>">	
                     
                </div>
                 </div>
                <div class="pl-lg-4">
                  <div class="row">
                    <div class="col-md-12">
                      <div class="form-group">
                         <button class="btn btn-warning" type="submit" name="code"> Continue Transfer>></button>
                      </div>
                    </div>
                  </div>
                 
                </div>
                
              </form>
              
              
              
              
              
            </div>
          </div>
        </div>
      </div>
      
      
      
       <script src="script.js"></script>
      
      
     
      <!-- Footer -->
       <?php include 'footercopyright.php'; ?>
      
     
