Commit d21cc05e202c0c8e73ee2d7566254e428ce4ffbc

Authored by Geoffrey PREUD'HOMME
1 parent bce06567

?c parameter to only get content of page

Showing 1 changed file with 27 additions and 17 deletions   Show diff stats
1 <?php 1 <?php
2 session_start(); 2 session_start();
3 require_once("creds.php"); 3 require_once("creds.php");
  4 +
  5 +
  6 +$page = end(explode('/', parse_url(($_SERVER["REQUEST_URI"]))['path']));
  7 +switch ($page) {
  8 + case 'home':
  9 + case 'description':
  10 + case 'sponsors':
  11 + case 'schools':
  12 + case 'contact':
  13 + $toLoad = $page;
  14 + break;
  15 + case '':
  16 + $toLoad = 'home';
  17 + break;
  18 + default:
  19 + $toLoad = '404';
  20 + break;
  21 +}
  22 +
  23 +if (isset($_GET['c'])) {
  24 + require_once("$toLoad.php");
  25 +} else {
4 ?> 26 ?>
5 <!DOCTYPE> 27 <!DOCTYPE>
6 <html> 28 <html>
@@ -27,23 +49,7 @@ require_once(&quot;creds.php&quot;); @@ -27,23 +49,7 @@ require_once(&quot;creds.php&quot;);
27 <div class="col-md-12 center-block"> 49 <div class="col-md-12 center-block">
28 <div class="col-md-12" id="mainContainer"> 50 <div class="col-md-12" id="mainContainer">
29 <?php 51 <?php
30 -$page = end(explode('/', $_SERVER["REQUEST_URI"]));  
31 -switch ($page) {  
32 - case 'home':  
33 - case 'description':  
34 - case 'sponsors':  
35 - case 'schools':  
36 - case 'contact':  
37 - $toLoad = $page;  
38 - break;  
39 - case '':  
40 - $toLoad = 'home';  
41 - break;  
42 - default:  
43 - $toLoad = '404';  
44 - break;  
45 -}  
46 -require_once("$toLoad.php"); 52 + require_once("$toLoad.php");
47 ?> 53 ?>
48 </div> 54 </div>
49 </div> 55 </div>
@@ -52,3 +58,7 @@ require_once(&quot;$toLoad.php&quot;); @@ -52,3 +58,7 @@ require_once(&quot;$toLoad.php&quot;);
52 <?php require_once("footer.php");?> 58 <?php require_once("footer.php");?>
53 </body> 59 </body>
54 </html> 60 </html>
  61 +
  62 +<?php
  63 +}
  64 +?>
55 \ No newline at end of file 65 \ No newline at end of file