first commit
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
require_once "vendor/autoload.php";
|
||||
require_once "utils/helper/helper.php";
|
||||
|
||||
|
||||
$uri = strtok($_SERVER['REQUEST_URI'], "?");
|
||||
$path = explode('/', $uri)[1];
|
||||
empty($path) && $path = 'index';
|
||||
|
||||
switch ($path) {
|
||||
case "api" :
|
||||
$path = "api";
|
||||
break;
|
||||
|
||||
case "doapi" :
|
||||
$path = "api";
|
||||
break;
|
||||
|
||||
case "ip" :
|
||||
$_GET['act'] = $path;
|
||||
$path = "index";
|
||||
$_GET['ip'] = explode('/', $uri)[2];
|
||||
break;
|
||||
|
||||
default:
|
||||
$_GET['act'] = $path;
|
||||
$path = "index";
|
||||
break;
|
||||
}
|
||||
|
||||
$handlerPath = HANDLER_PATH . '/' . $path . ".php";
|
||||
if (!file_exists($handlerPath)) {
|
||||
\utils\View::getInstance()->fetch("404");
|
||||
exit;
|
||||
}
|
||||
|
||||
try {
|
||||
require_once $handlerPath;
|
||||
} catch (Exception $e) {
|
||||
\utils\View::getInstance()->fetch("404");
|
||||
exit;
|
||||
var_dump($e->getMessage());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user