Blame view

index.php 2.05 KB
392aea79   Jean Wasilewski   Added database na...
1
  <?php
5d22ed6b   Geoffrey PREUD'HOMME   Redirect crepbeta...
2
  
bfaa212b   Geoffrey PREUD'HOMME   $page definition ...
3
4
5
6
7
  $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...
8
  $page = str_replace('.php', '', $page);
3fe59fff   Geoffrey PREUD'HOMME   Quick sanitization
9
  $page = str_replace('.', '', $page); // TODO Better sanitization
d21cc05e   Geoffrey PREUD'HOMME   ?c parameter to o...
10
  
635819a5   Geoffrey PREUD'HOMME   Fake mod rewrite
11
12
  if ($page == '') {
  	$page = 'home';
d21cc05e   Geoffrey PREUD'HOMME   ?c parameter to o...
13
  }
635819a5   Geoffrey PREUD'HOMME   Fake mod rewrite
14
15
  $toLoad = "pages/$page.php";
  
cdf55d6e   Geoffrey PREUD'HOMME   Quick 404 redirec...
16
  if (!file_exists($toLoad)) {
71f6177a   Geoffrey PREUD'HOMME   Removed hacky rew...
17
18
  	header('HTTP/1.1 404 Not Found');
  	header('Status: 404 Not Found'); // FastCGI fix
cdf55d6e   Geoffrey PREUD'HOMME   Quick 404 redirec...
19
  	$toLoad = '404.php';
71f6177a   Geoffrey PREUD'HOMME   Removed hacky rew...
20
21
22
  } else {
  	header('HTTP/1.1 200 OK');
  	header('Status: 200 OK'); // FastCGI fix
cdf55d6e   Geoffrey PREUD'HOMME   Quick 404 redirec...
23
  }
635819a5   Geoffrey PREUD'HOMME   Fake mod rewrite
24
  
d21cc05e   Geoffrey PREUD'HOMME   ?c parameter to o...
25
  if (isset($_GET['c'])) {
635819a5   Geoffrey PREUD'HOMME   Fake mod rewrite
26
  	require_once("$toLoad");
d21cc05e   Geoffrey PREUD'HOMME   ?c parameter to o...
27
  } else {
392aea79   Jean Wasilewski   Added database na...
28
  ?>
89965b6f   Geoffrey PREUD'HOMME   Reformattage
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
      <!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">
          <meta name="theme-color" content="#749BD1">
          <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/crep.js"></script>
          <script type="text/javascript" src="js/konami.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
635819a5   Geoffrey PREUD'HOMME   Fake mod rewrite
56
  	require_once("$toLoad");
bce06567   Geoffrey PREUD'HOMME   Static PHP naviga...
57
  ?>
89965b6f   Geoffrey PREUD'HOMME   Reformattage
58
59
60
61
              </div>
          </div>
          <?php require_once("footer.php");?>
      </body>
d21cc05e   Geoffrey PREUD'HOMME   ?c parameter to o...
62
  
89965b6f   Geoffrey PREUD'HOMME   Reformattage
63
64
65
      </html>
  
      <?php
d21cc05e   Geoffrey PREUD'HOMME   ?c parameter to o...
66
  }
367056d9   Geoffrey PREUD'HOMME   Merge from flashF...
67
  ?>