Merge branch 'master' of https://git.flavien.ovh/flavien/PROJET-WEB_STRI1A
This commit is contained in:
commit
83a81ec90c
BIN
WEB/car.png
Normal file
BIN
WEB/car.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
@ -15,4 +15,5 @@ function connexionBD(){
|
||||
$db = pg_connect("host=$host port=5432 dbname=$dbname user=$user password=$pass") or die("Erreur lors de la connexion à la base de données.");
|
||||
return $db;
|
||||
}
|
||||
?>
|
||||
|
||||
|
21
WEB/deconnexion.php
Normal file
21
WEB/deconnexion.php
Normal file
@ -0,0 +1,21 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: REMI
|
||||
* Date: 19/04/2019
|
||||
* Time: 10:10
|
||||
*/
|
||||
|
||||
require 'connectionBD.php';
|
||||
$db = connexionBD();
|
||||
init();
|
||||
|
||||
function init(){
|
||||
session_start();
|
||||
if (isset($_SESSION['mail'])){
|
||||
session_unset();
|
||||
session_destroy();
|
||||
}
|
||||
header('Location: index.php');
|
||||
exit();
|
||||
}
|
1
WEB/imageProfil/default.svg
Normal file
1
WEB/imageProfil/default.svg
Normal file
@ -0,0 +1 @@
|
||||
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg class="icon" height="512" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"><path d="M512 24.380952C242.590476 24.380952 24.380952 242.590476 24.380952 512s218.209524 487.619048 487.619048 487.619048 487.619048-218.209524 487.619048-487.619048S781.409524 24.380952 512 24.380952z m-7.314286 170.666667c90.209524 0 164.571429 70.704762 164.571429 158.476191s-73.142857 158.47619-164.571429 158.47619C414.47619 512 341.333333 441.295238 341.333333 353.52381s73.142857-158.47619 163.352381-158.476191zM792.380952 782.628571c0 45.104762-95.085714 46.32381-212.114285 46.32381H443.733333C326.704762 828.952381 231.619048 828.952381 231.619048 782.628571v-13.409523c0-113.371429 95.085714-204.8 212.114285-204.8h136.533334c117.028571 0 212.114286 91.428571 212.114285 204.8v13.409523z" fill="#666666" /></svg>
|
After Width: | Height: | Size: 966 B |
@ -1,7 +1,5 @@
|
||||
<?php
|
||||
|
||||
|
||||
|
||||
require("connectionBD.php");
|
||||
$db = connexionBD();
|
||||
init();
|
||||
@ -20,7 +18,8 @@ function getError($code){
|
||||
}
|
||||
}
|
||||
|
||||
function authentification($db, $mail, $password){
|
||||
function authentification($mail, $password){
|
||||
global $db;
|
||||
$result = pg_query_params($db, "SELECT * FROM Utilisateur WHERE mail = $1;", array($mail));
|
||||
if ($result){
|
||||
$row = pg_fetch_array($result);
|
||||
@ -33,23 +32,31 @@ function init(){
|
||||
global $db;
|
||||
session_start();
|
||||
|
||||
/*if(isset($_COOKIE['mail']) && isset($_COOKIE['password'])){
|
||||
if (authentification($_COOKIE['mail'], $_COOKIE['mail'])){
|
||||
$_SESSION['mail'] = $_COOKIE['mail'];
|
||||
}
|
||||
}*/
|
||||
if(!isset($_SESSION['mail'])){
|
||||
if (isset($_POST['mail_field'])){
|
||||
|
||||
$mail = htmlentities(pg_escape_string ($_POST['mail_field']));
|
||||
$mail = strtolower(htmlentities(pg_escape_string ($_POST['mail_field'])));
|
||||
$password = htmlentities(pg_escape_string($_POST['password']));
|
||||
$result = authentification($db, $mail, $password);
|
||||
$result = authentification($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();
|
||||
}
|
||||
}
|
||||
|
||||
@ -62,7 +69,7 @@ function init(){
|
||||
<title>Bienvenue sur Upssi'Covoit</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="formulaireMail">
|
||||
<div id="formulaire">
|
||||
<h1>Bienvenue sur Upssi'Covoit</h1>
|
||||
<form method="post" action="index.php">
|
||||
<div class="line">
|
||||
|
@ -5,25 +5,20 @@
|
||||
font-size: 1em;
|
||||
}
|
||||
|
||||
body{
|
||||
background-image: url("wallpaper.jpg");
|
||||
background-attachment: fixed;
|
||||
padding-top: 5%;
|
||||
padding-bottom: 5%;
|
||||
html, body{
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
#formulaireMail{
|
||||
margin-top: 50vh;
|
||||
transform: translate(-50%, -50%);
|
||||
body{
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
flex-direction: row;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
#formulaire{
|
||||
transform: translate(-50%);
|
||||
}
|
||||
|
||||
#formulaire, #formulaireMail{
|
||||
background-color: white;
|
||||
margin-left: 50vw;
|
||||
border-radius: 10px;
|
||||
padding: 4em;
|
||||
width: 40%;
|
||||
@ -43,12 +38,16 @@ form{
|
||||
}
|
||||
|
||||
.form{
|
||||
width: 55%;
|
||||
box-sizing: border-box;
|
||||
width: 55%;
|
||||
border: 1px solid grey;
|
||||
margin-bottom: 0.7em;
|
||||
}
|
||||
|
||||
#avatar{
|
||||
border-style: none;
|
||||
}
|
||||
|
||||
.button{
|
||||
cursor: pointer;
|
||||
font-weight: bold;
|
||||
@ -79,6 +78,7 @@ form{
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
flex-direction: row;
|
||||
justify-content: left;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
@ -92,16 +92,10 @@ form{
|
||||
}
|
||||
|
||||
label{
|
||||
font-size: 1.1em;
|
||||
word-break: break-all;
|
||||
box-sizing: border-box;
|
||||
display: block;
|
||||
width: 43%;
|
||||
}
|
||||
|
||||
input{
|
||||
margin-left: 2%;
|
||||
font-size: 1em;
|
||||
font-size: 1.1em;
|
||||
width: 45%;
|
||||
min-width: 8em;
|
||||
}
|
||||
|
||||
h1{
|
||||
|
@ -14,17 +14,23 @@ function printError(){
|
||||
function getError($code){
|
||||
switch ($code){
|
||||
case 1:
|
||||
return "Cette adresse est déjà associée à un compte.";
|
||||
return "L'adresse mail est invalide.";
|
||||
case 2:
|
||||
return "Ce login est déjà associé à un compte.";
|
||||
return "Cette adresse est déjà associée à un compte.";
|
||||
case 3:
|
||||
return "Erreur lors de la création du compte.";
|
||||
return "Ce login est déjà associé à un compte.";
|
||||
case 4:
|
||||
return "Erreur lors de la vérification de l'unicité de l'adresse mail.";
|
||||
return "Le fichier envoyé doit être une image au format PNG.";
|
||||
case 5:
|
||||
return "La taille de l'image ne doit pas dépasser 2 MB.";
|
||||
case 6:
|
||||
return "Erreur lors de la création du compte.";
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
function isMailUnique($db, $mail){
|
||||
function isMailUnique($mail){
|
||||
global $db;
|
||||
$result = pg_query_params($db, "SELECT * FROM Utilisateur WHERE mail = $1;", array($mail));
|
||||
if($result){
|
||||
$row = pg_fetch_array($result);
|
||||
@ -33,7 +39,8 @@ function isMailUnique($db, $mail){
|
||||
return false;
|
||||
}
|
||||
|
||||
function isLoginUnique($db, $login){
|
||||
function isLoginUnique($login){
|
||||
global $db;
|
||||
$result = pg_query_params($db, "SELECT * FROM Utilisateur WHERE login = $1;", array($login));
|
||||
if($result){
|
||||
$row = pg_fetch_array($result);
|
||||
@ -42,40 +49,69 @@ function isLoginUnique($db, $login){
|
||||
return false;
|
||||
}
|
||||
|
||||
function creerUtilisateur($db, $mail, $password, $prenom, $nom, $login, $phone, $dateN){
|
||||
function creerUtilisateur($mail, $password, $prenom, $nom, $login, $phone, $dateN){
|
||||
global $db;
|
||||
$result = pg_query_params($db, "INSERT INTO Utilisateur VALUES ($1, $2, $3, $4, $5, $6, to_date($7, 'YYYY/MM/DD'), false);", array($mail, $password, $prenom, $nom, $login, $phone, $dateN));
|
||||
return $result;
|
||||
}
|
||||
|
||||
function uploadAvatar($mail){
|
||||
if(isset($_FILES['avatar']) and $_FILES['avatar']['name'] != "") {
|
||||
$target_file = "imageProfil/$mail.png";
|
||||
$file_tmp = $_FILES['avatar']['tmp_name'];
|
||||
$extension = end(explode('.', $_FILES['avatar']['name']));
|
||||
$check = getimagesize($file_tmp);
|
||||
if($check === false or !in_array($extension, array('png'))) {
|
||||
header('Location: inscription.php?error=4');
|
||||
exit();
|
||||
}
|
||||
else if ($_FILES['avatar']['size'] > 2 * 1024 * 1024){
|
||||
header('Location: inscription.php?error=5');
|
||||
exit();
|
||||
}
|
||||
else{
|
||||
move_uploaded_file($file_tmp, $target_file);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function init(){
|
||||
global $db;
|
||||
session_start();
|
||||
|
||||
if(!isset($_SESSION['mail'])){
|
||||
if ($_SERVER['REQUEST_METHOD'] == 'POST' && empty($_POST) && empty($_FILES) && $_SERVER['CONTENT_LENGTH'] > 0 ){
|
||||
echo "<p class='error'>PHP a ignoré les données POST à cause d'une requête dépassant post_max_size (".ini_get('post_max_size').").</p>";
|
||||
exit();
|
||||
}
|
||||
if(isset($_POST['mail_field'])){
|
||||
|
||||
$login = htmlentities(pg_escape_string ($_POST['login_field']));
|
||||
$password = htmlentities(pg_escape_string ($_POST['password']));
|
||||
$prenom = htmlentities(pg_escape_string ($_POST['prenom']));
|
||||
$nom = htmlentities(pg_escape_string ($_POST['nom']));
|
||||
$dateN = htmlentities(pg_escape_string ($_POST['dateN']));
|
||||
$mail = htmlentities(pg_escape_string ($_POST['mail_field']));
|
||||
$mail = strtolower(htmlentities(pg_escape_string ($_POST['mail_field'])));
|
||||
$phone = htmlentities(pg_escape_string ($_POST['phone']));
|
||||
|
||||
if(!isMailUnique($db, $mail)){
|
||||
if(!filter_var($mail, FILTER_VALIDATE_EMAIL)){
|
||||
header('Location: inscription.php?error=1');
|
||||
exit();
|
||||
}
|
||||
elseif(!isLoginUnique($db, $mail)){
|
||||
elseif(!isMailUnique($mail)){
|
||||
header('Location: inscription.php?error=2');
|
||||
exit();
|
||||
}
|
||||
elseif(!isLoginUnique($login)){
|
||||
header('Location: inscription.php?error=3');
|
||||
exit();
|
||||
}
|
||||
else{
|
||||
$result = creerUtilisateur($db, $mail, $password, $prenom, $nom, $login, $phone, $dateN);
|
||||
uploadAvatar($mail);
|
||||
$result = creerUtilisateur($mail, $password, $prenom, $nom, $login, $phone, $dateN);
|
||||
if($result){
|
||||
header('Location: index.php');
|
||||
}
|
||||
else{
|
||||
header('Location: inscription.php?error=3');
|
||||
header('Location: inscription.php?error=6');
|
||||
}
|
||||
}
|
||||
|
||||
@ -87,9 +123,6 @@ function init(){
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
@ -99,47 +132,51 @@ function init(){
|
||||
<script src="inscription.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="formulaire">
|
||||
<h1>Inscription</h1>
|
||||
<form method="post" action="inscription.php">
|
||||
<div class="line">
|
||||
<label for="mail_field">Adresse mail : </label>
|
||||
<input id="mail_field" class="form" name="mail_field" type="email" maxlength="100" required>
|
||||
</div>
|
||||
<div class="line">
|
||||
<label for="login_field">Login : </label>
|
||||
<input id="login_field" class="form" name="login_field" type="text" maxlength="50" required>
|
||||
</div>
|
||||
<div class="line">
|
||||
<label for="password">Mot de passe : </label>
|
||||
<input class="form" id="password" name="password" type="password" maxlength="50" required>
|
||||
</div>
|
||||
<div class="line">
|
||||
<label for="confirmation">Confirmation : </label>
|
||||
<input class="form" id="confirmation" name="confirmation" type="password" maxlength="16">
|
||||
</div>
|
||||
<div class="line">
|
||||
<label for="prenom_field">Prénom : </label>
|
||||
<input id="prenom_field" class="form" name="prenom" type="text" maxlength="50" required>
|
||||
</div>
|
||||
<div class="line">
|
||||
<label for="nom_field">Nom : </label>
|
||||
<input id="nom_field" class="form" name="nom" type="text" maxlength="50" required>
|
||||
</div>
|
||||
<div class="line">
|
||||
<label for="dateN_field">Date de naissance : </label>
|
||||
<input id="dateN_field" class="form" name="dateN" type="date" required>
|
||||
</div>
|
||||
<div class="line">
|
||||
<label for="phone_field">Numéro de téléphone : </label>
|
||||
<input id="phone_field" class="form" name="phone" type="tel" pattern="[0-9]{10}" maxlength="10" required>
|
||||
</div>
|
||||
<?php
|
||||
printError();
|
||||
?>
|
||||
<input id="submit" class="button" type="submit" value="S'inscrire">
|
||||
</form>
|
||||
<p id="enregistrer">Si vous avez déjà un compte <a href="index.php" title="S'identifier">cliquez ici</a>.</p>
|
||||
</div>
|
||||
<div id="formulaire">
|
||||
<h1>Inscription</h1>
|
||||
<form method="post" enctype="multipart/form-data" action="inscription.php">
|
||||
<div class="line">
|
||||
<label for="mail_field">Adresse mail : </label>
|
||||
<input id="mail_field" class="form" name="mail_field" type="email" maxlength="100" required>
|
||||
</div>
|
||||
<div class="line">
|
||||
<label for="login_field">Login : </label>
|
||||
<input id="login_field" class="form" name="login_field" type="text" maxlength="50" required>
|
||||
</div>
|
||||
<div class="line">
|
||||
<label for="password">Mot de passe : </label>
|
||||
<input class="form" id="password" name="password" type="password" maxlength="50" required>
|
||||
</div>
|
||||
<div class="line">
|
||||
<label for="confirmation">Confirmation : </label>
|
||||
<input class="form" id="confirmation" name="confirmation" type="password" maxlength="16">
|
||||
</div>
|
||||
<div class="line">
|
||||
<label for="prenom_field">Prénom : </label>
|
||||
<input id="prenom_field" class="form" name="prenom" type="text" maxlength="50" required>
|
||||
</div>
|
||||
<div class="line">
|
||||
<label for="nom_field">Nom : </label>
|
||||
<input id="nom_field" class="form" name="nom" type="text" maxlength="50" required>
|
||||
</div>
|
||||
<div class="line">
|
||||
<label for="dateN_field">Date de naissance : </label>
|
||||
<input id="dateN_field" class="form" name="dateN" type="date" required>
|
||||
</div>
|
||||
<div class="line">
|
||||
<label for="phone_field">Numéro de téléphone : </label>
|
||||
<input id="phone_field" class="form" name="phone" type="tel" pattern="[0-9]{10}" maxlength="10" required>
|
||||
</div>
|
||||
<div class="line">
|
||||
<label for="avatar">Image du Profil :</label>
|
||||
<input type="file" id="avatar" class="form" name="avatar" accept="image/png">
|
||||
</div>
|
||||
<?php
|
||||
printError();
|
||||
?>
|
||||
<input id="submit" class="button" type="submit" value="S'inscrire">
|
||||
</form>
|
||||
<p id="enregistrer">Si vous avez déjà un compte <a href="index.php" title="S'identifier">cliquez ici</a>.</p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
45
WEB/mail.svg
Normal file
45
WEB/mail.svg
Normal file
@ -0,0 +1,45 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- Generator: Adobe Illustrator 16.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||
width="485.211px" height="485.211px" viewBox="0 0 485.211 485.211" style="enable-background:new 0 0 485.211 485.211;"
|
||||
xml:space="preserve">
|
||||
<g>
|
||||
<path d="M485.211,363.906c0,10.637-2.992,20.498-7.785,29.174L324.225,221.67l151.54-132.584
|
||||
c5.895,9.355,9.446,20.344,9.446,32.219V363.906z M242.606,252.793l210.863-184.5c-8.653-4.737-18.397-7.642-28.908-7.642H60.651
|
||||
c-10.524,0-20.271,2.905-28.889,7.642L242.606,252.793z M301.393,241.631l-48.809,42.734c-2.855,2.487-6.41,3.729-9.978,3.729
|
||||
c-3.57,0-7.125-1.242-9.98-3.729l-48.82-42.736L28.667,415.23c9.299,5.834,20.197,9.329,31.983,9.329h363.911
|
||||
c11.784,0,22.687-3.495,31.983-9.329L301.393,241.631z M9.448,89.085C3.554,98.44,0,109.429,0,121.305v242.602
|
||||
c0,10.637,2.978,20.498,7.789,29.174l153.183-171.44L9.448,89.085z"/>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 1.3 KiB |
BIN
WEB/star.png
Normal file
BIN
WEB/star.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.7 KiB |
@ -4,14 +4,25 @@
|
||||
font-family: "Calibri Light";
|
||||
}
|
||||
|
||||
h1{
|
||||
font-size: 3em;
|
||||
text-align: center;
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
#content{
|
||||
margin-top: 8vh;
|
||||
background-color: aqua;
|
||||
margin-left: 50vw;
|
||||
border-radius: 10px;
|
||||
padding: 4em;
|
||||
width: 84%;
|
||||
transform: translate(-50%);
|
||||
min-width: 320px;
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-wrap: nowrap;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
#tableauBord{
|
||||
margin: 2em;
|
||||
padding: 1em;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.menu {
|
||||
@ -23,6 +34,10 @@
|
||||
}
|
||||
|
||||
.menuItem {
|
||||
display: flex;
|
||||
flex-wrap: nowrap;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
color: white;
|
||||
width: 10%;
|
||||
min-width: 5em;
|
||||
@ -39,11 +54,75 @@
|
||||
border-bottom: 4px solid orange;
|
||||
}
|
||||
|
||||
#divImgProfil{
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-wrap: nowrap;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
#imgProfil{
|
||||
margin-top: 30px;
|
||||
background-color: white;
|
||||
margin-top: 2.5em;
|
||||
width: 60%;
|
||||
height: 60%;
|
||||
max-width: 210px;
|
||||
max-height: 210px;
|
||||
border-radius: 10px;
|
||||
}
|
||||
|
||||
#trajet{
|
||||
margin-top: 2em;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
flex-direction: row;
|
||||
justify-content: center;
|
||||
text-align: center;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.btnTrajet{
|
||||
display: flex;
|
||||
flex-wrap: nowrap;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
text-decoration: none;
|
||||
padding: 0.4em;
|
||||
color: black;
|
||||
background-color: lightgray;
|
||||
border: 1px solid black;
|
||||
|
||||
}
|
||||
|
||||
.btnTrajet:hover{
|
||||
background-color: grey;
|
||||
}
|
||||
|
||||
#btnTrajet2{
|
||||
margin-left: 10%;
|
||||
}
|
||||
|
||||
#recap{
|
||||
margin-top: 2.5em;
|
||||
width: 50%;
|
||||
margin-left: 50%;
|
||||
transform: translate(-50%);
|
||||
max-width: 300px;
|
||||
max-height: 300px;
|
||||
border-radius: 10px;
|
||||
}
|
||||
|
||||
.recapLine{
|
||||
margin-bottom: 1.5em;
|
||||
display: flex;
|
||||
flex-wrap: nowrap;
|
||||
justify-content: left;
|
||||
align-items: center;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.recapIcon{
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
}
|
||||
|
||||
p{
|
||||
margin-left: 10%;
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
window.onload = init;
|
||||
|
||||
function init(){
|
||||
let button = document.getElementById('btnDeco');
|
||||
button.onclick = deconnexion;
|
||||
}
|
||||
|
||||
function deconnexion() {
|
||||
document.getElementById('formDeco').submit();
|
||||
}
|
@ -6,32 +6,85 @@
|
||||
init();
|
||||
|
||||
function init(){
|
||||
global $mail;
|
||||
session_start();
|
||||
|
||||
global $mail;
|
||||
//Si on est pas connecté redirection vers la page de connexion
|
||||
if(!isset($_SESSION['mail'])){
|
||||
header('Location: ../index.php');
|
||||
exit();
|
||||
}
|
||||
else{
|
||||
$mail = $_SESSION['mail'];
|
||||
//Si clic sur le bouton de déconnexion détruire la session et rediriger l'utilisateur
|
||||
if(isset($_POST['deco'])){
|
||||
session_unset();
|
||||
session_destroy();
|
||||
header('Location: ../index.php');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function getPrenom($db, $mail){
|
||||
function getPrenom($mail){
|
||||
global $db;
|
||||
$result = pg_query_params($db, "SELECT prenom from Utilisateur WHERE mail = $1;", array($mail));
|
||||
if($result){
|
||||
$row = pg_fetch_array($result);
|
||||
$prenom = $row[0];
|
||||
return " $prenom";
|
||||
return $prenom;
|
||||
}
|
||||
return "";
|
||||
return null;
|
||||
}
|
||||
|
||||
function getLogin($mail){
|
||||
global $db;
|
||||
$result = pg_query_params($db, "SELECT login from Utilisateur WHERE mail = $1;", array($mail));
|
||||
if($result){
|
||||
$row = pg_fetch_array($result);
|
||||
$login = $row[0];
|
||||
return $login;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
function getTrajetsProposes($mail){
|
||||
global $db;
|
||||
$result = pg_query_params($db, "SELECT COUNT(*) from Trajet WHERE mailProposition = $1 AND estAnnule = false AND datedepart >= current_date;", array($mail));
|
||||
if($result){
|
||||
$row = pg_fetch_array($result);
|
||||
return $row[0];
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
function getTrajetsReserves($mail){
|
||||
global $db;
|
||||
$result = pg_query_params($db, "SELECT COUNT(*) FROM trajet tr, reserver r WHERE r.codetrajet = tr.codetrajet AND mailutilisateur = $1 AND etatres != 'Annulée' AND estAnnule = false AND datedepart >= current_date;", array($mail));
|
||||
if($result){
|
||||
$row = pg_fetch_array($result);
|
||||
return $row[0];
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
function getMessagesNonLus($mail){
|
||||
global $db;
|
||||
$result = pg_query_params($db, "SELECT COUNT(*) from Message WHERE mailRecepteur = $1 AND estLu = FALSE;", array($mail));
|
||||
if($result){
|
||||
$row = pg_fetch_array($result);
|
||||
$login = $row[0];
|
||||
return $login;
|
||||
}
|
||||
}
|
||||
|
||||
function getAvisNonLus($mail){
|
||||
global $db;
|
||||
$result = pg_query_params($db, "SELECT COUNT(tr.mailProposition) FROM Trajet tr, Avis av WHERE tr.codeTrajet = av.codeTrajet AND av.estLu = false AND tr.mailProposition = $1;", array($mail));
|
||||
if($result){
|
||||
$row = pg_fetch_array($result);
|
||||
$login = $row[0];
|
||||
return $login;
|
||||
}
|
||||
}
|
||||
|
||||
function getPathImgProfil($mail){
|
||||
if (file_exists("../imageProfil/$mail.png")){
|
||||
return "../imageProfil/$mail.png";
|
||||
}
|
||||
return "../imageProfil/default.svg";
|
||||
}
|
||||
|
||||
?>
|
||||
@ -41,8 +94,8 @@
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<link rel="stylesheet" href="tableauBord.css">
|
||||
<link rel="icon" type="image/png" href="" />
|
||||
<title>Tableau de bord</title>
|
||||
<script src="tableauBord.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<nav class="menu">
|
||||
@ -53,18 +106,36 @@
|
||||
<a class="menuItem" href="../inscription.php">Avis reçus</a>
|
||||
<a class="menuItem" href="../inscription.php">Avis laissés</a>
|
||||
<a class="menuItem" href="../inscription.php">Profil</a>
|
||||
<a id="btnDeco" class="menuItem">Se déconnecter</a>
|
||||
<form id="formDeco" method="post" action="tableauBord.php">
|
||||
<input type="hidden" value="true" name="deco">
|
||||
</form>
|
||||
<a class="menuItem" href="../deconnexion.php">Se déconnecter</a>
|
||||
</nav>
|
||||
<div id="content">
|
||||
<h1>Bonjour<?php
|
||||
echo getPrenom($db,$mail);
|
||||
?>
|
||||
</h1>
|
||||
<div id="cotent">
|
||||
<img id="imgProfil" src="../wallpaper.jpg">
|
||||
<div id="tableauBord">
|
||||
<h1>Bienvenue <?php echo getLogin($mail); ?></h1>
|
||||
<div id="divImgProfil">
|
||||
<img id="imgProfil" src="<?php echo getPathImgProfil($mail); ?>">
|
||||
</div>
|
||||
<div id="trajet">
|
||||
<a class="btnTrajet" href="../ah.php">Déposer un trajet</a>
|
||||
<a id="btnTrajet2" class="btnTrajet" href="../ah.php">Rechercher un trajet</a>
|
||||
</div>
|
||||
<div id="recap">
|
||||
<div class="recapLine">
|
||||
<img class="recapIcon" src="../car.png">
|
||||
<p>Vous avez <?php echo getTrajetsProposes($mail); ?> trajets proposés à effectuer.</p>
|
||||
</div>
|
||||
<div class="recapLine">
|
||||
<img class="recapIcon" src="../car.png">
|
||||
<p>Vous avez <?php echo getTrajetsReserves($mail); ?> trajets réservés à effectuer.</p>
|
||||
</div>
|
||||
<div class="recapLine">
|
||||
<img class="recapIcon" src="../mail.svg">
|
||||
<p>Vous avez <?php echo getMessagesNonLus($mail); ?> messages non lus.</p>
|
||||
</div>
|
||||
<div class="recapLine">
|
||||
<img class="recapIcon" src="../star.png">
|
||||
<p>Vous avez <?php echo getAvisNonLus($mail); ?> avis non lus.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 131 KiB |
BIN
doc/Arborescence.drawio.pdf
Normal file
BIN
doc/Arborescence.drawio.pdf
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user