From 011cb4541623b2a5f76924ac0d707985bfda1812 Mon Sep 17 00:00:00 2001 From: grouille Date: Tue, 14 Apr 2020 18:59:06 +0200 Subject: [PATCH] Ajout compte --- site/accesBase.php | 28 ++++++++++++++++++++++++---- site/formInscription.php | 21 +++++++++++++++++++++ site/header.php | 8 +++++++- site/inscription.php | 12 +++++++----- site/inscrire.php | 11 ++++++++--- 5 files changed, 67 insertions(+), 13 deletions(-) diff --git a/site/accesBase.php b/site/accesBase.php index e539293..a623db0 100644 --- a/site/accesBase.php +++ b/site/accesBase.php @@ -45,12 +45,12 @@ return pg_affected_rows($result); } - function inscription($id, $pwd, $nom, $prenom) + function inscription($id, $pwd, $nom, $prenom, $groupe) { $db = connexion(); $num = countMember() +1; $pwd_hache = password_hash($pwd, PASSWORD_DEFAULT); - $query = "INSERT INTO membres VALUES('$num', '$nom', '$prenom', '$pwd_hache', '$id')"; + $query = "INSERT INTO membres VALUES('$num', '$nom', '$prenom', '$pwd_hache', '$id', '$groupe')"; $result = pg_query($db, $query) or die("La requête a echoué : ".pg_last_error()); if (pg_affected_rows($result)!=0){ return True; @@ -59,6 +59,26 @@ return False; } } + + function getGroupe($id) + { + $db = connexion(); + $query = "SELECT groupe FROM membres identifiant = '$id'"; + $result = pg_query($db, $query) or die("La requête a echoué : ".pg_last_error()); + $tab = pg_fetch_assoc($result); + deconnexion($db); + return $tab['groupe']; + } + + functin getGroupes() + { + $db = connexion(); + $query = "SELECT * FROM groupes"; + $result = pg_query($db, $query) or die("La requête a echoué : ".pg_last_error()); + $tab = pg_fetch_all($result); + deconnexion($db); + return $tab; + } function getMembreByIdPwd($id, $pwd) { @@ -79,7 +99,7 @@ return $tab; } - function upload($index,$maxsize=FALSE,$extensions=FALSE) + /*function upload($index,$maxsize=FALSE,$extensions=FALSE) { //Test1: fichier correctement uploadé if (!isset($_FILES[$index]) OR $_FILES[$index]['error'] > 0) return FALSE; @@ -94,7 +114,7 @@ $fichier = $name.".".$extension_upload; //$fichier = basename($_FILES[$index]['name']); return move_uploaded_file($_FILES['fichier']['tmp_name'],$dossier.$fichier); - } + }*/ function load($tmp_name, $name) { diff --git a/site/formInscription.php b/site/formInscription.php index cc39ae0..b0568cd 100644 --- a/site/formInscription.php +++ b/site/formInscription.php @@ -1,3 +1,9 @@ +

@@ -16,6 +22,21 @@ + Groupe : + + + + + + Identifiant : diff --git a/site/header.php b/site/header.php index 0104a5a..5e60d75 100644 --- a/site/header.php +++ b/site/header.php @@ -12,10 +12,16 @@ ?> Raspberry Capteur - Envoyer un code + Upload Historique Graphiques Valeurs + Compte Deconnexion @@ -23,23 +25,23 @@ require("accesBase.php") ;
diff --git a/site/inscrire.php b/site/inscrire.php index aae74f3..1bae29a 100644 --- a/site/inscrire.php +++ b/site/inscrire.php @@ -7,7 +7,12 @@ - - + - \ No newline at end of file + -- libgit2 0.21.2