1
0
Fork 0
This repository has been archived on 2024-02-17. You can view files and clone it, but cannot push or open issues or pull requests.
Accommodation_Management/index.php

43 lines
895 B
PHP
Raw Normal View History

2020-12-18 20:29:24 +01:00
<?php
require_once('config/config.php');
require_once('src/func.php');
require_once('src/model.php');
session_start();
/*
* Env path
*/
define('__PATH', str_replace(WEBSITE_PATH, '', $_SERVER['REQUEST_URI']));
/*
* User session
*/
2020-12-20 03:56:05 +01:00
if(!isset($_SESSION['USER'])){
$_SESSION['USER'] = new User();
}else{
/*
* Init DB login
*/
Model::initDatabase();
/*
* Check if user still exist
*/
2021-01-11 17:30:13 +01:00
$_SESSION['USER']->refresh();
2020-12-18 20:29:24 +01:00
}
/*
* Routing
*/
$path = explode('/',explode('?',__PATH)[0]);
$assetsLevel = count($path)-1;
switch($path[0]){
case '':
$path[0] = WEBSITE_DEFAULT_PATH;
require_once(CONTROLLER_PATH.WEBSITE_DEFAULT_PATH.'.php');
break;
case (is_file(CONTROLLER_PATH. $path[0] .'.php')):
require_once(CONTROLLER_PATH.$path[0].'.php');
break;
default:
require_once(CONTROLLER_PATH.'404.php');
}