From 14cba978fed1c8558115892c5ddc5b775ffa950a Mon Sep 17 00:00:00 2001 From: nox Date: Mon, 4 Nov 2019 23:26:02 +0100 Subject: [PATCH] =?UTF-8?q?Ajout=20du=20popup=20de=20connexion=20et=20corr?= =?UTF-8?q?ection=20affichage=20des=20actions=20en=20fonction=20du=20conne?= =?UTF-8?q?ct=C3=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/ajax/connexion.php | 28 ++++++ public/ajax/readRecords.php | 86 +++++++++++-------- public/js/connex.js | 30 +++++++ public/js/script.js | 3 - src/Product/views/admin/products/index.twig | 18 ++-- src/Product/views/admin/recherches/index.twig | 19 ++-- views/layout.twig | 51 +++++++++-- 7 files changed, 165 insertions(+), 70 deletions(-) create mode 100644 public/ajax/connexion.php create mode 100644 public/js/connex.js diff --git a/public/ajax/connexion.php b/public/ajax/connexion.php new file mode 100644 index 0000000..00fd3f0 --- /dev/null +++ b/public/ajax/connexion.php @@ -0,0 +1,28 @@ +prepare($requete); + $query->execute($params); + $row = $query->fetch(PDO::FETCH_ASSOC); + if (password_verify($_POST['mdp'],$row['password'])) { + echo '{"valide":true,"username":"'.$row['username'].'"}'; + } else { + echo '{"valide":false}'; + } + } else { + $response['status'] = 200; + $response['message'] = "Invalid Request!"; + } +} catch (PDOException $e) { + echo "Erreur : " . $e->getMessage() . "
"; +} diff --git a/public/ajax/readRecords.php b/public/ajax/readRecords.php index f0f485f..e251f71 100644 --- a/public/ajax/readRecords.php +++ b/public/ajax/readRecords.php @@ -2,10 +2,11 @@ ini_set('display_errors', 0); include '../../config/conf.php'; $antenne_slug = $_GET['antenne_slug']; +$nom_connecte = $_GET['nom_connecte']; $bdd = new \PDO("mysql:host=$host;dbname=$database_name", $username, $password); - // Design initial table header + $data = ' @@ -14,9 +15,8 @@ $bdd = new \PDO("mysql:host=$host;dbname=$database_name", $username, $password); - - - '; + '; + $params["antenne_slug"] = $antenne_slug; $requete = "SELECT products.*, users.username @@ -27,9 +27,23 @@ $bdd = new \PDO("mysql:host=$host;dbname=$database_name", $username, $password); ON users.id = products.user_id WHERE antennes.slug = :antenne_slug"; $stmt = $bdd->prepare($requete); + $stmt2 = $bdd->prepare($requete); $stmt->execute($params); + $stmt2->execute($params); $count = $stmt->rowCount(); - + while ($row2 = $stmt2->fetch(PDO::FETCH_ASSOC)) { + if ($row2['username'] == $nom_connecte) { + $affich_actions = true; + } else { + $affich_actions = false; + } + } + if ($affich_actions) { + $data .= ''; + $data .= ''; + } else { + $data .= ''; + } if ($count > 0) { $number = 1; @@ -44,38 +58,42 @@ $bdd = new \PDO("mysql:host=$host;dbname=$database_name", $username, $password); $data .= ''; $data .= ''; $data .= ''; - $data .= '
No.Vendeur Clé publique QuantitéPrix en junesActions
Prix en junesActions
'.$row['quantite'].''.$row['prix'].''; - $data .= '

-
-
diff --git a/src/Product/views/admin/recherches/index.twig b/src/Product/views/admin/recherches/index.twig index 9deeed6..b8157a8 100644 --- a/src/Product/views/admin/recherches/index.twig +++ b/src/Product/views/admin/recherches/index.twig @@ -45,7 +45,7 @@ overflow: hidden; padding: 0 !important; border-radius: 50px; - height: 26px; + height: 28px; width: 215px; } .toggle_radio > * { @@ -71,7 +71,7 @@ width: 100px; height: 20px; position: absolute; - top: 3px; + top: 4px; border-radius: 50px; transition: all .4s ease; } @@ -107,19 +107,11 @@
- -
- {% if antenne_name == 'Paris' %} +
@@ -47,18 +49,26 @@ {{ "now"|date('d/m/y') }}
{% if current_user() %} - -     +
{% else %} -