Fix the authenfication check.
authorJérôme Benoit <jerome.benoit@piment-noir.org>
Mon, 15 Jan 2018 21:24:35 +0000 (22:24 +0100)
committerJérôme Benoit <jerome.benoit@piment-noir.org>
Mon, 15 Jan 2018 21:24:35 +0000 (22:24 +0100)
And some cleanups in the HTML code.

Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org>
includes/config-example.php [moved from includes/example.config.php with 100% similarity]
includes/home.php
includes/login.php
includes/search.php
lib/utils.php

index fa15da86e49477d566811aa6d7440a67fe4afa36..058b19a219470e5a769d74c83114f737312dce79 100644 (file)
@@ -4,10 +4,10 @@ global $is_logged_in;
 
 if (!$is_logged_in) {
     $root_url = $configs['root_url'];
-    echo "<tr>\n";
-    echo "   <td><a href=\"$root_url/index.php?page=login\">S'identifier</a></td>\n";
-    echo "   <td><a href=\"$root_url/index.php?page=register\">Cre&#769;er un compte</a></td>\n";
-    echo "</tr>\n";
+    echo "  <tr>\n";
+    echo "    <td><a href=\"$root_url/index.php?page=login\">S'identifier</a></td>\n";
+    echo "    <td><a href=\"$root_url/index.php?page=register\">Cre&#769;er un compte</a></td>\n";
+    echo "  </tr>\n";
 }
 ?>
   <tr>
index cc7fd92ee0f2ccee7b59a922343742763919e3d2..fe5c0fa4c36d6645bd513ebf044c4a8f3b5cb903 100644 (file)
@@ -3,7 +3,7 @@
 <form action="index.php" id="login" method="post">
  <input type="hidden" name="form" value="login" />
  <label> Email : </label>
- <input type="email"size="25" name="email" required />
+ <input type="email"size="25" name="email" required/>
  <label> Mot de passe : </label>
  <input type="password" size="15" name="password" required/>
  <input type="submit" value="Valider">
index 2a1b947ea52c15f7274ce07c307b04aea77f779a..366c9627d9215aff953d4e7c76979b9f1e2965ba 100644 (file)
@@ -5,10 +5,10 @@
  <label> De&#769;part : Ville -> </label>
  <input type="text" size="15" name="departure_city" required/>
  <label> Date -> </label>
- <input type="datetime-local" name="departure_date" value="<?php echo date('Y-m-d\TH:i'); ?>" required>
+ <input type="datetime-local" name="departure_date" value="<?php echo date('Y-m-d\TH:i'); ?>" required/>
  <label> Arrive&#769;e : Ville -> </label>
  <input type="text" size="15" name="arrival_city" required/>
  <label> Date -> </label>
- <input type="datetime-local" name="arrival_date" value="<?php echo date('Y-m-d\TH:i'); ?>" required>
+ <input type="datetime-local" name="arrival_date" value="<?php echo date('Y-m-d\TH:i'); ?>" required/>
  <input type="submit" value="Valider">
 </form>
index bc5db9b6a6026aed5173b9083f60d3b89f7e651d..786c10e01cba770cdbd0b1e8bdcb69c4fbe32e5b 100644 (file)
@@ -53,7 +53,7 @@ function chk_password($email, $password)
 
 function chk_logged_in()
 {
-    if (isset($_SESSION['email'])) {
+    if (isset($_SESSION['email']) && isset($_SESSION['IP_address'])) {
         return true;
     } else {
         return false;