
<?php
include('config.php');


//sending email
$emailsms = wordwrap($emailsms,70);
$headers = 'From: <'.$site_email.'>' . "\r\n";
$senemail = mail($adminemail, $subject, $message, $headers);


//Changing Of Password
if (isset($_POST['change_password'])) {

$oldword = mysqli_real_escape_string($db,$_POST["old_password"]);
$newword = mysqli_real_escape_string($db, $_POST["new_password"]);



$cpass =  mysqli_fetch_array(mysqli_query($db,"SELECT password FROM user WHERE accountnumber='".$accountnumber."'"));



//Check if the existing password matches
if ($cpass[0]!=$oldword){$err1=1;}

//If new password is empty
if(trim($newword)==""){$err3=1;}

//If new password is less than 4digits
if(strlen($newword)<=3){$err4=1;}

$error = $err1+$err3+$err4;


if ($error == 0){

$res =  mysqli_query($db, "UPDATE user SET password='".$newword."' WHERE accountnumber='".$accountnumber."'");
if($res){
    
 
     //now send this email to client for password reset
  $to = $email ;
    
$subject = 'Password Successfully Updated';

$from = $site_email;
 
// Setting html content type for email sending
$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
 
// Create email headers
$headers .= 'From: '.$from."\r\n".
    'Reply-To: '.$from."\r\n" .
    'X-Mailer: PHP/' . phpversion();
    
     $emailmsg = ' <!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml" xmlns:o="urn:schemas-microsoft-com:office:office">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width,initial-scale=1">
  <meta name="x-apple-disable-message-reformatting">
  <title></title>
  <!--[if mso]>
  <style>
    table {border-collapse:collapse;border-spacing:0;border:none;margin:0;}
    div, td {padding:0;}
    div {margin:0 !important;}
  </style>
  <noscript>
    <xml>
      <o:OfficeDocumentSettings>
        <o:PixelsPerInch>96</o:PixelsPerInch>
      </o:OfficeDocumentSettings>
    </xml>
  </noscript>
  <![endif]-->
  <style>
    table, td, div, h1, p {
      font-family: Arial, sans-serif;
    }
    @media screen and (max-width: 530px) {
      .unsub {
        display: block;
        padding: 8px;
        margin-top: 14px;
        border-radius: 6px;
        background-color: #555555;
        text-decoration: none !important;
        font-weight: bold;
      }
      .col-lge {
        max-width: 100% !important;
      }
    }
    @media screen and (min-width: 531px) {
      .col-sml {
        max-width: 27% !important;
      }
      .col-lge {
        max-width: 73% !important;
      }
    }
    
    
    
   


  </style>
</head>

<body style="margin:0;padding:0;word-spacing:normal;background-color:#939297;">
  <div role="article" aria-roledescription="email" lang="en" style="text-size-adjust:100%;-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%;background-color:#939297;">
    <table role="presentation" style="width:100%;border:none;border-spacing:0;">
      <tr>
        <td align="center" style="padding:0;">
          <!--[if mso]>
          <table role="presentation" align="center" style="width:600px;">
          <tr>
          <td>
          <![endif]-->
          <table role="presentation" style="width:94%;max-width:600px;border:none;border-spacing:0;text-align:left;font-family:Arial,sans-serif;font-size:16px;line-height:22px;color:#363636;">
            <tr>
              <td style="padding:40px 30px 30px 30px;text-align:center;font-size:24px;font-weight:bold;">
                <a href="'.$site_url.'" style="text-decoration:none;"><img src="'.$site_image.'" width="10" alt="Logo" style="width:10%">&nbsp;<span style="color:black;">'.$site_name.'</a>
              </td>
            </tr>



            <tr>
              <td style="padding:30px;background-color:#ffffff;">
                <h1 style="margin-top:0;margin-bottom:16px;font-size:26px;line-height:32px;font-weight:bold;letter-spacing:-0.02em;"><span style="color:#ff3884">Password Changed Successfully</span></h1>
                <h4>Dear <b>'.$firstname.' '.$lastname.'</b></h4>
                <br>
                <p>
                    Your requested password change has been effected and have been successfully changed to <b>'.$newword.'</b>.</p>
                
                <br> 
                
                And your account number still remains '.$accountnumber.'
                <br> 
                <br> 
                  You can now go ahead to login with your new password.
                    
                    <br>
                    <p style="margin:0;"><a href="'.$site_url.'/login.php" style="background: #ff3884; text-decoration: none; padding: 10px 25px; color: #ffffff; border-radius: 4px; display:inline-block; mso-padding-alt:0;text-underline-color:#ff3884"><!--[if mso]><i style="letter-spacing: 25px;mso-font-width:-100%;mso-text-raise:20pt">&nbsp;</i><![endif]--><span style="mso-text-raise:10pt;font-weight:bold;">Login Here</span><!--[if mso]><i style="letter-spacing: 25px;mso-font-width:-100%">&nbsp;</i><![endif]--></a></p>
            

          <p>Please you are advised to keep this email only to yourself for security of your password.</p>
              </td>
            </tr>
            <tr>
              <td style="padding:0;font-size:24px;line-height:28px;font-weight:bold;">
                <a href="#" style="text-decoration:none;"><img src="'.$site_url.'/passuccess.png" width="450" alt="" style="width:100%;height:auto;display:block;border:none;text-decoration:none;color:#363636;"></a>
              </td>
            </tr>
            <tr>
              <td style="padding:35px 30px 11px 30px;font-size:0;background-color:#ffffff;border-bottom:1px solid #f0f0f5;border-color:rgba(201,201,207,.35);">

                <div class="col-lge" style="display:inline-block;width:100%;max-width:395px;vertical-align:top;padding-bottom:20px;font-family:Arial,sans-serif;font-size:16px;line-height:22px;color:#363636;">
                  
                 
                  <br><br>
                  
                  <p>Best of luck!</p>
                  
            <h4>'.$site_name.' Team</h4>
            </div>
                </div>
                
                

              </td>
            </tr>
            
        <br>

<tr>
              <td style="padding:30px;text-align:center;font-size:12px;background-color:#404040;color:#cccccc;">
                <p style="margin:0 0 8px 0;"><a href="http://www.facebook.com/" style="text-decoration:none;"><img src="https://assets.codepen.io/210284/facebook_1.png" width="40" height="40" alt="f" style="display:inline-block;color:#cccccc;"></a> <a href="http://www.twitter.com/" style="text-decoration:none;"><img src="https://assets.codepen.io/210284/twitter_1.png" width="40" height="40" alt="t" style="display:inline-block;color:#cccccc;"></a></p>
                <p style="margin:0;font-size:14px;line-height:20px;"><b>Legal:</b> This email message is confidential and for use by the addressee only. If the message is received by anyone other than the addressee, please delete it from your computer. '.$site_name.', does not accept responsibility for changes made to this message after it was sent. Whilst all reasonable care has been taken to avoid the transmission of viruses, it is the responsibility of the recipient to ensure that onward transmission, opening or use of this message and any attachments will not adversely affect its systems or data. No responsibility is acepted by '.$site_name.' in this regard and the recipient should carry out such virus and other checks as it considers appropriate. <br><br><a class="unsub" href="#" style="color:#cccccc;text-decoration:underline;"><b>&copy; '.$site_name.' 2022 </b></a></p>
              </td>
            </tr>
          </table>
        </td>
      </tr>
    </table>
  </div>
</body>
</html>

 ';
 // Sending email
mail($to, $subject, $emailmsg, $headers);
           
	$msg =  "<div class=\"alert alert-success alert-dismissable\">
<button type=\"button\" class=\"close\" data-dismiss=\"alert\" aria-hidden=\"true\">&times;</button>	

Your Password Has Been Successfully Changed!

</div>";
}else{
	$msg =  "<div class=\"alert alert-danger alert-dismissable\">
<button type=\"button\" class=\"close\" data-dismiss=\"alert\" aria-hidden=\"true\">&times;</button>	

Some Problem Occurs, Please Try Again. 

</div>";
}
} else {
	
if ($err1 == 1){
$msg =  "<div class=\"alert alert-danger alert-dismissable\">
<button type=\"button\" class=\"close\" data-dismiss=\"alert\" aria-hidden=\"true\">&times;</button>	

Your Current Password Is Incorrect.

</div>";
}		
if ($err3 == 1){
$msg = "<div class=\"alert alert-danger alert-dismissable\">
<button type=\"button\" class=\"close\" data-dismiss=\"alert\" aria-hidden=\"true\">&times;</button>	

Password Can Not Be Empty.

</div>";
echo"<h1></h1>";
}		
if ($err4 == 1){
	$msg =  "<div class=\"alert alert-danger alert-dismissable\">
<button type=\"button\" class=\"close\" data-dismiss=\"alert\" aria-hidden=\"true\">&times;</button>	

Password Must Be Four Or More Characters.

</div>";
}
}
}
//End of change passwor


//Changing Of Pin    
if (isset($_POST['change_pin'])) {

$oldword = mysqli_real_escape_string($db,$_POST["old_pin"]);
$newword = mysqli_real_escape_string($db, $_POST["new_pin"]);


$cpass =  mysqli_fetch_array(mysqli_query($db,"SELECT pin FROM user WHERE accountnumber='".$accountnumber."'"));

//Check if the existing password matches
if ($cpass[0]!=$oldword){$err1=1;}

//If new password is empty
if(trim($newword)==""){$err3=1;}

//If new password is less than 4digits
if(strlen($newword)<=3){$err4=1;}

$error = $err1+$err3+$err4;


if ($error == 0){

$res =  mysqli_query($db, "UPDATE user SET pin='".$newword."' WHERE accountnumber='".$accountnumber."'");
if($res){
     
     //now send this email to client for password reset
  $to = $email ;
    
$subject = 'Pin Updated Successfully';

$from = $site_email;
 
// Setting html content type for email sending
$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
 
// Create email headers
$headers .= 'From: '.$from."\r\n".
    'Reply-To: '.$from."\r\n" .
    'X-Mailer: PHP/' . phpversion();
    
     $emailmsg = ' <!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml" xmlns:o="urn:schemas-microsoft-com:office:office">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width,initial-scale=1">
  <meta name="x-apple-disable-message-reformatting">
  <title></title>
  <!--[if mso]>
  <style>
    table {border-collapse:collapse;border-spacing:0;border:none;margin:0;}
    div, td {padding:0;}
    div {margin:0 !important;}
  </style>
  <noscript>
    <xml>
      <o:OfficeDocumentSettings>
        <o:PixelsPerInch>96</o:PixelsPerInch>
      </o:OfficeDocumentSettings>
    </xml>
  </noscript>
  <![endif]-->
  <style>
    table, td, div, h1, p {
      font-family: Arial, sans-serif;
    }
    @media screen and (max-width: 530px) {
      .unsub {
        display: block;
        padding: 8px;
        margin-top: 14px;
        border-radius: 6px;
        background-color: #555555;
        text-decoration: none !important;
        font-weight: bold;
      }
      .col-lge {
        max-width: 100% !important;
      }
    }
    @media screen and (min-width: 531px) {
      .col-sml {
        max-width: 27% !important;
      }
      .col-lge {
        max-width: 73% !important;
      }
    }
    
    
    
   


  </style>
</head>

<body style="margin:0;padding:0;word-spacing:normal;background-color:#939297;">
  <div role="article" aria-roledescription="email" lang="en" style="text-size-adjust:100%;-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%;background-color:#939297;">
    <table role="presentation" style="width:100%;border:none;border-spacing:0;">
      <tr>
        <td align="center" style="padding:0;">
          <!--[if mso]>
          <table role="presentation" align="center" style="width:600px;">
          <tr>
          <td>
          <![endif]-->
          <table role="presentation" style="width:94%;max-width:600px;border:none;border-spacing:0;text-align:left;font-family:Arial,sans-serif;font-size:16px;line-height:22px;color:#363636;">
            <tr>
              <td style="padding:40px 30px 30px 30px;text-align:center;font-size:24px;font-weight:bold;">
                <a href="'.$site_url.'" style="text-decoration:none;"><img src="'.$site_image.'" width="10" alt="Logo" style="width:10%">&nbsp;<span style="color:black;">'.$site_name.'</a>
              </td>
            </tr>




            <tr>
              <td style="padding:30px;background-color:#ffffff;">
                <h1 style="margin-top:0;margin-bottom:16px;font-size:26px;line-height:32px;font-weight:bold;letter-spacing:-0.02em;"><span style="color:#ff3884">Pin Updated Successfully</span></h1>
            <h4>Dear <b>'.$firstname.' '.$lastname.'</b></h4>
                <br>
                <p>
                    Your '.$site_name.' transaction pin has been successfully updated to <b>'.$newword.'</b>.
                   <br> 
                    
                    You are advised to keep this information away from a third party.</p>
                <br> <br>
                

          <p>Note: The Pin is meant to be used for your subsequent online banking transactions with '.$site_name.'.  </p>
              </td>
            </tr>
            <tr>
              <td style="padding:0;font-size:24px;line-height:28px;font-weight:bold;">
                <a href="#" style="text-decoration:none;"><img src="'.$site_url.'/admin/pinudate.png" width="600" alt="" style="width:100%;height:auto;display:block;border:none;text-decoration:none;color:#363636;"></a>
              </td>
            </tr>
            <tr>
              <td style="padding:35px 30px 11px 30px;font-size:0;background-color:#ffffff;border-bottom:1px solid #f0f0f5;border-color:rgba(201,201,207,.35);">

                <div class="col-lge" style="display:inline-block;width:100%;max-width:395px;vertical-align:top;padding-bottom:20px;font-family:Arial,sans-serif;font-size:16px;line-height:22px;color:#363636;">
                  <p style="margin-top:0;margin-bottom:12px;">Please keep your pin safe.</p>
                 
                  <br><br>
                  
                  
            <h4>'.$site_name.' Team</h4>
            </div>
                </div>
                
                

              </td>
            </tr>
            
        <br>

<tr>
              <td style="padding:30px;text-align:center;font-size:12px;background-color:#404040;color:#cccccc;">
                <p style="margin:0 0 8px 0;"><a href="http://www.facebook.com/" style="text-decoration:none;"><img src="https://assets.codepen.io/210284/facebook_1.png" width="40" height="40" alt="f" style="display:inline-block;color:#cccccc;"></a> <a href="http://www.twitter.com/" style="text-decoration:none;"><img src="https://assets.codepen.io/210284/twitter_1.png" width="40" height="40" alt="t" style="display:inline-block;color:#cccccc;"></a></p>
                <p style="margin:0;font-size:14px;line-height:20px;"><b>Legal:</b> This email message is confidential and for use by the addressee only. If the message is received by anyone other than the addressee, please delete it from your computer. '.$site_name.', does not accept responsibility for changes made to this message after it was sent. Whilst all reasonable care has been taken to avoid the transmission of viruses, it is the responsibility of the recipient to ensure that onward transmission, opening or use of this message and any attachments will not adversely affect its systems or data. No responsibility is acepted by '.$site_name.' in this regard and the recipient should carry out such virus and other checks as it considers appropriate. <br><br><a class="unsub" href="#" style="color:#cccccc;text-decoration:underline;"><b>&copy; '.$site_name.' 2022 </b></a></p>
              </td>
            </tr>
          </table>
        </td>
      </tr>
    </table>
  </div>
</body>
</html>

 ';
 // Sending email
mail($to, $subject, $emailmsg, $headers);
           
	$msg =  "<div class=\"alert alert-success alert-dismissable\">
<button type=\"button\" class=\"close\" data-dismiss=\"alert\" aria-hidden=\"true\">&times;</button>	

Your Transaction Pin Has Been Successfully Changed

</div>";
}else{
	$msg =  "<div class=\"alert alert-danger alert-dismissable\">
<button type=\"button\" class=\"close\" data-dismiss=\"alert\" aria-hidden=\"true\">&times;</button>	

Some Problem Occurs, Please Try Again. 

</div>";
}
} else {

if ($err1 == 1){
$msg =  "<div class=\"alert alert-danger alert-dismissable\">
<button type=\"button\" class=\"close\" data-dismiss=\"alert\" aria-hidden=\"true\">&times;</button>	

Your Old Pin Is Incorrect.

</div>";
}		
if ($err3 == 1){
$msg = "<div class=\"alert alert-danger alert-dismissable\">
<button type=\"button\" class=\"close\" data-dismiss=\"alert\" aria-hidden=\"true\">&times;</button>	

Pin Can Not Be Empty.

</div>";
echo"<h1></h1>";
}		
if ($err4 == 1){
	$msg =  "<div class=\"alert alert-danger alert-dismissable\">
<button type=\"button\" class=\"close\" data-dismiss=\"alert\" aria-hidden=\"true\">&times;</button>	

Pin Must Be Four Characters.

</div>";
}
}
}
//End of change pin


//Local Transfer   
if (isset($_POST['local_transfer'])) {

$receiver_bnk = mysqli_real_escape_string($db,$_POST["receiver_bnk"]);
$receiver_account = mysqli_real_escape_string($db, $_POST["receiver_account"]);
$account_number = mysqli_real_escape_string($db,$_POST["account_number"]);
$amount = mysqli_real_escape_string($db, $_POST["amount_transfer"]);
$pin = mysqli_real_escape_string($db,$_POST["transaction_pin"]);


$cpass =  mysqli_fetch_array(mysqli_query($db,"SELECT pin FROM user WHERE accountnumber='".$accountnumber."'"));

//Check if the pin matches
if ($cpass[0]!=$pin){$err1=1;}

//If new password is empty
if(trim($receiver_account)==""){$err3=1;}


$error = $err1+$err3;


if ($error == 0){
    
if($wallet < $amount){

$msg="<div class=\"alert alert-danger alert-dismissable\">
<button type=\"button\" class=\"close\" data-dismiss=\"alert\" aria-hidden=\"true\">&times;</button>
<b>Insufficient Fund.</b>
<br>You have only &#36;$wallet left in your account.

</div>";


}

if($wallet >= $amount){ 

$description = "Local Transfer To $account_number $receiver_bnk $receiver_account";
$newbal = $wallet - $amount;

$res = mysqli_query($db,"UPDATE user SET wallet='".$newbal."' WHERE accountnumber='".$accountnumber."'");
 
 mysqli_query($db,"INSERT INTO transaction SET accountnumber='".$accountnumber."', amount='".$amount."', prebalance='".$wallet."', postbalance='".$newbal."', status='Pending', ref='".$trx."', date='".$date."', time='".$time."', description='".$description."', sig='-'");  
 
$msg =  "<div class=\"alert alert-success alert-dismissable\">
<button type=\"button\" class=\"close\" data-dismiss=\"alert\" aria-hidden=\"true\">&times;</button>	

Your Transaction Has Been Successfully Processed

</div>";

}
}else {

if ($err1 == 1){
$msg =  "<div class=\"alert alert-danger alert-dismissable\">
<button type=\"button\" class=\"close\" data-dismiss=\"alert\" aria-hidden=\"true\">&times;</button>	

Your Transaction Pin Is Incorrect.

</div>";
}		
if ($err3 == 1){
$msg = "<div class=\"alert alert-danger alert-di+3-smissable\">
<button type=\"button\" class=\"close\" data-dismiss=\"alert\" aria-hidden=\"true\">&times;</button>	

Receiver's Account Type Can Not Be Empty.

</div>";
echo"<h1></h1>";
}		
}
}
//End Of Local Transfer  			


//International Transfer   
if (isset($_POST['inter_transfer'])) {

$receiver_name = mysqli_real_escape_string($db, $_POST["receiver_name"]);
$receiver_account = mysqli_real_escape_string($db,$_POST["receiver_account"]);
$receiver_bank = mysqli_real_escape_string($db,$_POST["receiver_bank"]);
$account_type = mysqli_real_escape_string($db,$_POST["account_type"]);
$receiver_address = mysqli_real_escape_string($db, $_POST["receiver_address"]);

$country = mysqli_real_escape_string($db,$_POST["country"]);
$routine_number = mysqli_real_escape_string($db, $_POST["routine_number"]);
$amount = mysqli_real_escape_string($db,$_POST["amount_transfer"]);
$reason_transfer = mysqli_real_escape_string($db, $_POST["reason_transfer"]);
//$pin = mysqli_real_escape_string($db,$_POST["transaction_pin"]);
$otcode = rand(1056,2084);

//$cpass =  mysqli_fetch_array(mysqli_query($db,"SELECT pin FROM user WHERE accountnumber='".$accountnumber."'"));

//Check if the pin matches
//if ($cpass[0]!=$pin){$err1=1;}

//If new password is empty

if($wallet < $amount){$err1=1;}

$error = $err1;


if ($error == 0){
    
$cpass =  mysqli_fetch_array(mysqli_query($db,"SELECT otp FROM user WHERE accountnumber='".$accountnumber."'"));

  mysqli_query($db,"UPDATE user SET otp='".$otcode."' WHERE accountnumber='".$accountnumber."'");

/*$description = "International Transfer To $receiver_account $receiver_bank $receiver_name $routine_number";
$newbal = $wallet - $amount;

$res = mysqli_query($db,"UPDATE user SET wallet='".$newbal."' WHERE accountnumber='".$accountnumber."'");*/
 
 mysqli_query($db,"INSERT INTO international_transfer SET accountnumber='".$accountnumber."', receiver_name='".$receiver_name."', receiver_account='".$receiver_account."', account_type='".$account_type."', receiver_bank='".$receiver_bank."', receiver_address='".$receiver_address."', country='".$country."', routine_number='".$routine_number."', amount_transfer='".$amount."', reason_transfer='".$reason_transfer."', status='Pending', ref='".$trx."', date='".$date."'");

if($code =="OFF"){
    
    
    echo '<script type="text/javascript">
     window.location.href= "'.$site_url.'/dashboard/pin.php?code='.$trx.'"
   </script>';}
if($code =="ON"){

echo '<script type="text/javascript">
     window.location.href="'.$site_url.'/dashboard/imf_code.php?code='.$trx.'"
   </script>';
}

}else {
if ($err1 == 1){
    
$msg="<div class=\"alert alert-danger alert-dismissable\">
<button type=\"button\" class=\"close\" data-dismiss=\"alert\" aria-hidden=\"true\">&times;</button>
<b>Insufficient Fund.</b>
<br>You have only &#36;$wallet left in your account.

</div>";

}		

}
}
//End Of International Transfer  	  


//IMF_Code Transfer
if (isset($_POST['imf_code'])) {

$a = mysqli_real_escape_string($db, $_POST["a"]);
$b = mysqli_real_escape_string($db,$_POST["b"]);
$c = mysqli_real_escape_string($db,$_POST["c"]);
$d = mysqli_real_escape_string($db,$_POST["d"]);
$get1 = $_GET['code'];

$imf_code= $a.$b.$c.$d;

$cpass =  mysqli_fetch_array(mysqli_query($db,"SELECT imfcode FROM user WHERE accountnumber='".$accountnumber."'"));

//Check if the imf_code matches
if ($cpass[0]!=$imf_code){$err1=1;}

$error = $err1;

if ($error == 0){
    
 
	
echo '<script type="text/javascript">
     window.location.href="'.$site_url.'/dashboard/ipn_code.php?code='.$get1.'"
   </script>';

}else {
if ($err1 == 1){
$msg = "<div class=\"alert alert-danger alert-dismissable\">

The IMF_Code is invaild

</div>";
}		
}
}
//End Of IMF_Code




//IPN_Code Transfer
if (isset($_POST['ipn_code'])) {

$a = mysqli_real_escape_string($db, $_POST["a"]);
$b = mysqli_real_escape_string($db,$_POST["b"]);
$c = mysqli_real_escape_string($db,$_POST["c"]);
$d = mysqli_real_escape_string($db,$_POST["d"]);
$get2 = $_GET['code'];


$ipn_code= $a.$b.$c.$d;

$cpass =  mysqli_fetch_array(mysqli_query($db,"SELECT ipncode FROM user WHERE accountnumber='".$accountnumber."'"));

//Check if the imf_code matches
if ($cpass[0]!=$ipn_code){$err1=1;}

$error = $err1;

if ($error == 0){
 

  
echo '<script type="text/javascript">
     window.location.href="'.$site_url.'/dashboard/cot_code.php?code='.$get2.'"
   </script>';

}else {
if ($err1 == 1){
$msg = "<div class=\"alert alert-danger alert-dismissable\">

The IPN_Code is invaild

</div>";
}		
}
}
//End Of IPN_Code


//COT_Code Transfer
if (isset($_POST['cot_code'])) {

$a = mysqli_real_escape_string($db, $_POST["a"]);
$b = mysqli_real_escape_string($db,$_POST["b"]);
$c = mysqli_real_escape_string($db,$_POST["c"]);
$d = mysqli_real_escape_string($db,$_POST["d"]);
$get3 = $_GET['code'];

$cot_code= $a.$b.$c.$d;

$cpass =  mysqli_fetch_array(mysqli_query($db,"SELECT cotcode FROM user WHERE accountnumber='".$accountnumber."'"));

//Check if the imf_code matches
if ($cpass[0]!=$cot_code){$err1=1;}

$error = $err1;

if ($error == 0){
    
 
echo '<script type="text/javascript">
     window.location.href="'.$site_url.'/dashboard/pin.php?code='.$get3.'"
   </script>';

}else {
if ($err1 == 1){
$msg = "<div class=\"alert alert-danger alert-dismissable\">

The COT_Code is invaild

</div>";
}		
}
}
//End Of COT_Code


//Pin Transfer
if (isset($_POST['pin'])) {

$a = mysqli_real_escape_string($db, $_POST["a"]);
$b = mysqli_real_escape_string($db,$_POST["b"]);
$c = mysqli_real_escape_string($db,$_POST["c"]);
$d = mysqli_real_escape_string($db,$_POST["d"]);
$get4 = $_GET['code'];

$pin= $a.$b.$c.$d;

$cpass =  mysqli_fetch_array(mysqli_query($db,"SELECT pin FROM user WHERE accountnumber='".$accountnumber."'"));



//Check if the imf_code matches
if ($cpass[0]!=$pin){$err1=1;}

$error = $err1;

if ($error == 0){
    
    $cotp =  mysqli_fetch_array(mysqli_query($db,"SELECT otp FROM user WHERE accountnumber='".$accountnumber."'"));
    
    //email to user for otp
     //now send this email to client for password reset
  $to = $email ;
    
$subject = 'One Time Password';

$from = $site_email;
 
// Setting html content type for email sending
$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
 
// Create email headers
$headers .= 'From: '.$from."\r\n".
    'Reply-To: '.$from."\r\n" .
    'X-Mailer: PHP/' . phpversion();
    
     $emailmsg = ' <!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml" xmlns:o="urn:schemas-microsoft-com:office:office">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width,initial-scale=1">
  <meta name="x-apple-disable-message-reformatting">
  <title></title>
  <!--[if mso]>
  <style>
    table {border-collapse:collapse;border-spacing:0;border:none;margin:0;}
    div, td {padding:0;}
    div {margin:0 !important;}
  </style>
  <noscript>
    <xml>
      <o:OfficeDocumentSettings>
        <o:PixelsPerInch>96</o:PixelsPerInch>
      </o:OfficeDocumentSettings>
    </xml>
  </noscript>
  <![endif]-->
  <style>
    table, td, div, h1, p {
      font-family: Arial, sans-serif;
    }
    @media screen and (max-width: 530px) {
      .unsub {
        display: block;
        padding: 8px;
        margin-top: 14px;
        border-radius: 6px;
        background-color: #555555;
        text-decoration: none !important;
        font-weight: bold;
      }
      .col-lge {
        max-width: 100% !important;
      }
    }
    @media screen and (min-width: 531px) {
      .col-sml {
        max-width: 27% !important;
      }
      .col-lge {
        max-width: 73% !important;
      }
    }
    
    
    
   


  </style>
</head>

<body style="margin:0;padding:0;word-spacing:normal;background-color:#939297;">
  <div role="article" aria-roledescription="email" lang="en" style="text-size-adjust:100%;-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%;background-color:#939297;">
    <table role="presentation" style="width:100%;border:none;border-spacing:0;">
      <tr>
        <td align="center" style="padding:0;">
          <!--[if mso]>
          <table role="presentation" align="center" style="width:600px;">
          <tr>
          <td>
          <![endif]-->
          <table role="presentation" style="width:94%;max-width:600px;border:none;border-spacing:0;text-align:left;font-family:Arial,sans-serif;font-size:16px;line-height:22px;color:#363636;">
            <tr>
              <td style="padding:40px 30px 30px 30px;text-align:center;font-size:24px;font-weight:bold;">
                <a href="'.$site_url.'" style="text-decoration:none;"><img src="'.$site_image.'" width="10" alt="Logo" style="width:10%">&nbsp;<span style="color:black;">'.$site_name.'</a>
              </td>
            </tr>



            <tr>
              <td style="padding:30px;background-color:#ffffff;">
                <h1 style="margin-top:0;margin-bottom:16px;font-size:26px;line-height:32px;font-weight:bold;letter-spacing:-0.02em;"><span style="color:#ff3884">International Fund Transfer!</span></h1>
                <h4>Dear <b>'.$firstname.' '.$lastname.'</b></h4>
                <br>
                <p>
                    You are directed to use this OTP(One Time Password) in the proceeding page of your Fund Transfer Process. Note that it is time sensitive</p>
                
                <br> 
                Here is your One Time Password 
               <h2>'.$cotp[0].'</h2>.
               <hr>
               Please Keep this digit safe away from third party.
                <br> 
            
                    <br>
                    <p style="margin:0;"><a href="'.$site_url.'/login.php" style="background: #ff3884; text-decoration: none; padding: 10px 25px; color: #ffffff; border-radius: 4px; display:inline-block; mso-padding-alt:0;text-underline-color:#ff3884"><!--[if mso]><i style="letter-spacing: 25px;mso-font-width:-100%;mso-text-raise:20pt">&nbsp;</i><![endif]--><span style="mso-text-raise:10pt;font-weight:bold;">Login Here</span><!--[if mso]><i style="letter-spacing: 25px;mso-font-width:-100%">&nbsp;</i><![endif]--></a></p>
            


              </td>
            </tr>
            <tr>
              <td style="padding:0;font-size:24px;line-height:28px;font-weight:bold;">
                <a href="#" style="text-decoration:none;"><img src="'.$site_url.'/passuccess.png" width="450" alt="" style="width:100%;height:auto;display:block;border:none;text-decoration:none;color:#363636;"></a>
              </td>
            </tr>
            <tr>
              <td style="padding:35px 30px 11px 30px;font-size:0;background-color:#ffffff;border-bottom:1px solid #f0f0f5;border-color:rgba(201,201,207,.35);">

                <div class="col-lge" style="display:inline-block;width:100%;max-width:395px;vertical-align:top;padding-bottom:20px;font-family:Arial,sans-serif;font-size:16px;line-height:22px;color:#363636;">
                  
                 
                  <br><br>
                  
                  <p>Best of luck!</p>
                  
            <h4>'.$site_name.' Team</h4>
            </div>
                </div>
                
                

              </td>
            </tr>
            
        <br>

<tr>
              <td style="padding:30px;text-align:center;font-size:12px;background-color:#404040;color:#cccccc;">
                <p style="margin:0 0 8px 0;"><a href="http://www.facebook.com/" style="text-decoration:none;"><img src="https://assets.codepen.io/210284/facebook_1.png" width="40" height="40" alt="f" style="display:inline-block;color:#cccccc;"></a> <a href="http://www.twitter.com/" style="text-decoration:none;"><img src="https://assets.codepen.io/210284/twitter_1.png" width="40" height="40" alt="t" style="display:inline-block;color:#cccccc;"></a></p>
                <p style="margin:0;font-size:14px;line-height:20px;"><b>Legal:</b> This email message is confidential and for use by the addressee only. If the message is received by anyone other than the addressee, please delete it from your computer. '.$site_name.', does not accept responsibility for changes made to this message after it was sent. Whilst all reasonable care has been taken to avoid the transmission of viruses, it is the responsibility of the recipient to ensure that onward transmission, opening or use of this message and any attachments will not adversely affect its systems or data. No responsibility is acepted by '.$site_name.' in this regard and the recipient should carry out such virus and other checks as it considers appropriate. <br><br><a class="unsub" href="#" style="color:#cccccc;text-decoration:underline;"><b>&copy; '.$site_name.' 2022 </b></a></p>
              </td>
            </tr>
          </table>
        </td>
      </tr>
    </table>
  </div>
</body>
</html>

 ';
 // Sending email
mail($to, $subject, $emailmsg, $headers);

echo '<script type="text/javascript">
     window.location.href="'.$site_url.'/dashboard/otp.php?code='.$get4.'"
   </script>';
}
// if($error == 0 && $code=="ON"){
    
//     $cotp =  mysqli_fetch_array(mysqli_query($db,"SELECT otp FROM user WHERE accountnumber='".$accountnumber."'"));
    
//     //email to user for otp
//      //now send this email to client for password reset
//   $to = $email ;
    
// $subject = 'One Time Password';

// $from = $site_email;
 
// // Setting html content type for email sending
// $headers  = 'MIME-Version: 1.0' . "\r\n";
// $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
 
// // Create email headers
// $headers .= 'From: '.$from."\r\n".
//     'Reply-To: '.$from."\r\n" .
//     'X-Mailer: PHP/' . phpversion();
    
//      $emailmsg = ' <!DOCTYPE html>
// <html lang="en" xmlns="http://www.w3.org/1999/xhtml" xmlns:o="urn:schemas-microsoft-com:office:office">
// <head>
//   <meta charset="utf-8">
//   <meta name="viewport" content="width=device-width,initial-scale=1">
//   <meta name="x-apple-disable-message-reformatting">
//   <title></title>
//   <!--[if mso]>
//   <style>
//     table {border-collapse:collapse;border-spacing:0;border:none;margin:0;}
//     div, td {padding:0;}
//     div {margin:0 !important;}
//   </style>
//   <noscript>
//     <xml>
//       <o:OfficeDocumentSettings>
//         <o:PixelsPerInch>96</o:PixelsPerInch>
//       </o:OfficeDocumentSettings>
//     </xml>
//   </noscript>
//   <![endif]-->
//   <style>
//     table, td, div, h1, p {
//       font-family: Arial, sans-serif;
//     }
//     @media screen and (max-width: 530px) {
//       .unsub {
//         display: block;
//         padding: 8px;
//         margin-top: 14px;
//         border-radius: 6px;
//         background-color: #555555;
//         text-decoration: none !important;
//         font-weight: bold;
//       }
//       .col-lge {
//         max-width: 100% !important;
//       }
//     }
//     @media screen and (min-width: 531px) {
//       .col-sml {
//         max-width: 27% !important;
//       }
//       .col-lge {
//         max-width: 73% !important;
//       }
//     }
    
    
    
   


//   </style>
// </head>

// <body style="margin:0;padding:0;word-spacing:normal;background-color:#939297;">
//   <div role="article" aria-roledescription="email" lang="en" style="text-size-adjust:100%;-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%;background-color:#939297;">
//     <table role="presentation" style="width:100%;border:none;border-spacing:0;">
//       <tr>
//         <td align="center" style="padding:0;">
//           <!--[if mso]>
//           <table role="presentation" align="center" style="width:600px;">
//           <tr>
//           <td>
//           <![endif]-->
//           <table role="presentation" style="width:94%;max-width:600px;border:none;border-spacing:0;text-align:left;font-family:Arial,sans-serif;font-size:16px;line-height:22px;color:#363636;">
//             <tr>
//               <td style="padding:40px 30px 30px 30px;text-align:center;font-size:24px;font-weight:bold;">
//                 <a href="'.$site_url.'" style="text-decoration:none;"><img src="'.$site_image.'" width="10" alt="Logo" style="width:10%">&nbsp;<span style="color:black;">'.$site_name.'</a>
//               </td>
//             </tr>



//             <tr>
//               <td style="padding:30px;background-color:#ffffff;">
//                 <h1 style="margin-top:0;margin-bottom:16px;font-size:26px;line-height:32px;font-weight:bold;letter-spacing:-0.02em;"><span style="color:#ff3884">International Fund Transfer!</span></h1>
//                 <h4>Dear <b>'.$firstname.' '.$lastname.'</b></h4>
//                 <br>
//                 <p>
//                     You are directed to use this OTP(One Time Password) in the proceeding page of your Fund Transfer Process. Note that it is time sensitive</p>
                
//                 <br> 
//                 Here is your One Time Password 
//               <h2>'.$cotp[0].'</h2>.
//               <hr>
//               Please Keep this digit safe away from third party.
//                 <br> 
            
//                     <br>
//                     <p style="margin:0;"><a href="'.$site_url.'/login.php" style="background: #ff3884; text-decoration: none; padding: 10px 25px; color: #ffffff; border-radius: 4px; display:inline-block; mso-padding-alt:0;text-underline-color:#ff3884"><!--[if mso]><i style="letter-spacing: 25px;mso-font-width:-100%;mso-text-raise:20pt">&nbsp;</i><![endif]--><span style="mso-text-raise:10pt;font-weight:bold;">Login Here</span><!--[if mso]><i style="letter-spacing: 25px;mso-font-width:-100%">&nbsp;</i><![endif]--></a></p>
            


//               </td>
//             </tr>
//             <tr>
//               <td style="padding:0;font-size:24px;line-height:28px;font-weight:bold;">
//                 <a href="#" style="text-decoration:none;"><img src="'.$site_url.'/passuccess.png" width="450" alt="" style="width:100%;height:auto;display:block;border:none;text-decoration:none;color:#363636;"></a>
//               </td>
//             </tr>
//             <tr>
//               <td style="padding:35px 30px 11px 30px;font-size:0;background-color:#ffffff;border-bottom:1px solid #f0f0f5;border-color:rgba(201,201,207,.35);">

//                 <div class="col-lge" style="display:inline-block;width:100%;max-width:395px;vertical-align:top;padding-bottom:20px;font-family:Arial,sans-serif;font-size:16px;line-height:22px;color:#363636;">
                  
                 
//                   <br><br>
                  
//                   <p>Best of luck!</p>
                  
//             <h4>'.$site_name.' Team</h4>
//             </div>
//                 </div>
                
                

//               </td>
//             </tr>
            
//         <br>

// <tr>
//               <td style="padding:30px;text-align:center;font-size:12px;background-color:#404040;color:#cccccc;">
//                 <p style="margin:0 0 8px 0;"><a href="http://www.facebook.com/" style="text-decoration:none;"><img src="https://assets.codepen.io/210284/facebook_1.png" width="40" height="40" alt="f" style="display:inline-block;color:#cccccc;"></a> <a href="http://www.twitter.com/" style="text-decoration:none;"><img src="https://assets.codepen.io/210284/twitter_1.png" width="40" height="40" alt="t" style="display:inline-block;color:#cccccc;"></a></p>
//                 <p style="margin:0;font-size:14px;line-height:20px;"><b>Legal:</b> This email message is confidential and for use by the addressee only. If the message is received by anyone other than the addressee, please delete it from your computer. '.$site_name.', does not accept responsibility for changes made to this message after it was sent. Whilst all reasonable care has been taken to avoid the transmission of viruses, it is the responsibility of the recipient to ensure that onward transmission, opening or use of this message and any attachments will not adversely affect its systems or data. No responsibility is acepted by '.$site_name.' in this regard and the recipient should carry out such virus and other checks as it considers appropriate. <br><br><a class="unsub" href="#" style="color:#cccccc;text-decoration:underline;"><b>&copy; '.$site_name.' 2022 </b></a></p>
//               </td>
//             </tr>
//           </table>
//         </td>
//       </tr>
//     </table>
//   </div>
// </body>
// </html>

//  ';
//  // Sending email
// mail($to, $subject, $emailmsg, $headers);
    
 
// echo '<script type="text/javascript">
//      window.location.href="'.$site_url.'/dashboard/otp.php?code='.$get4.'"
//   </script>';

// }

else {
if ($err1 == 1){
$msg = "<div class=\"alert alert-danger alert-dismissable\">

Your Transaction Pin Is Incorrect

</div>";
}		
}
}
//End Of Pin


//OTP Transfer
if (isset($_POST['otp'])) {

$a = mysqli_real_escape_string($db, $_POST["a"]);
$b = mysqli_real_escape_string($db,$_POST["b"]);
$c = mysqli_real_escape_string($db,$_POST["c"]);
$d = mysqli_real_escape_string($db,$_POST["d"]);
$get5 = $_GET['code'];
$ref = substr($get5, 0, 1);

$otp= $a.$b.$c.$d;

$cpass =  mysqli_fetch_array(mysqli_query($db,"SELECT otp FROM user WHERE accountnumber='".$accountnumber."'"));

//Check if otp matches
if ($cpass[0]!=$otp){
    
$msg = "<div class=\"alert alert-danger alert-dismissable\">

The OTP is invaild

</div>";
}else if ($ref == "L"){
    
    
     
    $deduct =  mysqli_fetch_array(mysqli_query($db,"SELECT accountnumber, amount FROM transaction WHERE ref='".$get5."'"));
        $account_number = $deduct[0];
        $transfer_amt = $deduct[1];
      

    $d_wallet =  mysqli_fetch_array(mysqli_query($db,"SELECT wallet FROM user WHERE accountnumber='".$account_number."'"));
    
    
$newbal = $d_wallet[0] - $transfer_amt;

 mysqli_query($db,"UPDATE user SET wallet='".$newbal."' WHERE accountnumber='".$account_number."'");
 
  mysqli_query($db,"UPDATE transaction SET status='Pending', postbalance='".$newbal."', WHERE accountnumber='".$account_number."'");
    
  

 $msg = '<script>Swal.fire({type:"success", title:"Transfer Done", text:"Your Local Transfer Is Successful",position:"top",showConfirmButton:true}).then(function() {
                     window.location = "index.php";
                   });</script>
 ';


}else{
    
    $deduct =  mysqli_fetch_array(mysqli_query($db,"SELECT accountnumber,receiver_account, receiver_bank, amount_transfer, date FROM international_transfer WHERE ref='".$get5."'"));
        $account_number = $deduct[0];
        $receiver_account = $deduct[1];
        $receiver_bnk = $deduct[2];
        $transfer_amt = $deduct[3];
        $date = $deduct[4];
        $time = $deduct[5];

    $d_wallet =  mysqli_fetch_array(mysqli_query($db,"SELECT wallet FROM user WHERE accountnumber='".$account_number."'"));
    
    $description = "International Transfer To $account_number $receiver_bnk $receiver_account";
    
$newbal = $d_wallet[0] - $transfer_amt;

 mysqli_query($db,"UPDATE user SET wallet='".$newbal."' WHERE accountnumber='".$account_number."'");
    
    date_default_timezone_set("America/New_York");
   $time= date("h:i:sa");
     mysqli_query($db,"INSERT INTO transaction SET accountnumber='".$account_number."', amount='".$transfer_amt."', prebalance='".$d_wallet[0]."', postbalance='".$newbal."', status='Successful', ref='".$get5."', date='".$date."', time='".$time."', description='".$description."', sig='-'");  
 
// $msg = "<div class=\"alert alert-success alert-dismissable\">

// Your International Transfer Is Successful


// </div>";

 $msg = '<script>Swal.fire({type:"success", title:"Transfer Done", text:"Your International Transfer Is Successful",position:"top",showConfirmButton:true}).then(function() {
                     window.location = "index.php";
                   });</script>
 ';

// header('refresh:1;url= '.$site_url.'/dashboard/index.php');

}
}
//End Of OTP


//Direct Transfer   
if (isset($_POST['direct_transfer'])) {

$receiver_acct = mysqli_real_escape_string($db,$_POST["b_acct_number"]);
$amount = mysqli_real_escape_string($db, $_POST["direct_amt"]);
$pin = mysqli_real_escape_string($db,$_POST["transaction_pin"]);


$cpass =  mysqli_fetch_array(mysqli_query($db,"SELECT pin FROM user WHERE accountnumber='".$accountnumber."'"));

$cpas =  mysqli_fetch_array(mysqli_query($db,"SELECT accountnumber, wallet, firstname, lastname FROM user WHERE accountnumber='".$receiver_acct."'"));

//Check if the pin matches
if ($cpass[0]!=$pin){$err1=1;}

//Check if the beneficiary account matches
if ($cpas[0]!=$receiver_acct){$err2=1;}


$error = $err1+$err2;


if ($error == 0){
    
if($wallet < $amount){

$msg="<div class=\"alert alert-danger alert-dismissable\">
<button type=\"button\" class=\"close\" data-dismiss=\"alert\" aria-hidden=\"true\">&times;</button>
<b>Insufficient Fund.</b>
<br>You have only &#36;$wallet left in your account.

</div>";


}

if($wallet >= $amount){ 

$description = "Direct Transfer Of &#36;$amount To $receiver_acct $cpas[2] $cpas[3]";
$descriptionn = "$accountnumber $firstname $lastname Transffered &#36;$amount To You";
$newbal = $wallet - $amount;
$newball = $cpas[1] + $amount;

$res = mysqli_query($db,"UPDATE user SET wallet='".$newbal."' WHERE accountnumber='".$accountnumber."'");
$res = mysqli_query($db,"UPDATE user SET wallet='".$newball."' WHERE accountnumber='".$receiver_acct."'");
 
 mysqli_query($db,"INSERT INTO transaction SET accountnumber='".$accountnumber."', amount='".$amount."', prebalance='".$wallet."', postbalance='".$newbal."', status='Successful', ref='".$trx."', date='".$date."', time='".$time."', description='".$description."', sig='-'");
 
  mysqli_query($db,"INSERT INTO transaction SET accountnumber='".$receiver_acct."', amount='".$amount."', prebalance='".$cpas[1]."', postbalance='".$newball."', status='Successful', ref='".$trx."', date='".$date."', time='".$time."', description='".$descriptionn."', sig='+'");
 
$msg =  "<div class=\"alert alert-success alert-dismissable\">
<button type=\"button\" class=\"close\" data-dismiss=\"alert\" aria-hidden=\"true\">&times;</button>	

You Have Successfully Transferred &#36;$amount To $receiver_acct $cpas[2] $cpas[3]

</div>";

}
}else {

if ($err1 == 1){
$msg =  "<div class=\"alert alert-danger alert-dismissable\">
<button type=\"button\" class=\"close\" data-dismiss=\"alert\" aria-hidden=\"true\">&times;</button>	

Your Transaction Pin Is Incorrect.

</div>";
}
if ($err2 == 1){
$msg =  "<div class=\"alert alert-danger alert-dismissable\">
<button type=\"button\" class=\"close\" data-dismiss=\"alert\" aria-hidden=\"true\">&times;</button>	

$receiver_acct is not registered with us

</div>";
}
}
}
//End Of Direct Transfer  


//Uploading Pics   
if (isset($_POST['upload'])) {

$receiver_bnk = mysqli_real_escape_string($db,$_POST["receiver_bnk"]);
$receiver_account = mysqli_real_escape_string($db, $_POST["receiver_account"]);
$account_number = mysqli_real_escape_string($db,$_POST["account_number"]);
$amount = mysqli_real_escape_string($db, $_POST["amount_transfer"]);
$pin = mysqli_real_escape_string($db,$_POST["transaction_pin"]);

$target_dir = "avatar/";
$target_file = $target_dir . basename($_FILES["fileToUpload"]["name"]);
$pname = basename($_FILES["fileToUpload"]["name"]);
$uploadOk = 1;
$imageFileType = strtolower(pathinfo($target_file,PATHINFO_EXTENSION));
 $check = getimagesize($_FILES["fileToUpload"]["tmp_name"]);

//Check if the pin matches
if($check == false){$err1=1;}

if($_FILES["fileToUpload"]["size"] > 500000){$err2=1;}

if($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg"
&& $imageFileType != "gif" ){$err3=1;}

$error = $err1+$err2+$err3;


if ($error == 0){

$res = mysqli_query($db,"UPDATE user SET avatar='".$pname."' WHERE accountnumber='".$accountnumber."'");
 move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $target_file);
$msg =  "<div class=\"alert alert-success alert-dismissable\">
<button type=\"button\" class=\"close\" data-dismiss=\"alert\" aria-hidden=\"true\">&times;</button>	

The file ". htmlspecialchars( basename( $_FILES["fileToUpload"]["name"])). " has been uploaded.

</div>";

}else {

if ($err1 == 1){
$msg =  "<div class=\"alert alert-danger alert-dismissable\">
<button type=\"button\" class=\"close\" data-dismiss=\"alert\" aria-hidden=\"true\">&times;</button>	

File is not an image.

</div>";
}	

if ($err2 == 1){
$msg =  "<div class=\"alert alert-danger alert-dismissable\">
<button type=\"button\" class=\"close\" data-dismiss=\"alert\" aria-hidden=\"true\">&times;</button>	

Sorry, your photo is too large..

</div>";
}

if ($err3 == 1){
$msg =  "<div class=\"alert alert-danger alert-dismissable\">
<button type=\"button\" class=\"close\" data-dismiss=\"alert\" aria-hidden=\"true\">&times;</button>	

Sorry, only JPG, JPEG, PNG & GIF files are allowed.

</div>";
}
		
}
}
//End Of Uploading Pics


//Changing Profile  
if (isset($_POST['profile'])) {

$f_name = mysqli_real_escape_string($db,$_POST["f_name"]);
$l_name = mysqli_real_escape_string($db, $_POST["l_name"]);
$country = mysqli_real_escape_string($db,$_POST["country"]);
$city = mysqli_real_escape_string($db, $_POST["city"]);
$phone = mysqli_real_escape_string($db,$_POST["phone"]);
$email = mysqli_real_escape_string($db,$_POST["email"]);



$res = mysqli_query($db,"UPDATE user SET firstname='".$f_name."', lastname='".$l_name."', phone='".$phone."', email='".$email."', city='".$city."', country='".$country."' WHERE accountnumber='".$accountnumber."'");

$msg =  "<div class=\"alert alert-success alert-dismissable\">
<button type=\"button\" class=\"close\" data-dismiss=\"alert\" aria-hidden=\"true\">&times;</button>	

Your Profile Has Been Successfully Updated

</div>";


}
//End Of Changing Profile

?>


