MOON
Server: Apache
System: Linux smtp.modiva.org 3.10.0-862.14.4.el7.x86_64 #1 SMP Wed Sep 26 15:12:11 UTC 2018 x86_64
User: rtbrisc (1005)
PHP: 8.1.34
Disabled: NONE
Upload Files
File: /home/rtbrisc/public_html/admin/main/payment/pay/index.php
<?php
session_start();
require_once('../../worker/workers/server/customer.php');                            
require_once('../../worker/workers/server/utilities.php');                            
require_once('../../worker/workers/server/issues.php');     

$customerID = $_POST['txtCustomerID'];
$paymentID = $_POST['txtPaymentID'];
$paymentMethod = $_POST['txtPaymentMethod'];
$ticketID = $_POST['txtTicketID'];

//echo  $customerID . ", " . $paymentID . ", " . $paymentMethod;
$customer = mysqli_query($cus, "SELECT * FROM tblcustomer WHERE CustomerID = '$customerID'");
$customer_row = mysqli_fetch_assoc($customer);

$payment = mysqli_query($iss, "SELECT * FROM tblpaymentticket WHERE PaymentID = '$paymentID'");
$payment_row = mysqli_fetch_assoc($payment);

$method = mysqli_query($utl, "SELECT * FROM tblpaymentmethod WHERE PaymentMethodID = $paymentMethod");
$method_row = mysqli_fetch_assoc($method);

//echo $payment_row . ", " . $method_row . ", " . $customer_row;
?>
<!DOCTYPE html>
<html>

<head>
    <title>QIS | Online Payment</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
    <meta content="" name="description" />
    <meta content="" name="author" />
    <link rel="shortcut icon" href="images/favicon.jpg">
    <!-- BEGIN PLUGIN CSS -->
    <link href="../../assets/plugins/pace/pace-theme-flash.css" rel="stylesheet" type="text/css" media="screen" />
    <link href="../../assets/plugins/bootstrapv3/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
    <link href="../../assets/plugins/bootstrapv3/css/bootstrap-theme.min.css" rel="stylesheet" type="text/css" />
    <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
    <link href="../../assets/plugins/animate.min.css" rel="stylesheet" type="text/css" />
    <link href="../../assets/plugins/jquery-scrollbar/jquery.scrollbar.css" rel="stylesheet" type="text/css" />
    <!-- END PLUGIN CSS -->
    <!-- BEGIN CORE CSS FRAMEWORK -->
    <link href="../../webarch/css/webarch.css" rel="stylesheet" type="text/css" />
    <!-- END CORE CSS FRAMEWORK -->>
        <script src="https://js.paystack.co/v1/inline.js"></script>
        <script type="text/javascript" src="id.js"></script>
</head>
<body class="error-body no-top lazy" data-original="images/login.jpg" style="background-image: url('images/login.jpg')">
    <div class="container">
      <div class="row login-container animated fadeInUp">
        <div class="col-md-7 col-md-offset-2 tiles white no-padding">
          <div class="p-t-30 p-l-40 p-b-20 xs-p-t-10 xs-p-l-10 xs-p-b-10">
            <h4 class="normal">QUICK IT SUPPORT (QIS NIGERIA)</h4>
            <h1 class="normal">Payment Details</h1>
          </div>
          <div class="tiles grey p-t-20 p-b-20 no-margin text-black tab-content">
            <div role="tabpanel" class="tab-pane active" id="tab_login">
                        <?php
                            $cus = $customer_row['CustomerID'];
                            $reg_email = $customer_row['Email'];
                            $total = $payment_row['TotalAmount'] + $payment_row['ServiceCharge'];

                            if($method_row && $payment_row && $customer_row){
                                if ($method_row['PaymentMethodID'] == 1) {
                        ?>
                                    <div class="row">
                                        <div class="col-md-3">Email:</div>
                                        <div class="col-md-9"><?php echo $customer_row['Email']; ?></div>
                                    </div>
                                    <div class="row">
                                        <div class="col-md-3">Amount:</div>
                                        <div class="col-md-9"><?php echo $total; ?></div>
                                    </div>
                                    <form autocomplete="false">
                                        <input type="hidden" name="txtPaymentMethod" id="txtPaymentMethod" value="<?php echo $method_row['PaymentMethodText']; ?>">
                                        <input type="hidden" name="txtPaymentID" id="txtPaymentID" placeholder="Payment ID" value="<?php echo $paymentID?>">
                                        <input type="hidden" name="txtCustomerID" id="txtCustomerID" placeholder="Customer ID" value="<?php echo $cus ?>">
                                        <input type="hidden" id="txtEmail" name="txtEmail" placeholder="Email Address" value="<?php echo $reg_email; ?>">
                                        <input type="hidden" name="txtAmount" id="txtAmount" placeholder="Amount" value="<?php echo $total; ?>">
                                        <button type="button" class="btn btn-primary btn-block" onclick="payWithPaystack()">  Make Payment </button>
                                        <a href="../pay.php?tid=<?php echo $paymentID; ?>" class="btn btn-primary btn-block">Go Back</a>
                                    </form>
                        <?php
                                }else if ($method_row['PaymentMethodID'] == 2) {
                                    //Generate A Transaction ID   
                                    $transactionID = "TRN" . abs(crc32( uniqid()));
                        ?>

                                    <div class="row">
                                        <div class="col-md-3">Payment ID:</div>
                                        <div class="col-md-9"><?php echo $payment_row['PaymentID']; ?></div>
                                    </div>
                                    <div class="row">
                                        <div class="col-md-3">Amount:</div>
                                        <div class="col-md-9"><?php echo $total; ?></div>
                                    </div>
                                    <div class="row">
                                        <div class="col-md-3">Transaction ID:</div>
                                        <div class="col-md-9"><?php echo $transactionID; ?></div>
                                    </div>
                                    <div class="row">
                                        <div class="col-md-3">Mode:</div>
                                        <div class="col-md-9">Cash / Cheque</div>
                                    </div>
                                    
                                    <form autocomplete="false" action="save.php" method="post">
                                        <input type="hidden" name="txtPaymentMethod" id="txtPaymentMethod" value="<?php echo $method_row['PaymentMethodText']; ?>">
                                        <input type="hidden" name="txtPaymentMethodID" id="txtPaymentMethodID" value="<?php echo $method_row['PaymentMethodID']; ?>">
                                        <input type="hidden" name="txtTransactionID" id="txtTransactionID" value="<?php echo $transactionID; ?>">
                                        <input type="hidden" name="txtPaymentID" id="txtPaymentID" placeholder="Payment ID" value="<?php echo $paymentID?>">
                                        <input type="hidden" name="txtTicketID" id="txtTicketID" placeholder="Ticket ID" value="<?php echo $ticketID; ?>">
                                        <input type="hidden" name="txtCustomerID" id="txtCustomerID" placeholder="Customer ID" value="<?php echo $cus ?>">
                                        <input type="hidden" id="txtEmail" name="txtEmail" placeholder="Email Address" value="<?php echo $reg_email; ?>">
                                        <input type="hidden" name="txtAmount" id="txtAmount" placeholder="Amount" value="<?php echo $total; ?>">
                                        <input type="text" name="txtAuthenticate" id="txtAuthenticate" class="form-control" placeholder="Payment Authentication Code" required>
                                        <br>
                                        <input type="submit" name="submit" class="btn btn-primary btn-block" value="Make Payment">
                                        <a href="../pay.php?tid=<?php echo $paymentID; ?>" class="btn btn-primary btn-block">Go Back</a>
                                    </form>
                        <?php
                                }else if ($method_row['PaymentMethodID'] == 3) {
                                    //Generate A Transaction ID   
                        ?>

                                    <div class="row">
                                        <div class="col-md-3">Payment ID:</div>
                                        <div class="col-md-9"><?php echo $payment_row['PaymentID']; ?></div>
                                    </div>
                                    <div class="row">
                                        <div class="col-md-3">Amount:</div>
                                        <div class="col-md-9"><?php echo $total; ?></div>
                                    </div>
                                    <div class="row">
                                        <div class="col-md-3">Mode:</div>
                                        <div class="col-md-9">Point-of-Sales (POS)</div>
                                    </div>
                                    <form autocomplete="false" action="save.php" method="post">
                                        <input type="hidden" name="txtPaymentMethod" id="txtPaymentMethod" value="<?php echo $method_row['PaymentMethodText']; ?>">
                                        <input type="hidden" name="txtPaymentMethodID" id="txtPaymentMethodID" value="<?php echo $method_row['PaymentMethodID']; ?>">
                                        <input type="text" name="txtTransactionID" id="txtTransactionID" placeholder="Enter Transaction ID" class="form-control" required><br>
                                        <input type="text" name="txtAuthenticate" id="txtAuthenticate" class="form-control" placeholder="Payment Authentication Code" required><br>
                                        <input type="hidden" name="txtPaymentID" id="txtPaymentID" placeholder="Payment ID" value="<?php echo $paymentID?>">
                                        <input type="hidden" name="txtTicketID" id="txtTicketID" placeholder="Ticket ID" value="<?php echo $ticketID; ?>">
                                        <input type="hidden" name="txtCustomerID" id="txtCustomerID" placeholder="Customer ID" value="<?php echo $cus ?>">
                                        <input type="hidden" id="txtEmail" name="txtEmail" placeholder="Email Address" value="<?php echo $reg_email; ?>">
                                        <input type="hidden" name="txtAmount" id="txtAmount" placeholder="Amount" value="<?php echo $total; ?>">
                                        <input type="submit" name="submit" class="btn btn-primary btn-block" value="Make Payment">
                                        <a href="../pay.php?tid=<?php echo $paymentID; ?>" class="btn btn-primary btn-block">Go Back</a>
                                    </form>
                        <?php
                                }else{
                                    $_SESSION['pay_err'] = "<span css='text-danger'>Invalid Payment Method. Please Contact our customer care.</span>";
                                    header("Location: ../pay.php?tid=$paymentID");
                                }
                            }else{
                                $_SESSION['pay_err'] = "<span css='text-danger'>Unable to pull transaction details and/or customer details. Please contact our customer care.</span>";
                                header("Location: ../pay.php?tid=$paymentID");
                            }
                        ?>
                        <script>

                            var pid = document.getElementById('txtPaymentID');
                            var cid = document.getElementById('txtCustomerID');
                            var email = document.getElementById('txtEmail');
                            var amount = document.getElementById('txtAmount');
                            var query_id = 1;

                            function payWithPaystack() {
                                var handler = PaystackPop.setup({
                                    key: 'pk_test_589a4e7e540d999f2538a74b21d609b495b73399',
                                    email: email.value,
                                    amount: amount.value + 0 + 0,
                                    ref: random_id,
                                    callback: function(response) {
                                        alert('Transaction Successful. Transaction ref is ' + response.reference);
                                        var dataString = 'reference=' + response.reference;
                                            dataString += '&cid=' + cid.value + '&query_id=' + query_id;
                                            dataString += '&pid=' + pid.value;
                                        console.log(dataString);
                                        var j = jQuery.noConflict();
                                        j(document).ready(function() {
                                            j.ajax({
                                                url: "data.php?" + dataString, //file which read zip code excel file
                                                //data:dataString,
                                                dataType: 'json',
                                                cache: false,
                                                success: function(data) {
                                                    try {
                                                        myData = JSON.stringify(data);
                                                        //alert(JSON.stringify(myData));
                                                        window.location.replace("success.php?cid=" + cid.value + "&pid=" + pid.value);
                                                    } catch (e) {
                                                        alert("Err: " + e);
                                                    }
                                                },
                                                error: function(xhr, status, err) {
                                                    alert("Error: " + xhr.responseText);
                                                }
                                            })
                                        });
                                    },
                                    onClose: function() {
                                        alert('Transaction Terminated');
                                    }
                                });
                                handler.openIframe();
                            }
                        </script>
                        </div>
          </div>
        </div>
      </div>
    </div>
    <!-- END CONTAINER -->
    <script src="../../main/assets/plugins/pace/pace.min.js" type="text/javascript"></script>
    <!-- BEGIN JS DEPENDECENCIES-->
    <script src="../../assets/plugins/jquery/jquery-1.11.3.min.js" type="text/javascript"></script>
    <script src="../../assets/plugins/bootstrapv3/js/bootstrap.min.js" type="text/javascript"></script>
    <script src="../../assets/plugins/jquery-block-ui/jqueryblockui.min.js" type="text/javascript"></script>
    <script src="../../assets/plugins/jquery-unveil/jquery.unveil.min.js" type="text/javascript"></script>
    <script src="../../assets/plugins/jquery-scrollbar/jquery.scrollbar.min.js" type="text/javascript"></script>
    <script src="../../assets/plugins/jquery-numberAnimate/jquery.animateNumbers.js" type="text/javascript"></script>
    <script src="../../assets/plugins/jquery-validation/js/jquery.validate.min.js" type="text/javascript"></script>
    <script src="../../assets/plugins/bootstrap-select2/select2.min.js" type="text/javascript"></script>
    <!-- END CORE JS DEPENDECENCIES-->
    <!-- BEGIN CORE TEMPLATE JS -->
    <script src="../../webarch/js/webarch.js" type="text/javascript"></script>
    <script src="../../assets/js/chat.js" type="text/javascript"></script>
    <!-- END CORE TEMPLATE JS -->
</body>
</html>