63 lines
1.5 KiB
PHP
63 lines
1.5 KiB
PHP
<?php
|
|
|
|
session_start();
|
|
|
|
$requestUri = $_SERVER['REQUEST_URI'];
|
|
if (strpos($requestUri, 'index.php') !== false) {
|
|
$newUrl = str_replace('index.php', '', $requestUri);
|
|
header('Location: ' . $newUrl);
|
|
exit;
|
|
}
|
|
|
|
// Cek apakah ada session
|
|
$isLoggedIn = isset($_SESSION['user']) || isset($_SESSION['master']);
|
|
|
|
// Ambil URL path
|
|
// $path = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH);
|
|
$BaseUrl = "https://manjapro.net";
|
|
|
|
// Logika Path
|
|
$basePath = parse_url($BaseUrl, PHP_URL_PATH);
|
|
$requestPath = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH);
|
|
$path = preg_replace('#^' . preg_quote($basePath, '#') . '#', '', $requestPath);
|
|
$path = '/' . ltrim($path, '/');
|
|
|
|
// Cek apakah path cocok dengan pola /tracking/MP-xxxxxxxx-xxxxx
|
|
if (preg_match('#^/tracking/MP-\d{10}-\d{5}$#', $path)) {
|
|
$_GET['id'] = basename($path); // agar bisa diakses di tracking.php
|
|
include 'tracking/tracking.php';
|
|
exit;
|
|
}
|
|
|
|
// Tentukan tampilan berdasarkan session dan path
|
|
switch ($path) {
|
|
case '/login':
|
|
if ($isLoggedIn) {
|
|
include 'dashboard.php';
|
|
exit;
|
|
}
|
|
include 'autentikasi/aut_akses.php';
|
|
break;
|
|
|
|
case '/lupa_password':
|
|
include 'autentikasi/forget_pass.php';
|
|
break;
|
|
|
|
case '/register':
|
|
if ($isLoggedIn) {
|
|
include 'dashboard.php';
|
|
exit;
|
|
}
|
|
include 'autentikasi/register.php';
|
|
break;
|
|
|
|
default:
|
|
if ($isLoggedIn) {
|
|
include 'dashboard.php';
|
|
} else {
|
|
include 'web/index.php';
|
|
}
|
|
break;
|
|
}
|
|
?>
|