Code cleanups and comments
[Project_webapp.git] / includes / header.php
index ac394bfae0d8429433b195a446774f661996514c..31af395aaab226c80fa7103943878f5d337882e5 100644 (file)
@@ -1,25 +1,49 @@
 <?php
 include('header.html');
+include('lib/utils.php');
 /**
  * Let's use an array as the list of tunables.
  * Put in a variable the inclusion of this file:
  * $config_var = include('config.php');
  */
 $configs = include('config.php');
+
+/**
+ * session_start start a unique session for the current browser client
+ */
+session_start();
+$is_logged_in = chk_logged_in();
 ?>
 <div id="header">
     <!-- Put headers stuff here -->
     <a href="<?php echo $configs['root_url'] ?>/index.php?page=home">Bienvenue sur Air Polytech !</a>
 </div>
+<div id="account">
+    <a href="<?php echo $configs['root_url'] ?>/index.php?page=account">Mon espace client</a>
+    <br>
+    <?php
+    $root_url = $configs['root_url'];
+    if ($is_logged_in) {
+        echo htmlentities($_SESSION['email']) . " <br>";
+        echo "<a href=\"$root_url/index.php?page=logout\">Se de&#769;connecter</a>";
+    } else {
+        echo "<a href=\"$root_url/index.php?page=login\">S'identifier</a>";
+    }
+    ?>
+</div>
+<div id="menu">
+    | <a href="<?php echo $configs['root_url'] ?>/index.php?page=home">Accueil</a>
+    | <a href="<?php echo $configs['root_url'] ?>/index.php?page=search">Rechercher un vol</a>
+    |
+    <?php
+    if ($is_logged_in) {
+        echo "<a href=\"" . $configs['root_url'] . "/index.php?page=reservations\">Mes re&#769;servations</a> |\n";
+    }
+    ?>
+</div>
+
 <?php
 
-function display_menu() {
-    switch ($page) {
-        case "home":
-        break;
-        case "register":
-        break;
-    }
 
-}
+
 ?>