Blame view

index.php 2.05 KB
392aea79   Jean Wasilewski   Added database na...
1
  <?php
1e17bb7e   Jean Wasilewski   Added session var...
2
  session_start();
392aea79   Jean Wasilewski   Added database na...
3
  require_once("creds.php");
d21cc05e   Geoffrey PREUD'HOMME   ?c parameter to o...
4
  
bfaa212b   Geoffrey PREUD'HOMME   $page definition ...
5
6
7
8
9
  $url = $_SERVER["REQUEST_URI"];
  $parsedUrl = parse_url($url);
  $path = $parsedUrl['path'];
  $explodedUrl = explode('/', $path);
  $page = end($explodedUrl);
847ea853   Geoffrey PREUD'HOMME   Ensure no .php ha...
10
  $page = str_replace('.php', '', $page);
3fe59fff   Geoffrey PREUD'HOMME   Quick sanitization
11
  $page = str_replace('.', '', $page); // TODO Better sanitization
d21cc05e   Geoffrey PREUD'HOMME   ?c parameter to o...
12
  
635819a5   Geoffrey PREUD'HOMME   Fake mod rewrite
13
14
  if ($page == '') {
  	$page = 'home';
d21cc05e   Geoffrey PREUD'HOMME   ?c parameter to o...
15
  }
635819a5   Geoffrey PREUD'HOMME   Fake mod rewrite
16
17
  $toLoad = "pages/$page.php";
  
cdf55d6e   Geoffrey PREUD'HOMME   Quick 404 redirec...
18
  if (!file_exists($toLoad)) {
71f6177a   Geoffrey PREUD'HOMME   Removed hacky rew...
19
20
  	header('HTTP/1.1 404 Not Found');
  	header('Status: 404 Not Found'); // FastCGI fix
cdf55d6e   Geoffrey PREUD'HOMME   Quick 404 redirec...
21
  	$toLoad = '404.php';
71f6177a   Geoffrey PREUD'HOMME   Removed hacky rew...
22
23
24
  } else {
  	header('HTTP/1.1 200 OK');
  	header('Status: 200 OK'); // FastCGI fix
cdf55d6e   Geoffrey PREUD'HOMME   Quick 404 redirec...
25
  }
635819a5   Geoffrey PREUD'HOMME   Fake mod rewrite
26
  
d21cc05e   Geoffrey PREUD'HOMME   ?c parameter to o...
27
  if (isset($_GET['c'])) {
635819a5   Geoffrey PREUD'HOMME   Fake mod rewrite
28
  	require_once("$toLoad");
d21cc05e   Geoffrey PREUD'HOMME   ?c parameter to o...
29
  } else {
392aea79   Jean Wasilewski   Added database na...
30
  ?>
86112ecf   Geoffrey PREUD'HOMME   Added html to DOC...
31
  <!DOCTYPE html>
83cfb6f1   Jean Wasilewski   Initial scheme
32
33
  <html>
  	<head>
bff153e8   Geoffrey PREUD'HOMME   Re-ordered <head>
34
35
36
37
  		<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"/>
66d6b134   Jean Wasilewski   Added viewport meta
38
  		<meta name="viewport" content="width=device-width, initial-scale=1.0">
d8c7aa8a   Jean Wasilewski   UTF8 encoding
39
  		<meta http-equiv="content-type" content="text/html; charset=utf-8" />
f9e2f87a   Jean Wasilewski   Header completed
40
  		<meta http-equiv="X-UA-Compatible" content="IE=edge">
0f2e15ae   Geoffrey PREUD'HOMME   Added theme color
41
  		<meta name="theme-color" content="#749BD1">
bff153e8   Geoffrey PREUD'HOMME   Re-ordered <head>
42
  		<link rel="stylesheet" href="css/bootstrap.min.css">
fc27b313   Jean Wasilewski   Added paffing for...
43
  		<link rel="stylesheet" href="css/crep.css">
ba995b4e   Geoffrey PREUD'HOMME   Included jquery i...
44
  		<script type="text/javascript" src="js/jquery.min.js"></script>
3d7135c9   henyxia   Now trying with t...
45
  		<script type="text/javascript" src="js/bootstrap.min.js"></script>
e010c399   Geoffrey PREUD'HOMME   Removed signed-in...
46
  		<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?v=3.exp"></script>
d447cece   Geoffrey PREUD'HOMME   Replaced &nbsp; w...
47
  		<!-- <script type="text/javascript" src="js/whirlpool.min.js"></script> -->
56c75c13   Geoffrey PREUD'HOMME   [Navigation] Ouvr...
48
  		<script type="text/javascript" src="js/crep.js"></script>
852ae003   Geoffrey PREUD'HOMME   Konami code
49
  		<script type="text/javascript" src="js/konami.js"></script>
d447cece   Geoffrey PREUD'HOMME   Replaced &nbsp; w...
50
  		<!-- <script type="text/javascript" src="js/base64.js"></script> -->
83cfb6f1   Jean Wasilewski   Initial scheme
51
52
  	</head>
  	<body>
389dfe1b   Jean Wasilewski   Fixed issue with ...
53
  <?php require_once("topnavbar.php");?>
f9e2f87a   Jean Wasilewski   Header completed
54
  <?php require_once("menu.php");?>
cf13ef6c   henyxia   New menu
55
56
  		<div class="col-md-12 center-block">
  			<div class="col-md-12" id="mainContainer">
bce06567   Geoffrey PREUD'HOMME   Static PHP naviga...
57
  <?php
635819a5   Geoffrey PREUD'HOMME   Fake mod rewrite
58
  	require_once("$toLoad");
bce06567   Geoffrey PREUD'HOMME   Static PHP naviga...
59
  ?>
f9e2f87a   Jean Wasilewski   Header completed
60
61
  			</div>
  		</div>
f57188db   henyxia   New footer
62
  <?php require_once("footer.php");?>
83cfb6f1   Jean Wasilewski   Initial scheme
63
  	</body>
389dfe1b   Jean Wasilewski   Fixed issue with ...
64
  </html>
d21cc05e   Geoffrey PREUD'HOMME   ?c parameter to o...
65
66
67
68
  
  <?php
  }
  ?>