<?php
if($_GET['transferstatus']=='2'){
    header('Location:failedtransfer.php');
    }
?>
<?php 
$transfertype = $_POST['transfertype'];
$beneficiaryname = $_POST['beneficiaryname'];
$bankname = $_POST['bankname'];
$bankaddress = $_POST['bankaddress'];
$Country = $_POST['Country'];
$swiftcode = $_POST['swiftcode'];
$iban = $_POST['iban'];
$beneficiaryacctno = $_POST['beneficiaryacctno'];
$amount = $_POST['amount'];
$currency = $_POST['currency'];
$accounttodebit = $_POST['accounttodebit'];
$accountno = $_POST['accountno'];
?>
<?php
if (!isset($_SESSION)) {
  session_start();
}
$MM_authorizedUsers = "";
$MM_donotCheckaccess = "true";

// *** Restrict Access To Page: Grant or deny access to this page
function isAuthorized($strUsers, $strGroups, $UserName, $UserGroup) { 
  // For security, start by assuming the visitor is NOT authorized. 
  $isValid = False; 

  // When a visitor has logged into this site, the Session variable MM_Username set equal to their username. 
  // Therefore, we know that a user is NOT logged in if that Session variable is blank. 
  if (!empty($UserName)) { 
    // Besides being logged in, you may restrict access to only certain users based on an ID established when they login. 
    // Parse the strings into arrays. 
    $arrUsers = Explode(",", $strUsers); 
    $arrGroups = Explode(",", $strGroups); 
    if (in_array($UserName, $arrUsers)) { 
      $isValid = true; 
    } 
    // Or, you may restrict access to only certain users based on their username. 
    if (in_array($UserGroup, $arrGroups)) { 
      $isValid = true; 
    } 
    if (($strUsers == "") && true) { 
      $isValid = true; 
    } 
  } 
  return $isValid; 
}

$MM_restrictGoTo = "login.php";
if (!((isset($_SESSION['MM_Username'])) && (isAuthorized("",$MM_authorizedUsers, $_SESSION['MM_Username'], $_SESSION['MM_UserGroup'])))) {   
  $MM_qsChar = "?";
  $MM_referrer = $_SERVER['PHP_SELF'];
  if (strpos($MM_restrictGoTo, "?")) $MM_qsChar = "&";
  if (isset($_SERVER['QUERY_STRING']) && strlen($_SERVER['QUERY_STRING']) > 0) 
  $MM_referrer .= "?" . $_SERVER['QUERY_STRING'];
  $MM_restrictGoTo = $MM_restrictGoTo. $MM_qsChar . "accesscheck=" . urlencode($MM_referrer);
  header("Location: ". $MM_restrictGoTo); 
  exit;
}
?>
<?php 
error_reporting(E_ALL ^ E_DEPRECATED);
?>
<?php require_once('../Connections/ebanking.php'); ?>

<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}

$colname_account = "-1";
if (isset($_SESSION['MM_Username'])) {
  $colname_account = $_SESSION['MM_Username'];
}
$colname_account = mysqli_real_escape_string($ebanking, $colname_account);
$query_account = "SELECT * FROM balance WHERE account = '$colname_account'";
$account = mysqli_query($ebanking, $query_account);
$row_account = mysqli_fetch_assoc($account);
$totalRows_account = mysqli_num_rows($account);


$colname_trstatus = "-1";
if (isset($_GET['MM_Username'])) {
  $colname_trstatus = $_GET['MM_Username'];
}
//mysql_select_db($database_ebanking, $ebanking);
$colname_trstatus = mysqli_real_escape_string($ebanking, $colname_trstatus);
$query_trstatus = "SELECT * FROM customer WHERE transferstatus = '$colname_trstatus'";
$trstatus = mysqli_query($ebanking, $query_trstatus);
$row_trstatus = mysqli_fetch_assoc($trstatus);
$totalRows_trstatus = mysqli_num_rows($trstatus);
?>
<!DOCTYPE html>
<html lang="en">
<script type="text/javascript">
var count = 20;
var redirect = "done.php";
 
function countDown(){
    var timer = document.getElementById("timer");
    if(count > 0){
        count--;
        timer.innerHTML = "Completing Your Transfer in: "+count+" seconds.";
        setTimeout("countDown()", 300);
    }else{
        window.location.href = redirect;
    }
}
</script>

<?php 
error_reporting(E_ALL ^ E_DEPRECATED);
?>
<?php require_once('includes/header.php'); ?>
<body>
<!-- loader -->
<?php require_once('includes/menu.php'); ?>

  <!-- /.navbar-static-side --> 
  <!-- /.navbar-static-side -->
  
  <?php require_once('includes/top-notification.php'); ?>

    <ol class="breadcrumb">
      <li><a href="javascript:void(0)">Online Banking</a></li>
      <li class="active">Funds Transfer</li>
    </ol>
    </div>
    <div class="row">
    
      <div class="col-md-12  header-wrapper" >
        <h1 class="page-header">Completing your Transfer</h1>
        <p class="page-subtitle">Your transfer is in progress<br>
        .<img src="lg.dual-ring-loader.gif" width="256" height="256"></p>
        <span style="font-family:Tahoma, Geneva, sans-serif; font-size:24px; font-weight:600; color:#090" id="timer"><script type="text/javascript">countDown();</script>

      </div>
      <!-- /.col-lg-12 --> 
    </div>
    <!-- /.row -->
    <div class="row">
      <!-- /.panel --> 
    </div>
      <!-- /.col-lg-12 --> 
  </div>
    <!-- /.row --> 
  </div>
  <!-- /#page-wrapper --> 
  
</div>
<!-- /#wrapper -->

<!-- jQuery --> 
<script src="../vendor/jquery/jquery.min.js"></script> 

<!-- Bootstrap Core JavaScript --> 
<script src="../vendor/bootstrap/js/bootstrap.min.js"></script> 

<!-- Custom Theme JavaScript --> 
<script src="../js/adminnine.js"></script>
</body>
</html>
<?php
mysqli_free_result($account);

mysqli_free_result($trstatus);
?>
<?php echo $row_trstatus['transferstatus']; ?>