| Server IP : 173.209.174.21 / Your IP : 216.73.216.89 Web Server : Apache/2.4.58 (Ubuntu) System : Linux wcfs-server 6.8.0-124-generic #124-Ubuntu SMP PREEMPT_DYNAMIC Tue May 26 13:00:45 UTC 2026 x86_64 User : nodor ( 1000) PHP Version : 8.3.6 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /var/www/wifi-wcfs/public/ |
Upload File : |
<?php
require __DIR__ . '/../lib.php';
$id = (int) ($_GET['session'] ?? 0);
$ruckusLoginUrl = 'http://192.168.68.61:9997/login';
$startUrl = 'http://neverssl.com/';
$stmt = db()->prepare('SELECT * FROM checkout_sessions WHERE id = :id');
$stmt->execute([':id' => $id]);
$localSession = $stmt->fetch(PDO::FETCH_ASSOC);
if ($localSession) {
$ruckusIp = $localSession['ruckus_sip'] ?: '192.168.68.61';
$ruckusIp = preg_replace('/[^0-9a-fA-F:.]/', '', (string) $ruckusIp);
$ruckusLoginUrl = 'http://' . $ruckusIp . ':9997/login';
if (!empty($localSession['start_url'])) {
$startUrl = $localSession['start_url'];
}
}
$approved = false;
$message = 'We could not verify that payment yet.';
if ($localSession) {
try {
$cfg = config();
$status = north_request('GET', '/api/sessions/status', [
'SessionToken: ' . $localSession['session_token'],
'checkoutId: ' . $cfg['north_checkout_id'],
]);
$plan = find_plan($localSession['plan_id']);
if (($status['status'] ?? '') === 'Approved' && $plan) {
$expiresAt = gmdate('c', time() + ((int) $plan['minutes'] * 60));
authorize_paid_device($localSession['client_mac'], $plan, $expiresAt);
$update = db()->prepare(
'UPDATE checkout_sessions
SET status = "approved", approved_at = :approved_at, expires_at = :expires_at, raw_status_json = :raw
WHERE id = :id'
);
$update->execute([
':approved_at' => gmdate('c'),
':expires_at' => $expiresAt,
':raw' => json_encode($status),
':id' => $id,
]);
send_payment_notification($localSession, $plan, $status, $expiresAt);
$approved = true;
$message = 'Payment approved. Connecting your device now...';
} else {
$message = 'Payment was not approved yet. Please try again or ask for help.';
}
} catch (Throwable $e) {
$message = 'Could not verify payment: ' . $e->getMessage();
}
}
?>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Wi-Fi Payment Status</title>
<style>
body { font-family: Arial, sans-serif; margin: 0; background: #f6f7f2; color: #1e2a22; }
main { max-width: 620px; margin: 0 auto; padding: 48px 18px; }
.box { background: white; border: 1px solid #d9ded2; border-radius: 8px; padding: 22px; }
button { background: #276749; color: white; border: 0; border-radius: 6px; padding: 12px 16px; font-size: 16px; }
</style>
</head>
<body>
<main>
<div class="box">
<h1><?= $approved ? 'You are paid' : 'Payment pending' ?></h1>
<p><?= htmlspecialchars($message) ?></p>
<?php if ($approved): ?>
<form id="ruckus-login" method="post" action="<?= htmlspecialchars($ruckusLoginUrl) ?>">
<input type="hidden" name="uid" value="testwifi">
<input type="hidden" name="username" value="testwifi">
<input type="hidden" name="password" value="testpass">
<input type="hidden" name="url" value="<?= htmlspecialchars($startUrl) ?>">
<?php if (!empty($localSession['client_ip'])): ?>
<input type="hidden" name="uip" value="<?= htmlspecialchars($localSession['client_ip']) ?>">
<?php endif; ?>
<?php if (!empty($localSession['client_mac'])): ?>
<input type="hidden" name="client_mac" value="<?= htmlspecialchars($localSession['client_mac']) ?>">
<?php endif; ?>
<button type="submit">Connect Now</button>
</form>
<script>
setTimeout(() => {
document.getElementById('ruckus-login').submit();
}, 800);
</script>
<?php endif; ?>
</div>
</main>
</body>
</html>