lepisi-pengumuman/public/index.php
Gregorio Chiko Putra 00c5aba77d Huge updates:
1. Redesigned the web
2. Fixed logging in redirect issue
3. Added new route
4. Fixed sql issue on entry
5. Fixed typos
2017-09-14 16:39:53 +07:00

30 lines
893 B
PHP

<?php
session_start();
ini_set("display_errors", "on");
error_reporting(E_ALL);
// Autoload
require_once dirname(__DIR__).'/vendor/autoload.php';
// Errors Handler
set_error_handler("Core\Error::errorHandler");
set_exception_handler("Core\Error::exceptionHandler");
if (Core\Session::exists('info')) {
echo '<h3 style="margin:auto;position:absolute;left:43%;"><span id="info" class="label top" style="position:fixed;" onclick="fadeOutEffect()">';
echo Core\Session::flash('info');
echo '</span></h3>';
}
$router = new Core\Router();
$router->add('', ['controller' => 'posts', 'action' => 'index']);
$router->add('{controller}/{action}');
$router->add('{controller}/{action}/{id:\d+}');
$router->add('{action}', ['controller' => 'home']);
$router->add('{?status:\d+}', ['controller' => 'posts', 'action' => 'index']);
$url = $_SERVER['REQUEST_URI'];
$router->dispatch($url);