-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
32 lines (29 loc) · 850 Bytes
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?php
declare(strict_types = 1);
namespace App
{
require_once("./core/router.core.php");
require_once("./controllers/user.controller.php");
use App\Controllers\User;
use App\Core\Router;
use App\Exceptions\RouteNotFoundException;
use Exception;
try {
Router::create()
->register(User::class)
->resolve(
$_SERVER['REQUEST_METHOD'],
$_SERVER['REQUEST_URI']
);
} catch (RouteNotFoundException $exception)
{
/**
* Add some kind of logging here for repeated bad requests to maybe ip ban frequent offenders
* as they may be trying to map the api or find a vulnerability.
*/
echo "Forbidden!";
} catch (Exception $exception)
{
echo "<pre>".print_r($exception, true)."</pre>";
}
}