2019-04-18 18:37:23 +02:00
|
|
|
<?php
|
2019-05-10 10:23:27 +02:00
|
|
|
session_start();
|
2019-05-21 16:06:03 +02:00
|
|
|
require_once("connexionBD.php");
|
2019-05-22 13:56:52 +02:00
|
|
|
require_once ('./ressources/user.php');
|
2019-05-10 10:23:27 +02:00
|
|
|
|
|
|
|
if(!isset($_SESSION['mail'])){
|
|
|
|
if (isset($_POST['mail_field'])){
|
|
|
|
|
|
|
|
$mail = strtolower(htmlentities(pg_escape_string ($_POST['mail_field'])));
|
|
|
|
$password = htmlentities(pg_escape_string($_POST['password']));
|
|
|
|
$result = authentification($db, $mail, $password);
|
|
|
|
if($result) {
|
|
|
|
$_SESSION['mail'] = $mail;
|
|
|
|
header('Location: tableauBord/tableauBord.php');
|
|
|
|
exit();
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
header('Location: index.php?error=1');
|
|
|
|
exit();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else{
|
|
|
|
header('Location: tableauBord/tableauBord.php');
|
|
|
|
exit();
|
|
|
|
}
|
2019-04-18 18:37:23 +02:00
|
|
|
?>
|
|
|
|
<!DOCTYPE html>
|
|
|
|
<html lang="fr">
|
|
|
|
<head>
|
|
|
|
<meta charset="UTF-8">
|
2019-05-21 16:06:03 +02:00
|
|
|
<link rel="stylesheet" href="index.css">
|
2019-04-18 18:37:23 +02:00
|
|
|
<title>Bienvenue sur Upssi'Covoit</title>
|
|
|
|
</head>
|
|
|
|
<body>
|
2019-04-28 14:53:08 +02:00
|
|
|
<div id="formulaire">
|
2019-04-18 18:37:23 +02:00
|
|
|
<h1>Bienvenue sur Upssi'Covoit</h1>
|
|
|
|
<form method="post" action="index.php">
|
|
|
|
<div class="line">
|
|
|
|
<label for="mail_field">Adresse mail : </label>
|
|
|
|
<input id="mail_field" class="form" name="mail_field" type="email" maxlength="150" required>
|
|
|
|
</div>
|
|
|
|
<div class="line">
|
|
|
|
<label for="password_field">Mot de passe : </label>
|
|
|
|
<input id="password_field" class="form" id="password" name="password" type="password" maxlength="16" required>
|
|
|
|
</div>
|
|
|
|
<?php
|
|
|
|
if(isset($_GET['error'])){
|
2019-05-22 15:33:25 +02:00
|
|
|
$erreur = getErrorIndex($_GET['error']);
|
2019-04-18 18:37:23 +02:00
|
|
|
echo "<p class = 'error'>$erreur</p>";
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
<input id="submit" class="button" type="submit" value="Se connecter">
|
|
|
|
</form>
|
2019-05-22 13:56:52 +02:00
|
|
|
<p id="enregistrer">Si vous n'avez pas de compte <a href="./inscription/inscription.php" title="Créer un compte">cliquez ici</a>.</p>
|
2019-04-18 18:37:23 +02:00
|
|
|
</div>
|
|
|
|
</body>
|
2019-05-21 16:06:03 +02:00
|
|
|
</html>
|