index.php
1.75 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
<?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";
// TODO Test if exists, 404 otherwise
if (isset($_GET['c'])) {
require_once("$toLoad");
} else {
?>
<!DOCTYPE>
<html>
<head>
<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">
<meta name="description" content="Site Web de la Coupe de Robotique des Ecoles Primaires">
<meta name="author" content="Club Informatique de PolytechLille">
<title>Coupe de Robotique des Ecoles Primaires</title>
<link rel="stylesheet" href="css/bootstrap.css">
<link rel="stylesheet" href="css/crep.css">
<link rel="shortcut icon" href="favicon.ico"/>
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js"></script>
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/bootstrap.min.js"></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
}
?>