diff --git a/WEB/index_inscription.css b/WEB/index_inscription.css
index b4720b5..63d68a5 100644
--- a/WEB/index_inscription.css
+++ b/WEB/index_inscription.css
@@ -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{
diff --git a/WEB/inscription.php b/WEB/inscription.php
index 28bb4d2..8c5a3a7 100644
--- a/WEB/inscription.php
+++ b/WEB/inscription.php
@@ -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 "
PHP a ignoré les données POST à cause d'une requête dépassant post_max_size (".ini_get('post_max_size').").
";
+ 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(){
}
?>
-
-
-
@@ -99,47 +132,51 @@ function init(){
-
+
\ No newline at end of file
diff --git a/WEB/mail.svg b/WEB/mail.svg
new file mode 100644
index 0000000..ee7b253
--- /dev/null
+++ b/WEB/mail.svg
@@ -0,0 +1,45 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/WEB/star.png b/WEB/star.png
new file mode 100644
index 0000000..eee5085
Binary files /dev/null and b/WEB/star.png differ
diff --git a/WEB/tableauBord/tableauBord.css b/WEB/tableauBord/tableauBord.css
index e80738b..081f4c0 100644
--- a/WEB/tableauBord/tableauBord.css
+++ b/WEB/tableauBord/tableauBord.css
@@ -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%;
}
\ No newline at end of file
diff --git a/WEB/tableauBord/tableauBord.js b/WEB/tableauBord/tableauBord.js
deleted file mode 100644
index 75c631a..0000000
--- a/WEB/tableauBord/tableauBord.js
+++ /dev/null
@@ -1,10 +0,0 @@
-window.onload = init;
-
-function init(){
- let button = document.getElementById('btnDeco');
- button.onclick = deconnexion;
-}
-
-function deconnexion() {
- document.getElementById('formDeco').submit();
-}
\ No newline at end of file
diff --git a/WEB/tableauBord/tableauBord.php b/WEB/tableauBord/tableauBord.php
index c22ff6b..32c4bed 100644
--- a/WEB/tableauBord/tableauBord.php
+++ b/WEB/tableauBord/tableauBord.php
@@ -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 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 "";
+ return "../imageProfil/default.svg";
}
?>
@@ -41,8 +94,8 @@
+
Tableau de bord
-
-
Bonjour
-
-
-
+
+
Bienvenue
+
+
+
+
+
+
+
+
Vous avez trajets proposés à effectuer.
+
+
+
+
Vous avez trajets réservés à effectuer.
+
+
+
+
Vous avez messages non lus.
+
+
+
+
Vous avez avis non lus.
+
+
diff --git a/WEB/wallpaper.jpg b/WEB/wallpaper.jpg
deleted file mode 100644
index 4ef0920..0000000
Binary files a/WEB/wallpaper.jpg and /dev/null differ
diff --git a/doc/Arborescence.drawio.pdf b/doc/Arborescence.drawio.pdf
new file mode 100644
index 0000000..16c89ea
Binary files /dev/null and b/doc/Arborescence.drawio.pdf differ