Blame view

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