From 0577ebf3ae6f2b8b4b9a6474b19df524bafd627c Mon Sep 17 00:00:00 2001
From: ycharbi 
Date: Tue, 18 May 2021 22:59:52 +0200
Subject: [PATCH 1/7] =?UTF-8?q?Objet=20de=20connexion=20=C3=A0=20la=20base?=
 =?UTF-8?q?=20SQLite?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
 services/bdd/connexion.php | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
 create mode 100644 services/bdd/connexion.php
diff --git a/services/bdd/connexion.php b/services/bdd/connexion.php
new file mode 100644
index 0000000..7b3ab0a
--- /dev/null
+++ b/services/bdd/connexion.php
@@ -0,0 +1,16 @@
+setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
+}
+catch (Exception $e){
+	die ("Erreur de connexion à la base \"$base\" : ".$e->getMessage()) ;
+}
+
+?>
From d6f561ddc1eaf7caacc731c7134ed1371e36726f Mon Sep 17 00:00:00 2001
From: ycharbi 
Date: Tue, 18 May 2021 23:00:34 +0200
Subject: [PATCH 2/7] Pages d'authentification d'un utilisateur
---
 pages/formulaire_accueil.php               | 41 +++++++++++++++++++
 services/utilisateurs/authentification.php | 31 +++++++++++++++
 services/utilisateurs/deconnexion.php      | 14 +++++++
 services/utilisateurs/echec_auth.php       |  4 ++
 services/utilisateurs/identification.php   | 46 ++++++++++++++++++++++
 5 files changed, 136 insertions(+)
 create mode 100644 pages/formulaire_accueil.php
 create mode 100644 services/utilisateurs/authentification.php
 create mode 100644 services/utilisateurs/deconnexion.php
 create mode 100644 services/utilisateurs/echec_auth.php
 create mode 100644 services/utilisateurs/identification.php
diff --git a/pages/formulaire_accueil.php b/pages/formulaire_accueil.php
new file mode 100644
index 0000000..b2e155e
--- /dev/null
+++ b/pages/formulaire_accueil.php
@@ -0,0 +1,41 @@
+
+	
+			
+			
+		Identifiant ou mot de passe incorrecte.";
+					}
+					elseif ($_GET['erreur']==2) {
+				echo "
Vous avez oublié une valeur.
";
+					}
+					elseif ($_GET['erreur']==3) {
+				echo "
Acces non autorisé.
";
+					}
+					elseif ($_GET['succes']==1) {
+				echo "
Vous avez bien été déconnecté.
";
+					}
+			}
+			elseif (isset($_GET['succes']) && !empty($_GET['succes'])){
+					if ($_GET['succes']==1) {
+				echo "
Vous avez bien été déconnecté.
";
+					}
+			}
+		?>
+	
+
";
-	$db = new PDO("sqlite:/etc/postfix/postfix.sqlite"); 
-  $db -> setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
-
-  try {
-
-    $res = $db -> query('SELECT * FROM postfix_alias_vitruels;');
-
-
-	print '';
-    foreach ($res as $row) {
-
-      print '| ' . $row['courriel'] . ' | ' . $row['destination'] . ' | 
';
-
-    }
-    print '
';
-
-  }
-  catch(PDOException $e) {
-
-    print ("exception " . $e->getMessage());
-  
-  }
+header('Location: /pages/formulaire_accueil.php');
 ?>
From cad2b589107a65f11d2d789197bcb3a7d5c9a72d Mon Sep 17 00:00:00 2001
From: Nicolas MORIN 
Date: Wed, 19 May 2021 00:27:17 +0200
Subject: [PATCH 4/7] =?UTF-8?q?Mise=20a=20jour=20des=20donn=C3=A9es=20de?=
 =?UTF-8?q?=20tests?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
 outils/données.sql |  4 ++++
 outils/postfix.sql  | 10 ++++++++++
 2 files changed, 14 insertions(+)
diff --git a/outils/données.sql b/outils/données.sql
index 9b0a4a4..b0dfd37 100644
--- a/outils/données.sql
+++ b/outils/données.sql
@@ -22,3 +22,7 @@ INSERT INTO postfix_liste_noire_destinataires (courriel,action,active) VALUES ("
 INSERT INTO postfix_liste_noire_expediteurs (courriel,code_retour,message,active) VALUES ("tata@tutu.fr",554,"Parle à ma main, ma tête est malade.",0);
 INSERT INTO postfix_liste_noire_expediteurs (courriel,code_retour,message,active) VALUES ("bob@foo.com",554,"Parle à ma main, ma tête est malade.",1);
 INSERT INTO postfix_liste_noire_expediteurs (courriel,code_retour,message,active) VALUES ("roland@bar.org",554,"Parle à ma main, ma tête est malade.",1);
+
+-- Listes utilisateurs
+INSERT INTO postfix_utilisateurs (utilisateur,mot_de_passe,nom_complet,uid,gid,privilege,active) VALUES ("toto","toto","Alphonse Pastacaisse",5000,5000,"administrateur",1);
+INSERT INTO postfix_utilisateurs (utilisateur,mot_de_passe,nom_complet,uid,gid,privilege, active) VALUES ("tata", "tata", "Jonathan Quesquiestjaune", 5000, 5000, "utilisateur", 1);
diff --git a/outils/postfix.sql b/outils/postfix.sql
index 6972224..c5e317b 100644
--- a/outils/postfix.sql
+++ b/outils/postfix.sql
@@ -28,3 +28,13 @@ CREATE TABLE IF NOT EXISTS postfix_liste_noire_expediteurs (
        message TEXT NOT NULL,
        active INTEGER
 );
+CREATE TABLE IF NOT EXISTS postfix_utilisateurs (
+       id INTEGER PRIMARY KEY AUTOINCREMENT,
+       utilisateur TEXT NOT NULL UNIQUE,
+       mot_de_passe TEXT NOT NULL,
+       nom_complet TEXT,
+       uid INTEGER NOT NULL,
+       gid INTEGER NOT NULL,
+       privilege TEXT NOT NULL,
+       active INTEGER
+);
From 847a52b87e372d86bceca98719c1fd5fbb899c6a Mon Sep 17 00:00:00 2001
From: ycharbi 
Date: Wed, 19 May 2021 19:21:04 +0200
Subject: [PATCH 5/7] =?UTF-8?q?Ajout=20d'un=20=C3=A9cran=20d'=C3=A9chec=20?=
 =?UTF-8?q?d'authentification=20stylis=C3=A9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
 services/utilisateurs/echec_auth.php | 256 ++++++++++++++++++++++++++-
 1 file changed, 255 insertions(+), 1 deletion(-)
diff --git a/services/utilisateurs/echec_auth.php b/services/utilisateurs/echec_auth.php
index af08f3f..9c29f59 100644
--- a/services/utilisateurs/echec_auth.php
+++ b/services/utilisateurs/echec_auth.php
@@ -1,4 +1,258 @@
 
+
+
+
+	
+	    
+	    Courtail
+	    
+			
+	
+	
+		
+			
+		
+	
+
From 2e30703eaa999c3177bd6403622198283e002392 Mon Sep 17 00:00:00 2001
From: ycharbi 
Date: Thu, 20 May 2021 18:27:37 +0200
Subject: [PATCH 6/7] =?UTF-8?q?R=C3=A9solution=20probl=C3=A8me=20Atom?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
 inclusions/barre_menu.php                |  22 ++++++
 inclusions/entete.php                    |  10 +++
 inclusions/pied.php                      |   2 +
 outils/postfix.sqlite                    | Bin 0 -> 65536 bytes
 pages/formulaire_accueil.php             |  32 +++++----
 pages/gestion/administration.php         |  32 +++++++++
 pages/gestion/parametres.php             |  11 +++
 pages/testObjet.php                      |  84 +++++++++++++++++++++++
 services/gestion/alias.php               |  56 +++++++++++++++
 services/gestion/domaines.php            |  13 ++++
 services/gestion/listes_noires.php       |  13 ++++
 services/utilisateurs/identification.php |  15 ++--
 services/utilisateurs/privileges.php     |  19 +++++
 utilisateurs.sql                         |  24 +++++++
 14 files changed, 309 insertions(+), 24 deletions(-)
 create mode 100644 inclusions/barre_menu.php
 create mode 100644 inclusions/entete.php
 create mode 100644 inclusions/pied.php
 create mode 100644 outils/postfix.sqlite
 create mode 100644 pages/gestion/administration.php
 create mode 100644 pages/gestion/parametres.php
 create mode 100644 pages/testObjet.php
 create mode 100644 services/gestion/alias.php
 create mode 100644 services/gestion/domaines.php
 create mode 100644 services/gestion/listes_noires.php
 create mode 100644 services/utilisateurs/privileges.php
 create mode 100644 utilisateurs.sql
diff --git a/inclusions/barre_menu.php b/inclusions/barre_menu.php
new file mode 100644
index 0000000..7f9fcfd
--- /dev/null
+++ b/inclusions/barre_menu.php
@@ -0,0 +1,22 @@
+
+
+Bienvenue ".$_SESSION['nom_utilisateur'].". Vous êtes authentifié en tant qu'".$_SESSION['privilege_utilisateur'].".";
+			break;
+	}
+}
+
+?>
diff --git a/inclusions/entete.php b/inclusions/entete.php
new file mode 100644
index 0000000..ae628b8
--- /dev/null
+++ b/inclusions/entete.php
@@ -0,0 +1,10 @@
+
+
+
+    
+    Courtail - Portail des courriels
+    
+    
+    
+
+
diff --git a/inclusions/pied.php b/inclusions/pied.php
new file mode 100644
index 0000000..308b1d0
--- /dev/null
+++ b/inclusions/pied.php
@@ -0,0 +1,2 @@
+
+
diff --git a/outils/postfix.sqlite b/outils/postfix.sqlite
new file mode 100644
index 0000000000000000000000000000000000000000..c48e90f76e2891e1bf123594079f3492401383c4
GIT binary patch
literal 65536
zcmeI*O=#Oz00;0Vy~MJd#IJ2;v@B&6q#@1nF}jeIl#L}TrlihCn>w)24Nr-cRLr
zNiNx8hj=@5m%?DDjY7{mk6y;up)2fC)*U-2>#1y%(vC6K-S+epJ64dJG$etrzgow7
zANqK|r`pkbPp=m*Ojw?&FWOGg@bn>ah)5C{)pbJ1QT{r_U)4q7D^1k^f0ydk8?7EC
zgPAYd*fYWug(M%d?~`A*eVCkTU2Hp+__vj+%Zaa)pVS^jQLZ=I1>zw90SG_<0(&N~
z)}B-}O_M6ko-toAJ=67E@q?Y2NsndIdUovHiL@@F^b-ly%Io7(+4R};jDCJ*d~$4N
zPS2$0^s(9O^!OCtWHLRK?N6v>&nj51;hAMe&!*qY>QmGFH9Ik(&rXeBm`(F6Mcd2e
z&D^r#x@I^}qPLgDw6`^hSf#wV>aG;{H+9Y^d$tJY#L47Ninl|R_gfWhcv$-Ek|@Bk
z?RtyWYOd}C+^D#=Q1PO2@Y3qRvb{2|XRbSNxKy>0uV-vr{{HHLOLj50U>BEpy@-9)
z63TU_RF$nIE#8gSus9gtG5xb@-RBT?$uOtr|98+lCs`%F{0b9V$pPbtp?>?ai2?4Gc(?VX~g&RAb_6A2li3$cR)~36|?Zzmzh~F)cT;6<4?j8))J9*m)Y$`ue0f
z0k{6`=b9^Jv$SAt3O0qPHYJ`Y8AY?7Z`r#xDJfb{k5mcvS^a<(#|;JK(EdV6I}{hk
zc>cBb;@l&0Oq=Z49(V2QNSq1fze&aY-=^C5i?X|fJ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+k
MfE=fqD%t@418T2qEC2ui
literal 0
HcmV?d00001
diff --git a/pages/formulaire_accueil.php b/pages/formulaire_accueil.php
index b2e155e..8ab3956 100644
--- a/pages/formulaire_accueil.php
+++ b/pages/formulaire_accueil.php
@@ -16,26 +16,28 @@
 					
 				
 			
+
 		Identifiant ou mot de passe incorrecte.";
-					}
-					elseif ($_GET['erreur']==2) {
-				echo "Vous avez oublié une valeur.
";
-					}
-					elseif ($_GET['erreur']==3) {
-				echo "Acces non autorisé.
";
-					}
-					elseif ($_GET['succes']==1) {
-				echo "Vous avez bien été déconnecté.
";
-					}
+				switch ($_GET['erreur']) {
+					case 1:
+						echo "Identifiant ou mot de passe incorrecte.
";
+						break;
+					case 2:
+						echo "Vous n'avez pas les privilèges nécessaires.
";
+						break;
+				}
 			}
 			elseif (isset($_GET['succes']) && !empty($_GET['succes'])){
-					if ($_GET['succes']==1) {
-				echo "Vous avez bien été déconnecté.
";
-					}
+				switch ($_GET['succes']) {
+					case 1:
+						echo "Vous avez bien été déconnecté.
";
+						break;
+				}
 			}
+
 		?>
+
 	
 
diff --git a/pages/gestion/administration.php b/pages/gestion/administration.php
new file mode 100644
index 0000000..e28c351
--- /dev/null
+++ b/pages/gestion/administration.php
@@ -0,0 +1,32 @@
+";
+var_dump($_SESSION);
+echo "";
+
+if (isset($_GET['page']) && !empty($_GET['page'])) {
+	switch ($_GET['page']) {
+		case 'alias':
+			require_once($_SERVER["DOCUMENT_ROOT"]."/services/gestion/alias.php");
+			break;
+		case 'domaines':
+			require_once($_SERVER["DOCUMENT_ROOT"]."/services/gestion/domaines.php");
+			break;
+		case 'listes_noires':
+			require_once($_SERVER["DOCUMENT_ROOT"]."/services/gestion/listes_noires.php");
+			break;
+	}
+}
+
+require_once($_SERVER["DOCUMENT_ROOT"]."/inclusions/pied.php");
+
+?>
diff --git a/pages/gestion/parametres.php b/pages/gestion/parametres.php
new file mode 100644
index 0000000..74bb588
--- /dev/null
+++ b/pages/gestion/parametres.php
@@ -0,0 +1,11 @@
+
+
+
+
+
+
diff --git a/pages/testObjet.php b/pages/testObjet.php
new file mode 100644
index 0000000..2f59679
--- /dev/null
+++ b/pages/testObjet.php
@@ -0,0 +1,84 @@
+do_foo();
+$bar->yohan();
+
+# classe
+class Voiture
+{
+		/**
+		* Déclaration des attributs
+		*/
+		# attributs
+		private $niveau_carburant;
+		private $nombre_portes;
+		private $nombre_roues;
+
+		/**
+		* Cette méthode un peu spéciale est le constructeur, elle est exécutée lorsque vous "créez" votre objet. Elle doit initialiser les attributs de la classe.
+		*/
+		# méthode constructeur
+		public function __construct()
+		{
+		     $this->niveau_carburant = 50;
+		     $this-> = 3;
+		     $this->nombre_roues = 4;
+		}
+
+		/**
+		* Première méthode accessible par tous et modifiant le niveau de carburant
+		*/
+		# méthode
+		public function modifier_carburant(int $niveau)
+		{
+		     $this->niveau_carburant = $niveau;
+		}
+
+		/**
+		* Seconde méthode accessible à tous et modifiant le nombre de portes
+		*/
+		# méthode
+		public function modifier_nb_portes(int $nb_portes)
+		{
+		     $this->nombre_portes = $nb_portes;
+		}
+}
+
+$voiture = new Voiture;
+echo "";
+var_dump($voiture);
+echo "
";
+
+$voiture->modifier_nb_portes(4);
+
+echo "";
+var_dump($voiture);
+echo "
";
+
+echo $voiture['nombre_portes'];
+
+?>
+# https://www.vulgarisation-informatique.com/php-poo.php
diff --git a/services/gestion/alias.php b/services/gestion/alias.php
new file mode 100644
index 0000000..2a871c1
--- /dev/null
+++ b/services/gestion/alias.php
@@ -0,0 +1,56 @@
+
diff --git a/services/gestion/domaines.php b/services/gestion/domaines.php
new file mode 100644
index 0000000..3340a62
--- /dev/null
+++ b/services/gestion/domaines.php
@@ -0,0 +1,13 @@
+
+
+
+
+
+
diff --git a/services/gestion/listes_noires.php b/services/gestion/listes_noires.php
new file mode 100644
index 0000000..3340a62
--- /dev/null
+++ b/services/gestion/listes_noires.php
@@ -0,0 +1,13 @@
+
+
+
+
+
+
diff --git a/services/utilisateurs/identification.php b/services/utilisateurs/identification.php
index 4f22e3a..9531d99 100644
--- a/services/utilisateurs/identification.php
+++ b/services/utilisateurs/identification.php
@@ -1,4 +1,5 @@
 Déconnexion";
-
-		if (isset($_SESSION['identifiant_utilisateur']) && !empty($_SESSION['identifiant_utilisateur']) && $_SESSION['privilege_utilisateur']=="administrateur"){
-			//header ("location: /pages/form_c2r.php");
-			echo "Administrateur";
+		if (isset($_SESSION['identifiant_utilisateur']) && !empty($_SESSION['identifiant_utilisateur']) && $_SESSION['privilege_utilisateur']=="administrateur") {
+			header ("location: /pages/gestion/administration.php?message=bienvenue&page=alias");
 			die();
 		}
-		elseif (isset($_SESSION['identifiant_utilisateur']) && !empty($_SESSION['identifiant_utilisateur']) && $_SESSION['privilege_utilisateur']=="utilisateur"){
-			//header ("location: /pages/mon_compte/gestion.php");
-			echo "Utilisateur";
+		elseif (isset($_SESSION['identifiant_utilisateur']) && !empty($_SESSION['identifiant_utilisateur']) && $_SESSION['privilege_utilisateur']=="utilisateur") {
+			header ("location: /pages/gestion/administration.php?message=bienvenue&page=alias");
 			die();
 		}
 		else {
diff --git a/services/utilisateurs/privileges.php b/services/utilisateurs/privileges.php
new file mode 100644
index 0000000..e37022d
--- /dev/null
+++ b/services/utilisateurs/privileges.php
@@ -0,0 +1,19 @@
+
diff --git a/utilisateurs.sql b/utilisateurs.sql
new file mode 100644
index 0000000..9ecae50
--- /dev/null
+++ b/utilisateurs.sql
@@ -0,0 +1,24 @@
+sqlite3 /etc/postfix/postfix.sqlite
+
+CREATE TABLE IF NOT EXISTS postfix_utilisateurs (
+       id INTEGER PRIMARY KEY AUTOINCREMENT,
+       utilisateur TEXT NOT NULL UNIQUE,
+       mot_de_passe TEXT NOT NULL,
+       nom_complet TEXT,
+       uid INTEGER NOT NULL,
+       gid INTEGER NOT NULL,
+       privilege TEXT NOT NULL,
+       active INTEGER
+);
+
+INSERT INTO postfix_utilisateurs (utilisateur,mot_de_passe,nom_complet,uid,gid,privilege,active) VALUES ("toto","toto","Yohan Charbi",5000,5000,"administrateur",1);
+
+INSERT INTO postfix_utilisateurs (utilisateur,mot_de_passe,nom_complet,uid,gid,privilege, active) VALUES ("tata", "tata", "Nicolos Morin", 5000, 5000, "utilisateur", 1);
+
+UPDATE postfix_utilisateurs SET nom_complet="Nicolas Morin" WHERE id=2;
+
+CREATE TABLE IF NOT EXISTS tests (
+	id INTEGER PRIMARY KEY AUTOINCREMENT,
+	utilisateur TEXT NOT NULL UNIQUE,
+	mot_de_passe TEXT NOT NULL
+);
From ffb41d66159160b23c8fdaff68b27711eeba3dda Mon Sep 17 00:00:00 2001
From: ycharbi 
Date: Thu, 20 May 2021 18:35:21 +0200
Subject: [PATCH 7/7] Activation de l'authentification
---
 pages/gestion/administration.php | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/pages/gestion/administration.php b/pages/gestion/administration.php
index e28c351..bb830e1 100644
--- a/pages/gestion/administration.php
+++ b/pages/gestion/administration.php
@@ -3,8 +3,8 @@
 /**
  * Page centrale de gestion des fonctionnalités du serveur de courriel.
  */
-//session_start();
-//require_once($_SERVER["DOCUMENT_ROOT"]."/inclusions/entete.php");
+session_start();
+require_once($_SERVER["DOCUMENT_ROOT"]."/inclusions/entete.php");
 require_once($_SERVER["DOCUMENT_ROOT"]."/inclusions/barre_menu.php");
 require_once($_SERVER["DOCUMENT_ROOT"]."/services/utilisateurs/privileges.php");
 testPrivileges();