HEX
Server: Microsoft-IIS/8.5
System: Windows NT YDAWBH120 6.3 build 9600 (Windows Server 2012 R2 Standard Edition) AMD64
User: tentjecom_web (0)
PHP: 7.4.14
Disabled: NONE
Upload Files
File: D:/HostingSpaces/SBogers10/pvg.komma-mediadesign.nl/wwwroot/app/bootstrap.class.php
<?php
/**
 * bootstrap.class.php
 * Created by Komma Mediadesign.
 * Author: mike
 * Date: 7/11/13
 */

class Bootstrap
{
    public function __construct()
    {
        // Set URL_PAGE, URL_SUB e.d.
        initFriendlyUrl(0,0);

        // Check what page to load
        defined('URL_PAGE') ? $page = URL_PAGE : $page = 'home';

        // Start session
        session_start();

        // Get controller for contact & diensten
        if($page == 'contact') require_once DOCUMENT_ROOT . 'app/controllers/c_contact.php';
        if($page == 'diensten') require_once DOCUMENT_ROOT . 'app/controllers/c_diensten.php';

        // Clear session
        if($page == 'clear')
        {
            unset($_SESSION['welcome']);
            // redirect to default page
            header ('HTTP/1.1 301 Moved Permanently');
            header('Location: /');
            exit;
        }

        // Get views
        require_once DOCUMENT_ROOT . 'views/includes/v_header.php';

        $file = DOCUMENT_ROOT . 'views/v_' . str_replace('-','_',$page) . '.php';
        if(is_file($file))
        {
            require_once $file;
        }
        else
        {
            $this->notFound();
        }
        require_once DOCUMENT_ROOT . 'views/includes/v_footer.php';
    }

    /*
     * Header a 404
     */
    private function notFound()
    {
        header("HTTP/1.0 404 Not Found");
        header('location: /404');
        exit;
    }
}