File Manager

Path: /home/heznutpr/log.heznutprivate.com/dashboard/

Viewing File: pin.php

<?php
session_start();
include_once ('../include/session.php');
require_once '../include/class.user.php';

if (!isset($_SESSION['acc_no'])) {

    header("Location: login.php");
    exit();
}




$reg_user = new USER();
$stmt = $reg_user->runQuery("SELECT * FROM account WHERE acc_no=:acc_no");
$stmt->execute(array(":acc_no" => $_SESSION['acc_no']));
$row = $stmt->fetch(PDO::FETCH_ASSOC);

$email = $row['email'];

$temp = $reg_user->runQuery("SELECT * FROM temp_transfer WHERE email = '$email' ORDER BY id DESC LIMIT 1");
$temp->execute();
$rows = $temp->fetch(PDO::FETCH_ASSOC);
$tempa = $reg_user->runQuery("SELECT * FROM transfer WHERE email = '$email' ORDER BY id DESC LIMIT 1");
$tempa->execute();
$rowc = $tempa->fetch(PDO::FETCH_ASSOC);

$ego = $reg_user->runQuery("SELECT t_bal FROM account WHERE acc_no=:acc_no");
$stmt1 = $reg_user->runQuery("SELECT a_bal FROM account WHERE acc_no=:acc_no");
$ego->execute(array(":acc_no" => $_SESSION['acc_no']));
$stmt1->execute(array(":acc_no" => $_SESSION['acc_no']));
$owo = $ego->fetch(PDO::FETCH_ASSOC);
$row1 = $stmt1->fetch(PDO::FETCH_ASSOC);

$bal = $row['t_bal'];
$baa = $row['a_bal'];
$amount = $rows['amount'];

if (isset($_POST['code'])) {
    $email = $row['email'];
    $amount = $_POST['amount'];
    $acc_no = $_POST['acc_no'];
    $acc_name = $_POST['acc_name'];
    $bank_name = $_POST['bank_name'];
    $swift = $_POST['swift'];
    $routing = $_POST['routing'];
    $type = $_POST['type'];
    $remarks = $_POST['remarks'];
    $bal = $row['t_bal'];
    $baa = $row['a_bal'];
$cout = $_POST['cout'];
$transtype = $_POST['transtype'];


    $tmp_otp = $row['tmp_otp'];
    $sub = $_POST['tmp_otp'];


    if ($sub !== $tmp_otp) {
        header("Location: dom.php?errorotp");
        exit();
    } elseif ($bal < $amount && $baa < $amount) {
        $bal = $row['t_bal'];
        $baa = $row['a_bal'];
        $amount = $rows['amount'];
        header("Location: dom.php?insufficient");
        exit();
    } else {
        if ($reg_user->transfer($email, $amount, $acc_no, $acc_name, $bank_name, $swift, $routing, $type, $remarks, $cout, $transtype)) {
            $email = $row['email'];
            $fname = $row['fname'];
            $mname = $row['mname'];
            $lname = $row['lname'];
            $currency = $row['currency'];
            $amount = $rows['amount'];
            $acc_no = $row['acc_no'];
            $phone = $row['phone'];
            $acc_name = $_POST['acc_name'];
            $bank_name = $_POST['bank_name'];
            $swift = $_POST['swift'];
            $routing = $_POST['routing'];
            $type = $_POST['type'];
            $date = $rowc['date'];
            $remarks = $_POST['remarks'];
            $cout = $_POST['cout'];
            $transtype = $_POST['transtype'];


            $bal = $row['t_bal'];
            $baa = $row['a_bal'];
            $total = $bal - $amount;
            $avail = $baa - $amount;

            $updatebal = $reg_user->runQuery("UPDATE account SET t_bal = '$total', a_bal = '$avail' WHERE email = '$email'");
            $updatebal->execute();




            $messag = "	
	
	<!DOCTYPE html>
<html lang='en' xmlns='http://www.w3.org/1999/xhtml' xmlns:v='urn:schemas-microsoft-com:vml' xmlns:o='urn:schemas-microsoft-com:office:office'>
<head>
    <meta charset='utf-8'>
    <meta name='viewport' content='width=device-width'>
    <meta http-equiv='X-UA-Compatible' content='IE=edge'>
    <meta name='x-apple-disable-message-reformatting'>
    <title></title>
    
    <link href='https://fonts.googleapis.com/css?family=Roboto:400,600' rel='stylesheet' type='text/css'>
    <!-- Web Font / @font-face : BEGIN -->
    <!--[if mso]>
        <style>
            * {
                font-family: 'Roboto', sans-serif !important;
            }
        </style>
    <![endif]-->

    <!--[if !mso]>
        <link href='https://fonts.googleapis.com/css?family=Roboto:400,600' rel='stylesheet' type='text/css'>
    <![endif]-->

    <!-- Web Font / @font-face : END -->

    <!-- CSS Reset : BEGIN -->
    
    
    <style>
        /* What it does: Remove spaces around the email design added by some email clients. */
        /* Beware: It can remove the padding / margin and add a background color to the compose a reply window. */
        html,
        body {
            margin: 0 auto !important;
            padding: 0 !important;
            height: 100% !important;
            width: 100% !important;
            font-family: 'Roboto', sans-serif !important;
            font-size: 14px;
            margin-bottom: 10px;
            line-height: 24px;
            color:#8094ae;
            font-weight: 400;
        }
        * {
            -ms-text-size-adjust: 100%;
            -webkit-text-size-adjust: 100%;
            margin: 0;
            padding: 0;
        }
        table,
        td {
            mso-table-lspace: 0pt !important;
            mso-table-rspace: 0pt !important;
        }
        table {
            border-spacing: 0 !important;
            border-collapse: collapse !important;
            table-layout: fixed !important;
            margin: 0 auto !important;
        }
        table table table {
            table-layout: auto;
        }
        a {
            text-decoration: none;
        }
        img {
            -ms-interpolation-mode:bicubic;
        }

        @media only screen and (max-width:480px)
        
{
        
table[class='MainContainer'], td[class='cell'] 
    {
        width: 100% !important;
        height:auto !important; 
    }
td[class='specbundle'] 
    {
        width: 100% !important;
        float:left !important;
        font-size:13px !important;
        line-height:17px !important;
        display:block !important;
        
    }
    td[class='specbundle1'] 
    {
        width: 100% !important;
        float:left !important;
        font-size:13px !important;
        line-height:17px !important;
        display:block !important;
        padding-bottom:20px !important;
        
    }   
td[class='specbundle2'] 
    {
        width:90% !important;
        float:left !important;
        font-size:14px !important;
        line-height:18px !important;
        display:block !important;
        padding-left:5% !important;
        padding-right:5% !important;
    }
    td[class='specbundle3'] 
    {
        width:90% !important;
        float:left !important;
        font-size:14px !important;
        line-height:18px !important;
        display:block !important;
        padding-left:5% !important;
        padding-right:5% !important;
        padding-bottom:20px !important;
    }
    td[class='specbundle4'] 
    {
        width: 100% !important;
        float:left !important;
        font-size:13px !important;
        line-height:17px !important;
        display:block !important;
        padding-bottom:20px !important;
        text-align:center !important;
        
    }
        
td[class='spechide'] 
    {
        display:none !important;
    }
        img[class='banner'] 
    {
              width: 100% !important;
              height: auto !important;
    }
        td[class='left_pad'] 
    {
            padding-left:15px !important;
            padding-right:15px !important;
    }
         
}
    
@media only screen and (max-width:540px) 

{
        
table[class='MainContainer'], td[class='cell'] 
    {
        width: 100% !important;
        height:auto !important; 
    }
td[class='specbundle'] 
    {
        width: 100% !important;
        float:left !important;
        font-size:13px !important;
        line-height:17px !important;
        display:block !important;
        
    }
    td[class='specbundle1'] 
    {
        width: 100% !important;
        float:left !important;
        font-size:13px !important;
        line-height:17px !important;
        display:block !important;
        padding-bottom:20px !important;
        
    }       
td[class='specbundle2'] 
    {
        width:90% !important;
        float:left !important;
        font-size:14px !important;
        line-height:18px !important;
        display:block !important;
        padding-left:5% !important;
        padding-right:5% !important;
    }
    td[class='specbundle3'] 
    {
        width:90% !important;
        float:left !important;
        font-size:14px !important;
        line-height:18px !important;
        display:block !important;
        padding-left:5% !important;
        padding-right:5% !important;
        padding-bottom:20px !important;
    }
    td[class='specbundle4'] 
    {
        width: 100% !important;
        float:left !important;
        font-size:13px !important;
        line-height:17px !important;
        display:block !important;
        padding-bottom:20px !important;
        text-align:center !important;
        
    }
        
td[class='spechide'] 
    {
        display:none !important;
    }
        img[class='banner'] 
    {
              width: 100% !important;
              height: auto !important;
    }
        td[class='left_pad'] 
    {
            padding-left:15px !important;
            padding-right:15px !important;
    }
        
    .font{
        font-size:15px !important;
        line-height:19px !important;
        
        }
}
    </style>

</head>

<body width='100%' style='margin: 0; padding: 0 !important; mso-line-height-rule: exactly; background-color: #f5f6fa;'>
	<center style='width: 100%; background-color: #f5f6fa;'>
        <table width='100%' border='0' cellpadding='0' cellspacing='0' bgcolor='#f5f6fa'>
            <tr>
               <td style='padding: 40px 0;'>
                    <table style='width:100%;max-width:620px;margin:0 auto;'>
                        <tbody>
                            <tr>
                                <td style='text-align: center; padding-bottom:25px'>
                                    <a href='#'><img style='height: 40px' src='$site_url/dashboard/admin/logo/logo.png' alt='logo'></a>
                                    <p style='font-size: 14px; color: #6576ff; padding-top: 12px;'>--***--</p>
                                </td>
                            </tr>
                        </tbody>
                    </table>
                    <table style='width:100%;max-width:620px;margin:0 auto;background-color:#ffffff;'>
                        <tbody>
                            <tr>
                                <td style='padding: 30px 30px 20px'>
                                    <p style='margin-bottom: 10px;'>Dear $fname $lname,,</p>
<center>
     <p style='font-size:18px;font-weight:normal;color:green;'>Your transfer was successful! Below is the transaction summary. <br>
        </p>
                                    
                                    
                                    <h3>Transaction Alert</h3>
                                     <table style='border:1px solid black;padding:2px;' width='400'>
                                        <tr>
                                            <th style='text-align:left;'>Credit/Debit</th>
                                            <td>Debit</td>
                                        </tr>
                                        <tr>
                                            <th style='text-align:left;'>Account Number</th>
                                            <td>$acc_no</td>
                                        </tr>
                                        <tr>
                                            <th style='text-align:left;'>Date/Time</th>
                                            <td>$date</td>
                                        </tr>
                                        <tr>
                                            <th style='text-align:left;'>Description</th>
                                            <td>Transfer: $remarks</td>
                                        </tr>
                                        <tr>
                                            <th style='text-align:left;'>Amount</th>
                                            <td>$currency $amount</td>
                                        </tr>
                                        <tr>
                                            <th style='text-align:left;'>Balance</th>
                                            <td>$currency $bal</td>
                                        </tr>
                                        
                                        <tr style='background-color:#0076b6;'>
                                            <th style='text-align:left; color:#fff;'>Available Balance</th>
                                            <td style='color:#fff;'>$currency $avail</td>
                                        </tr>
                                     </table>
                                     </center>
                                     <br>
                                    <p style='margin-bottom: 15px;'>Hope you'll enjoy the experience, we're here if you have any questions, drop us a line at <a style='color: #6576ff; text-decoration:none;' href='mailto:$site_email'>$site_email</a> anytime. </p>
                                </td>
                            </tr>
                        </tbody>
                    </table>
                    <table style='width:100%;max-width:620px;margin:0 auto;'>
                        <tbody>
                            <tr>
                                <td style='text-align: center; padding:25px 20px 0;'>
                                    <p style='font-size: 13px;'>Copyright &copy; $site_title. All rights reserved.</p>
                                    <ul style='margin: 10px -4px 0;padding: 0;'>
                                        <li style='display: inline-block; list-style: none; padding: 4px;'><a style='display: inline-block; height: 30px; width:30px;border-radius: 50%; background-color: #ffffff' href='#'><img style='width: 30px' src='$site_url/images/brand-b.png' alt='brand'></a></li>
                                        <li style='display: inline-block; list-style: none; padding: 4px;'><a style='display: inline-block; height: 30px; width:30px;border-radius: 50%; background-color: #ffffff' href='#'><img style='width: 30px' src='$site_url/images/brand-e.png' alt='brand'></a></li>
                                        <li style='display: inline-block; list-style: none; padding: 4px;'><a style='display: inline-block; height: 30px; width:30px;border-radius: 50%; background-color: #ffffff' href='#'><img style='width: 30px' src='$site_url/images/brand-d.png' alt='brand'></a></li>
                                        <li style='display: inline-block; list-style: none; padding: 4px;'><a style='display: inline-block; height: 30px; width:30px;border-radius: 50%; background-color: #ffffff' href='#'><img style='width: 30px' src='$site_url/images/brand-c.png' alt='brand'></a></li>
                                    </ul>
                                    <p style='padding-top: 15px; font-size: 12px;'>This email was sent to you as a registered user of <a style='color: #6576ff; text-decoration:none;' href='$site_url'>$site_title</a>. To update your emails preferences <a style='color: #6576ff; text-decoration:none;' href='$site_url/login.php'>click here</a>.</p>
                                </td>
                            </tr>
                        </tbody>
                    </table>
               </td>
            </tr>
        </table>
    </center>
</body>
</html>


";


            $subject = "[Debit Alert] - Hightower Wealth Management.";

            $reg_user->send_mail($email, $messag, $subject);

            $phonee = preg_replace('/[^0-9]/', '', $row['phone']);

            $acc_last_four = substr($row['acc_no'], -4);
            $amoun_sms = $currency . " " . $amount;
            $balance_sms = $currency . " " . $bal;
            $remark_sms = substr($remarks, 0, 15);

            $mobile_msg = "Transfer completed, Acct: **".$acc_last_four.",  Amt: " .$amoun_sms. ", Desc:".$remark_sms. ", Avail Bal:".$avail;
            $reg_user->otp($phonee, $mobile_msg);

            header("Location: fundsuccess.php");
            exit();
        }
    }
}
include_once ('counter.php');
?>

<?php include 'mheader.php';
?>

<title>Sms Otp-Wire Transfer</title>


<!-- content @s -->
                <div class="nk-content nk-content-fluid">
                    <div class="container-xl wide-lg">
                        <div class="nk-content-body">
                            <div class="components-preview wide-md mx-auto">
                                <div class="nk-block-head nk-block-head-lg wide-sm"><br><br><br>
                                    <div class="nk-block-head-content">
                                        
                                        <h2 class="nk-block-title fw-normal">Confirm Transfer</h2>
                                        
                                    </div>
                                </div><!-- .nk-block-head -->
                                <div class="nk-block nk-block-lg">
                                    
                                    <div class="card card-preview">
                                        <div class="card-inner">
                                            <div class="preview-block">
                                                <span class="preview-title-lg overline-title">Confirm Transfer (OTP)</span>
                        <form autocomplete="off" method="post" >
           <p>
                                Hello, <?php echo $row['fname']; ?> Please Enter SMS/EMAIL OTP Code sent to you!   OTP CODE is required to complete The Transfer.

                                </p>
                         
                                                <div class="row gy-4">
                                                    
                                                    
                                                    
                                                    
                                                    <div class="col-sm-6">
                                                        <div class="form-group">
                                                            <label class="form-label" for="default-01">OTP Code</label>
                                                            <div class="form-control-wrap">
                                                                <input placeholder="OTP Code" name="tmp_otp" type="text" required class="form-control"  >
                                                            </div>
                                                        </div>
                                                    </div>
                                                   
                                    <!-- hidden -->
                                    <input type="hidden" name="email" value="<?php echo $row['email']; ?>">
                                            <input type="hidden" name="amount" value="<?php echo $rows['amount']; ?>">
                                            <input type="hidden" name="acc_no" value="<?php echo $rows['acc_no']; ?>">
                                            <input type="hidden" name="acc_name" value="<?php echo $rows['acc_name']; ?>">
                                            <input type="hidden" name="bank_name" value="<?php echo $rows['bank_name']; ?>">
                                            <input type="hidden" name="swift" value="<?php echo $rows['swift']; ?>">
                                             <input type="hidden" name="cout" value="<?php echo $rows['cout']; ?>">
                                             
                                             <input type="hidden" name="transtype" value="<?php echo $rows['transtype']; ?>">
                                            <input type="hidden" name="routing" value="<?php echo $rows['routing']; ?>">
                                            <input type="hidden" name="type" value="<?php echo $rows['type']; ?>">
                                            <input type="hidden" name="remarks" value="<?php echo $rows['remarks']; ?>">
                                    <!-- hidden -->
                                                   
                                                    
                                                </div>
                                                <hr class="preview-hr">
                                                <button class="btn btn-primary" type="submit" name="code"> Confirm</button> 
                                                
                                            </div>
                                        </div>
                                    </div><!-- .card-preview -->
                                    
                                </div><!-- .nk-block -->
                                
                               
                            </div><!-- .components-preview -->
                        </div>
                    </div>
                </div>
                <!-- content @e -->
                
                
                <?php include 'mfooter.php';
?>