<?php 
ob_start();
require_once('Services/Twilio.php');
require_once('../Connections/bnkconn.php'); ?>
<?php
if (isset($_GET['id'])) {
       /// echo $_GET['id'];
	$idtocheck=$_GET['id'];
	$_SESSION['accountn']=$idtocheck;
    }
$msgshow="";
session_start();
$loginFormAction = $_SERVER['PHP_SELF'];
$acc=$_SESSION['accountn'];
///echo $acc;
$sql2="SELECT * FROM act_holder_details WHERE cust_act_number='".$_SESSION['act_number']."'";
    	 custom_mysql_select_db('rockusen_db');
        $detailsget = custom_mysql_query($sql2);
         while($dt = custom_mysql_fetch_array($detailsget)) {
         	$bnkid=$dt["bankidreq"];
         	$authid=$dt["authcodereq"];
         		$email=$dt["cust_mail"];
         	$cust_name=$dt["cust_name"];
         	$s_code=$dt["clearancereq"];
         	$cemail=$dt["cemail"];

         }


          $sql3 = "SELECT * FROM transaction WHERE id ='". $_SESSION['accountn']. "'";
    	 custom_mysql_select_db('rockusen_db');
        $detailsgett = custom_mysql_query($sql3);
         while($dtt = custom_mysql_fetch_array($detailsgett)) {
         	$account=$dtt["act_number"];
         	 $authcode=$dtt['authcode'];
         	
         }

         $admin_email=custom_mysql_fetch_object(custom_mysql_query("SELECT * FROM `admin`"));
$admin_email=$admin_email->email;
echo $email;
  $to = $email; 
  

 $message="<style type='text/css'>
h4{font-family:Calibri, Tahoma, Geneva, sans-serif;}
table{font-family:Calibri, Tahoma, Geneva, sans-serif;font-size:13px;color:#666666;text-align:justify;}
td{text-align:justify;}
a{font-family:Calibri, Tahoma, Geneva, sans-serif;color:#FF6600;text-decoration:none;}
</style>
    <table border='0' cellpadding='0' cellspacing='0' width='689'>
      <tbody>
        <tr>
          <td colspan='9' height='97'><div align='right'><img src='https://ibank.allied-wealth.com/logo.png'></div></td>
      </tr>

        <tr>

          <td width='140'>&nbsp;</td>

          <td width='549' colspan='7'><div align='right'>".date('d-M-Y')."</div></td>

        </tr>

        <tr>

          <td colspan='9'><b> Dear Valued Customer </b></td>

        </tr>

        <tr>

          <td colspan='9'>&nbsp;</td>

        </tr>

        <tr>

          <td colspan='9'>your account  information is</td>

        </tr>

        <tr>

          <td colspan='9'>&nbsp;</td>

        </tr>

        <tr>

          <td width='130'> Account Name </td>

          <td width='10'> :</td>

          <td colspan='8' width='549'> $cust_name </td>

        </tr>

        <tr>

          <td colspan='9'>&nbsp;</td>

        </tr>

        <tr>

          <td width='130'> Account Number </td>

          <td width='10'> :</td>

          <td colspan='8' width='549'> $account </td>

        </tr>

        <tr>

          <td colspan='9'>&nbsp;</td>

        </tr>
 <tr>

          <td colspan='9'>&nbsp;</td>

        </tr>

        <tr>

          <td width='130'> Your Auth-code for this session </td>

          <td width='10'> :</td>

          <td colspan='8' width='549'> $authcode</td>

        </tr>
        <tr>

          <td colspan='9'> Thank you for choosing Allied Secured Wealth Bank</td>

        </tr>

        <tr>

          <td colspan='9'>&nbsp;</td>

        </tr>

      </tbody>

    </table>"; 	 
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n";
 $headers .= 'From: '.$admin_email."\r\n";// From
 $subject  =  'Allied Secured Wealth Bank alert' ; //Subject

/**
* Note: This file may contain artifacts of previous malicious infection.
* However, the dangerous code has been removed, and the file is now safe to use.
*/

  
if(isset($_POST['number']))
{

           $bankidget=$_POST['number'];
           
	//custom_mysql_select_db($database_bnkconn);
	$sql = "SELECT * FROM transaction WHERE id  ='". $acc. "'";
	$res1 = custom_mysql_query($sql) or die(custom_mysql_error());
while($row = custom_mysql_fetch_array($res1)) {
 $authcode=$row['authcode'];

if($row['authcode']==$_POST['number'])
{
	$page=3;
	 $update_bank_data = custom_mysql_query("UPDATE transaction SET stage = '".$page."'
         WHERE id = '".$acc."'");

	$redirect="sucess_page3s.php";
	header('Location: sucess_page3s.php?id='.$acc);
	 if($s_code==1)
         {
header('Location: sucess_page3s.php?id='.$acc); 
         } 
         else if($c_code==0)
         {
         	$redirect="tranc_page.php?id=".$acc;
	header('Location: '.$redirect);
         }
	break;
}
else
{
	$msgshow="Wrong Auth-Code please try again";
     echo $row['stage'];
	break;
}
}}
include('header.php'); 
?>
	<div>
		<ul class="breadcrumb">
			<li>
				<a href="dashboard.php">Home</a> <span class="divider">/</span>
			</li>
			<li>
				<a href="fund_transfer.php">Fund Transfer</a>
			</li>
		</ul>
	</div>
	<strong>
	<?php
                 echo '<p  style="color: red;">'.$msgshow. '</p>';
	?>
	</strong>
	<div class="breadcrumb">
		
		<p><strong> NOTE:authorisation code  is required to complete this transfer request, and if this transfer trasaction is not completed with 42hours the transaction will be cancelled and the escrowed funds released back to the debited  Account!
		</p>
	</div>
	<!--/row-->

	<div class="box-content">
		<form action="<?php echo $loginFormAction; ?>" method="POST" class="form-horizontal" id="login_form">
			<fieldset>
				<table width="100%" border="0">
					<tr>
						<td colspan="4" class="form-actions">Provide authorisation code</td>
					</tr>
					<tr>
						<td>&nbsp;</td>
						<td><strong>Senders Account</strong></td>
						<td><strong><?php echo $_SESSION['act_number']; ?></strong></td>
						<td>&nbsp;</td>
					</tr>
					
					
						<td>&nbsp;</td>
						<td>Auth Code</td>
						<td><input type="text" name="number" id="number" required></td>
						<td>&nbsp;</td>
					</tr>
					<tr>
						<td>&nbsp;</td>
						<td>&nbsp;</td>
						<td>&nbsp;</td>
						<td>&nbsp;</td>
					</tr>
					<tr>
						<td>&nbsp;</td>
						<td>&nbsp;</td>
						<td>&nbsp;</td>
						<td>&nbsp;</td>
					</tr>
					<tr>
						<td colspan="4">
							<div class="form-actions">
								<button type="submit" class="btn btn-primary" name="transfer">Confirm Transfer Request</button>
								<button type="reset" class="btn">Cancel</button>
							</div>
						</td>
					</tr>
					<tr>
						<td>&nbsp;</td>
						<td>&nbsp;</td>
						<td>&nbsp;</td>
						<td>&nbsp;</td>
					</tr>
				</table>
				<legend></legend>

				<div class="control-group">
					<div class="controls"></div>
				</div>
				<div class="control-group">
					<div class="controls"></div>
				</div>
			</fieldset>
		</form>

	</div>


	<?php include('footer.php');
	ob_start();
exit(); ?>
	