index.php
1.95 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<?php
session_start();
require_once("creds.php");
$url = $_SERVER["REQUEST_URI"];
$parsedUrl = parse_url($url);
$path = $parsedUrl['path'];
$explodedUrl = explode('/', $path);
$page = end($explodedUrl);
$page = str_replace('.php', '', $page);
$page = str_replace('.', '', $page); // TODO Better sanitization
if ($page == '') {
$page = 'home';
}
$toLoad = "pages/$page.php";
if (!file_exists($toLoad)) {
header('HTTP/1.1 404 Not Found');
header('Status: 404 Not Found'); // FastCGI fix
$toLoad = '404.php';
} else {
header('HTTP/1.1 200 OK');
header('Status: 200 OK'); // FastCGI fix
}
if (isset($_GET['c'])) {
require_once("$toLoad");
} else {
?>
<!DOCTYPE html>
<html>
<head>
<title>Coupe de Robotique des Ecoles Primaires</title>
<meta name="description" content="Site Web de la Coupe de Robotique des Ecoles Primaires">
<meta name="author" content="Club Informatique de Polytech Lille">
<link rel="shortcut icon" href="favicon.ico"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<link rel="stylesheet" href="css/bootstrap.min.css">
<link rel="stylesheet" href="css/crep.css">
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/bootstrap.min.js"></script>
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?v=3.exp"></script>
<!-- <script type="text/javascript" src="js/whirlpool.min.js"></script> -->
<script type="text/javascript" src="js/crep.js"></script>
<!-- <script type="text/javascript" src="js/base64.js"></script> -->
</head>
<body>
<?php require_once("topnavbar.php");?>
<?php require_once("menu.php");?>
<div class="col-md-12 center-block">
<div class="col-md-12" id="mainContainer">
<?php
require_once("$toLoad");
?>
</div>
</div>
<?php require_once("footer.php");?>
</body>
</html>
<?php
}
?>