|
|
|
@ -1,67 +1,16 @@
|
|
|
|
|
<?php
|
|
|
|
|
session_start();
|
|
|
|
|
require_once('../connexionBD.php');
|
|
|
|
|
require_once ('../ressources/user.php');
|
|
|
|
|
require_once ('../ressources/verifconnecte.php');
|
|
|
|
|
require_once ('../ressources/user.php');
|
|
|
|
|
|
|
|
|
|
$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();
|
|
|
|
|
$user = getUser($mail);
|
|
|
|
|
if(!$user['estadmin']){
|
|
|
|
|
header('Location: ../index.php');
|
|
|
|
|
exit();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$delmail = $_POST['delmail'];
|
|
|
|
|
$delmail = isset($_POST['delmail']) ? $_POST['delmail'] : NULL;
|
|
|
|
|
?>
|
|
|
|
|
<!DOCTYPE html>
|
|
|
|
|
<html lang="fr">
|
|
|
|
|