$erreur

"; } } 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."; } } function addVoiture($db, $matricule, $marque, $modele, $nbplaces, $anneefab){ $requete = "INSERT INTO public.voiture (matricule, marque, modele, nbplaces, anneefab, mail) VALUES ('" . $matricule . "','" . $marque . "','" . $modele . "','" . $nbplaces . "','" . $anneefab . "','" . $_SESSION['mail'] . "');"; pg_query($db, $requete); } function changeVoiture($db, $matricule, $marque, $modele, $nbplaces, $anneefab){ $requete = "UPDATE public.voiture SET (matricule, marque, modele, nbplaces, anneefab) = ('" . $matricule . "','" . $marque . "','" . $modele . "','" . $nbplaces . "','" . $anneefab . "') WHERE mail = '" . $_SESSION['mail'] . "';"; echo "requete =" . $requete; pg_query($db, $requete); } function showVoiture($db){ $requete = "SELECT * FROM public.voiture WHERE voiture.mail = '" . $_SESSION['mail'] . "';"; if ($donnees = pg_query($db, $requete)) { while ($res = pg_fetch_assoc($donnees)) { echo "matricule = ".$res['matricule']."
"; echo "marque = ".$res['marque']."
"; echo "modele = ".$res['modele']."
"; echo "nombre de places = ".$res['nbplaces']."
"; echo "année de fabrication = ".$res['anneefab']."
"; //return "matricule = ".$res['matricule']."
"."marque = " . $res['marque'] . "
"."modele = " . $res['modele'] . "
"."nombre de places = " . $res['nbplaces'] . "
"."année de fabrication = " . $res['anneefab'] . "
"; } } } if (!isset($_SESSION['mail'])) { header('Location: index.php'); exit(); } if (isset($_POST['submitadd'])) { addVoiture($db, $matricule, $marque, $modele, $nbplaces, $anneefab); } if (isset($_POST['submitchange'])) { changeVoiture($db, $matricule, $marque, $modele, $nbplaces, $anneefab); } $user = getUser($db, $mail); if (!$user){ header('Location: profil.php?error=3'); exit(); } if (isset($_POST['login']) || isset($_FILES['avatar'])){ if (isset($_FILES['avatar']) and !empty($_FILES['avatar']['name'])) { $fic = $_FILES['avatar']; supprimerAvatar($mail); $res = uploadAvatar($mail, $fic); switch ($res){ case -1: header('Location: profil.php?error=4'); exit(); case -2: header('Location: profil.php?error=5'); exit(); case -3: header('Location: profil.php?error=6'); exit(); } } if (isset($_POST['login']) && isset($_POST['password']) && isset($_POST['confirmation']) && isset($_POST['prenom']) && isset($_POST['nom']) && isset($_POST['phone'])) { $login = htmlentities(pg_escape_string($_POST['login'])); $password = htmlentities(pg_escape_string($_POST['password'])); $confirmation = htmlentities(pg_escape_string($_POST['confirmation'])); $prenom = htmlentities(pg_escape_string($_POST['prenom'])); $nom = htmlentities(pg_escape_string($_POST['nom'])); $phone = htmlentities(pg_escape_string($_POST['phone'])); if (loginChange($user, $login)) { if (!isLoginUniqueModifier($db, $mail, $login)) { header('Location: profil.php?error=1'); exit(); } else { if (!modifierLogin($db, $mail, $login)) { header('Location: profil.php?error=6'); exit(); } } } if (strcmp($password, $confirmation) != 0) { header('Location: profil.php?error=2'); exit(); } if (!modifierUtilisateur($db, $mail, $prenom, $nom, $password, $phone)) { header('Location: profil.php?error=6'); exit(); } } sleep(0.85); header('Location: profil.php'); exit(); } ?> Profil

Profil de