-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
54 lines (45 loc) · 1.8 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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
<?php
require('src/inc/pdo.php');
require('src/inc/functions.php');
session_start();
$errors = [];
// TODO: rediriger vers la page dashboard si l'utilisateur est connecté
if (!empty($_POST['mail'])) {
$mail = checkXss($_POST['mail']);
$errors = checkEmail($errors, $mail, 'mail');
$errors = checkField($errors, $mail, 'mail', 6, 160);
$checkUsedEmail = select($pdo, 'bn_users', 'mail', 'mail', $mail);
$_SESSION['visitor'] = [
'mail' => $mail
];
if (empty($checkUsedEmail)) {
header('Location: ./register.php');
} else {
header('Location: ./login.php');
}
die();
}
$title = 'Accueil - Bookination';
include('src/template/header.php');
?>
<section id="home">
<div class="wrap-fluid">
<div class="home-featured">
<h1>Carnet<br>de vaccins</h1>
<p>
Bookination est un carnet de vaccins intelligent,<br>
il vous rappelle la date de vos prochains rendez-vous.
</p>
<form action="" method="post">
<input type="email" name="mail" placeholder="Votre email" value="<?php if (!empty($_POST['mail'])) $_POST['mail'];
elseif (!empty($_SESSION['user']['mail'])) echo $_SESSION['user']['mail'];
elseif (!empty($_SESSION['visitor']['mail'])) echo $_SESSION['visitor']['mail']; ?>">
<a class="btn btn-instant-login" onclick="this.closest('form').submit();return false;"></a>
</form>
</div>
<div class="home-image">
<img src="assets/img/doctors.svg" alt="Image de docteurs">
</div>
</div>
</section>
<?php include('src/template/footer.php');