<?php
$uri = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH);
$uri = urldecode($uri);

$requested = __DIR__ . $uri;

if ($uri === '/logout') {
    require_once 'logout.php';
    exit;
}

if ($uri === '/login') {
    require_once 'login.php';
    exit;
}

if ($uri === '/attendance-kiosk' || $uri === '/attendance-kiosk/') {
    require_once 'attendance-kiosk.php';
    exit;
}

if ($uri !== '/' && file_exists($requested)) {
    return false;
}

if (preg_match('/\.(png|jpg|jpeg|gif|css|js|ico|svg|eot|woff|woff2|ttf|map)$/i', $uri)) {
    header("HTTP/1.1 404 Not Found");
    echo "404 Not Found";
    exit;
}

require_once 'index.php';
?>
