<?php
    if ( ! isset ( $_SESSION [ 'user_id' ] ) ) {
        header ( "Location: " . $GLOBALS [ 'config' ] [ 'installation_path' ] . "/login" );
        exit;
    }
    if ( isset ( $GLOBALS [ 'request_uri' ] [ 1 ] ) ) {
        switch ( $GLOBALS [ 'request_uri' ] [ 1 ] ) {
            case "manage":
                include ( 'lib/php/manage.php' );
                break;
            case "insert":
                include ( 'lib/php/management/insert.php' );
                break;
            case "edit":
                include ( 'lib/php/management/edit.php' );
                break;
            default:
                http_response_code ( 404 );
                include ( 'errors/404.html' );
                die ( );
        }
    }
    else {
?>
<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <link href="<?=$GLOBALS['config']['installation_path']?>/favicon.ico" rel="icon" type="image/x-icon">
        <title>Dashboard Home | <?=$GLOBALS['config']['website_name']?></title>
    </head>
    <body>
        <a href="<?=$GLOBALS['config']['installation_path']?>/dashboard/manage">Open Management Console</a>
    </body>
</html>
<?php
    }