From eda70327ac8c0aa949d2fa422957daf7acea0b89 Mon Sep 17 00:00:00 2001 From: "remi.biette" Date: Sat, 11 May 2019 12:44:29 +0200 Subject: [PATCH] Page profil v1 --- WEB/connectionBD.php | 19 ------ WEB/profil.css | 8 +++ WEB/profil.php | 157 ++++++++++++++++++++++++++++++++++++++----- 3 files changed, 148 insertions(+), 36 deletions(-) delete mode 100644 WEB/connectionBD.php diff --git a/WEB/connectionBD.php b/WEB/connectionBD.php deleted file mode 100644 index 8ee39c4..0000000 --- a/WEB/connectionBD.php +++ /dev/null @@ -1,19 +0,0 @@ - - diff --git a/WEB/profil.css b/WEB/profil.css index d73e97f..b977ff1 100644 --- a/WEB/profil.css +++ b/WEB/profil.css @@ -11,6 +11,10 @@ justify-content: center; } +#mail_field, #dateN_field{ + background-color: lightgray; +} + #imgProfil{ background-color: white; margin-top: 2.5em; @@ -19,4 +23,8 @@ max-width: 210px; max-height: 210px; border-radius: 10px; +} + +#changePass{ + margin-bottom: 0.7em; } \ No newline at end of file diff --git a/WEB/profil.php b/WEB/profil.php index 362991b..f1c21ae 100644 --- a/WEB/profil.php +++ b/WEB/profil.php @@ -1,41 +1,160 @@ 2 * 1024 * 1024){ + header('Location: inscription.php?error=5'); + exit(); + } + else{ + move_uploaded_file($file_tmp, $target_file); + } +} + +function modifierUtilisateur($db, $prenom, $nom, $login, $phone){ + $result = pg_query_params($db, "UPDATE Utilisateur SET prenom = $1, nom = $2, login = $3, telephone = $4;", array($prenom, $nom, $login, $phone)); + return $result; +} + +function getUser($db, $mail){ $result = pg_query_params($db,"SELECT * FROM Utilisateur WHERE mail = $1;", array($mail)); return pg_fetch_array($result); } +function printError(){ + if(isset($_GET['error'])){ + $erreur = getErrorProfil($_GET['error']); + echo "

$erreur

"; + } +} + +function isLoginUniqueModifier($db, $mail, $login){ + $result = pg_query_params($db, "SELECT * FROM Utilisateur WHERE login = $1 AND mail != $2;", array($login, $mail)); + if($result){ + $row = pg_fetch_array($result); + return (strcmp($row['login'], $login) != 0); + } + return false; +} + +function getErrorProfil($code){ + switch ($code){ + case 1: + return "Ce login est déjà associé à un compte."; + case 2: + return "Les mots de passe ne correspondent pas."; + case 3: + return "Erreur lors de la récupération des informations de profil."; + case 4: + return "Le fichier envoyé doit être une image au format PNG ou JPEG."; + case 5: + return "La taille de l'image ne doit pas dépasser 2 MB."; + case 6: + return "Erreur lors de la modification du compte."; + + } +} + ?> - - Profil + + + Profil

Profil

-
+
+ +
+
@@ -45,7 +164,12 @@ function getUser($mail){
- Changer de mot de passe. + + +
+
+ +
@@ -65,14 +189,13 @@ function getUser($mail){
- +
- +
-

Si vous avez déjà un compte cliquez ici.