. */ /** * Load the basic configuration (sessions, database, class autoloading, etc.) */ require_once('./conf.php'); // Fetch information from the REQUEST_URI. $_request = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH); $_request = str_replace(constants::url_internal, '', $_request); // This is the REQUEST_URI switch // The default shows a 404 page $pages = array( '/' => './include/home.php', '/clients' => './include/clients.php', '/clients/new' => './include/clients-new.php', '/clients/edit' => './include/clients-edit.php', '/contacts' => './include/contacts.php', '/contacts/new' => './include/contacts-new.php', '/contacts/edit' => './include/contacts-edit.php', '/offers' => './include/offers.php', '/offers/new' => './include/offers-new.php', '/offers/edit' => './include/offers-edit.php', '/assignments' => './include/assignments.php', '/assignments/new' => './include/assignments-new.php', '/assignments/edit' => './include/assignments-edit.php', '/discounts' => './include/discounts.php', '/discounts/new' => './include/discounts-new.php', '/discounts/edit' => './include/discounts-edit.php', '/about' => './include/about.php', '/ajax/collapse' => './include/ajax-collapse.php' ); $_page = null; foreach ($pages as $uri => $path) { if ($_request == $uri && file_exists($path)) { $_page = $uri; require($path); break; } } if ($_page === null) { $_page = '/404'; http_response_code(404); require('./include/404.php'); }