|
|
@ -1,4 +1,42 @@
|
|
|
|
<?php
|
|
|
|
<?php
|
|
|
|
|
|
|
|
function getError($code){
|
|
|
|
|
|
|
|
switch ($code){
|
|
|
|
|
|
|
|
case 1:
|
|
|
|
|
|
|
|
return "Adresse mail ou mot de passe invalide.";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//trouver dans Inscription
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
function getError($code)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
switch ($code) {
|
|
|
|
|
|
|
|
case 1:
|
|
|
|
|
|
|
|
return "L'adresse mail est invalide.";
|
|
|
|
|
|
|
|
case 2:
|
|
|
|
|
|
|
|
return "Cette adresse est déjà associée à un compte.";
|
|
|
|
|
|
|
|
case 3:
|
|
|
|
|
|
|
|
return "Ce login est déjà associé à un compte.";
|
|
|
|
|
|
|
|
case 4:
|
|
|
|
|
|
|
|
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 authentification($db, $mail, $password){
|
|
|
|
|
|
|
|
$result = pg_query_params($db, "SELECT * FROM Utilisateur WHERE mail = $1;", array($mail));
|
|
|
|
|
|
|
|
if ($result){
|
|
|
|
|
|
|
|
$row = pg_fetch_array($result);
|
|
|
|
|
|
|
|
return (strcmp($row["passwd"], $password)) == 0;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function loginChange($user, $login){
|
|
|
|
function loginChange($user, $login){
|
|
|
|
return strcmp($user['login'], $login);
|
|
|
|
return strcmp($user['login'], $login);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -141,13 +179,23 @@ function getErrorProfil($code){
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function deluser($mail){
|
|
|
|
function deluser($delmail){
|
|
|
|
echo "c'est supprimé";
|
|
|
|
echo "c'est supprimé";
|
|
|
|
/*Update to userdel where mail
|
|
|
|
/*
|
|
|
|
Del mail de la table utilisateur
|
|
|
|
$requete = "UPDATE public.utilisateur SET (mail, passwd, prenom, nom, login, telephone, datenaissance, estadmin) = ('utilisateur_supprime@local', '', '', '', 'utilisateur_supprime', '', to_date('1970/01/01','YYYY/MM/DD'), false) WHERE mail = '".$delmail."';";
|
|
|
|
Delete from where
|
|
|
|
marche pas
|
|
|
|
|
|
|
|
ERROR: duplicate key value violates unique constraint "pk_utilisateur"
|
|
|
|
|
|
|
|
DETAIL: Key (mail)=(utilisateur_supprime@local) already exists.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
Delete l'utilisateur du reste de la base
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$requete = "DELETE FROM public.utilisateur WHERE mail = '".$delmail."';";
|
|
|
|
|
|
|
|
|
|
|
|
Supprimer l’avatar*/
|
|
|
|
pg_query($db, $requete);
|
|
|
|
|
|
|
|
supprimerAvatar($delmail);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
?>
|
|
|
|
?>
|
|
|
|