From a5a22a55ad02b08271395274e6618c3624718e34 Mon Sep 17 00:00:00 2001
From: Jeremy DUCOURTHIAL
Date: Fri, 2 Dec 2022 09:36:10 +0100
Subject: [PATCH] ajout validation + get admin
---
ControllerAdmin.php | 6 +++---
adminConnexion.php | 8 -------
gatewayAdmins.php | 11 ++++++++++
gatewayNews.php | 1 +
index.php | 1 +
vues/Validation.php | 48 +++++++++++++++++++++++++++++++++++++++++
vues/adminConnexion.php | 8 +++++++
7 files changed, 72 insertions(+), 11 deletions(-)
delete mode 100644 adminConnexion.php
create mode 100644 vues/Validation.php
create mode 100644 vues/adminConnexion.php
diff --git a/ControllerAdmin.php b/ControllerAdmin.php
index e25de16..0fe73e7 100644
--- a/ControllerAdmin.php
+++ b/ControllerAdmin.php
@@ -14,8 +14,8 @@ class controllerAdmin {
case "ajoutSource":
$this->ajoutSource($_REQUEST["linkSource"]);
break;
- case "suprimerSource":
- $this->suprimerSource($_REQUEST["idSource"]);
+ case "supprimerSource":
+ $this->supprimerSource($_REQUEST["idSource"]);
break;
case "setNbArticlesParPage":
$this->setNbArticlesParPage($_REQUEST["nbSourceParPage"]);
@@ -43,7 +43,7 @@ class controllerAdmin {
//require('menuAdmin.php');
}
- function suprimerSource($idSource) {
+ function supprimerSource($idSource) {
global $con;
$mdl = new GatewaySources($con);
$mdl->deleteSources($idSource);
diff --git a/adminConnexion.php b/adminConnexion.php
deleted file mode 100644
index d0a447e..0000000
--- a/adminConnexion.php
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/gatewayAdmins.php b/gatewayAdmins.php
index 1fdda53..132339b 100644
--- a/gatewayAdmins.php
+++ b/gatewayAdmins.php
@@ -18,6 +18,17 @@ class GatewayAdmin
);
}
+ public function getAdmin($username,$password)
+ {
+ $query = "SELECT * FROM admin WHERE username = '$username' AND password = '$password'";
+ $this->con->executeQuery($query, array());
+ $results=$this->con->getResults();
+ Foreach ($results as $admin){
+ $listeAdmin[] = new Admin($admin["username"],$admin["password"]);
+ }
+ return $listeAdmin;
+ }
+
}
?>
diff --git a/gatewayNews.php b/gatewayNews.php
index b11c7d5..1d1522a 100644
--- a/gatewayNews.php
+++ b/gatewayNews.php
@@ -1,5 +1,6 @@
val_form($_POST['name'],$_POST['password'],$error);
+ Foreach ($error as $key) {
+ print($key);
+ }
+?>
\ No newline at end of file
diff --git a/vues/adminConnexion.php b/vues/adminConnexion.php
new file mode 100644
index 0000000..9ec462c
--- /dev/null
+++ b/vues/adminConnexion.php
@@ -0,0 +1,8 @@
+
+
+
+
\ No newline at end of file