File: D:/HostingSpaces/SBogers36/mecurity-stadsafsluiting.nl/wwwroot/index.php
<?php
/*
* Make sure the user is visiting www.example.com instead of example.com
*/
if(substr($_SERVER['HTTP_HOST'],0,3) != 'www')
{
header ('HTTP/1.1 301 Moved Permanently');
$location = 'http://www.mecurity-stadsafsluiting.nl';
if( ! empty($_SERVER['REQUEST_URI'])) $location .= $_SERVER['REQUEST_URI'];
header('location: ' . $location);
exit;
}
if($_SERVER['HTTP_HOST'] != "www.mecurity-stadsafsluiting.nl"){
header ('HTTP/1.1 301 Moved Permanently');
$location = "http://www.mecurity-stadsafsluiting.nl";
header('location: ' . $location);
exit;
}
/*
* Initialize
*/
include 'mvc/init.php';
/*
* Load main controller in Template
*/
$Template->load(DOCUMENT_ROOT.'mvc/controllers/c_main.php','');
/*
* Check if the URL_PAGE (get variable) is set.
* If not, then load home page.
*/
if(defined('URL_PAGE'))
{
/*
* Set page_name data
* page_name is being used as class_name in header & footer
*/
$Template->setData('page_name','page_'.URL_PAGE);
/*
*
* Check if page is allowed.
* If so, include the controller in the template. Else header a 404-error.
*/
if(in_array(URL_PAGE,$allowedPages))
{
$page = str_replace('-','_',URL_PAGE);
$Template->load(DOCUMENT_ROOT.'mvc/controllers/c_'.$page.'.php');
}
else{
$Template->notFound();
}
}
else{
$Template->setData('page_name','page_home');
$Template->setData('page_title', SITE_NAME);
$Template->load(DOCUMENT_ROOT.'mvc/controllers/c_home.php');
}
/*
* Load Views
*/
$Template->load(DOCUMENT_ROOT.'mvc/views/includes/v_header.php');
$Template->load($Template->getData('content_view_path',FALSE));
$Template->load(DOCUMENT_ROOT.'mvc/views/includes/v_footer.php');