Skip to content

Instantly share code, notes, and snippets.

@FinlayDaG33k
Created April 7, 2017 12:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save FinlayDaG33k/b06dc4e28c339e5221bed481420805c5 to your computer and use it in GitHub Desktop.
Save FinlayDaG33k/b06dc4e28c339e5221bed481420805c5 to your computer and use it in GitHub Desktop.
<?php
//error displaying wen something wrong
ini_set('display_errors', true);
error_reporting(E_ALL);
session_start(); // start the session
//for the pages
$disallowed_paths = array('header', 'footer');
if(!empty($_GET['page'])){
$tmp_page = basename($_GET['page']);
if(!in_array($tmp_page, $disallowed_paths) && file_exists("pages/{$tmp_page}.php")){
$page = $tmp_page;
}else{
$page = 'error';
}
}else{
$page = 'home';
}
//for the languages
// What languages do we support
$available_langs = array('eng','nl');
// Set our default language session
if(empty($_SESSION['lang'])){
$_SESSION['lang'] = 'nl';
}
if(!empty($_GET['lang'])){
// check if the language is one we support
if(in_array($_GET['lang'], $available_langs)){
$_SESSION['lang'] = $_GET['lang']; // Set session
}
}
// Include active language
include('language/'.$_SESSION['lang'].'/lang.'.$_SESSION['lang'].'.php');
?>
<!DOCTYPE html>
<html>
<head>
<title></title>
<?php include 'components/head.php'; ?>
</head>
<body>
<div class="container-fluid">
<?php include 'components/nav.php';?>
</div>
<div class="container">
<?php include("pages/".$page.".php"); ?>
</div>
<footer>
<div class="container">
<?php include 'components/footer.php'; ?>
</div>
</footer>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment