From c06fe37d69298a44f9abcfeb8e9fdcf1e9e9e328 Mon Sep 17 00:00:00 2001 From: nox Date: Tue, 19 Nov 2019 23:09:14 +0100 Subject: [PATCH] Corrections connexion user et affichage dans produits des boutons Actions - Renommage dossier ajax en models --- .gitignore | 1 + public/index.php | 4 ++-- public/js/connex.js | 5 ++-- public/js/script.js | 24 +++++++++---------- public/{ajax => models}/addRecord.php | 0 public/{ajax => models}/addRecord2.php | 0 public/{ajax => models}/connexion.php | 0 public/{ajax => models}/deleteProduits.php | 0 public/{ajax => models}/deleteRecherches.php | 0 public/{ajax => models}/getG1PubKey.php | 0 .../{ajax => models}/readProduitsDetails.php | 0 .../readRecherchesDetails.php | 0 public/{ajax => models}/readRecords.php | 5 ++-- public/{ajax => models}/readRecords2.php | 5 ++-- public/{ajax => models}/readRecords2_sav.php | 0 .../updateProduitsDetails.php | 0 .../updateRecherchesDetails.php | 0 public/{ajax => models}/upload.php | 0 src/Account/views/signup.twig | 2 +- src/Auth/Action/LoginAttemptAction.php | 5 +++- views/layout.twig | 2 +- 21 files changed, 29 insertions(+), 24 deletions(-) rename public/{ajax => models}/addRecord.php (100%) rename public/{ajax => models}/addRecord2.php (100%) rename public/{ajax => models}/connexion.php (100%) rename public/{ajax => models}/deleteProduits.php (100%) rename public/{ajax => models}/deleteRecherches.php (100%) rename public/{ajax => models}/getG1PubKey.php (100%) rename public/{ajax => models}/readProduitsDetails.php (100%) rename public/{ajax => models}/readRecherchesDetails.php (100%) rename public/{ajax => models}/readRecords.php (97%) rename public/{ajax => models}/readRecords2.php (96%) rename public/{ajax => models}/readRecords2_sav.php (100%) rename public/{ajax => models}/updateProduitsDetails.php (100%) rename public/{ajax => models}/updateRecherchesDetails.php (100%) rename public/{ajax => models}/upload.php (100%) diff --git a/.gitignore b/.gitignore index 422241c..39725e2 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ config/conf.php vendor composer.json composer.lock +/src/Framework/SwiftMailerFactory.php \ No newline at end of file diff --git a/public/index.php b/public/index.php index 933cb55..6f24e7e 100644 --- a/public/index.php +++ b/public/index.php @@ -24,8 +24,8 @@ require 'vendor/autoload.php'; $chemin = $_SERVER['DOCUMENT_ROOT']; $chemin_new = substr($chemin,0,-6); -$app = (new \Framework\App( $chemin_new .'/config/config.php')) -//$app = (new \Framework\App( '../config/config.php')) +$app = (new \Framework\App( $chemin_new .'config/config.php')) +//$app = (new \Framework\App( $chemin .'config/config.php')) ->addModule(AdminModule::class) ->addModule(ContactModule::class) ->addModule(ProductModule::class) diff --git a/public/js/connex.js b/public/js/connex.js index 85fca62..bd7bc43 100644 --- a/public/js/connex.js +++ b/public/js/connex.js @@ -1,6 +1,5 @@ -function connexion(nom_connecte, mdp) { - - $.post("/ajax/connexion.php", { +function connexion(nom_connecte, mdp, chemin) { + $.post('/models/connexion.php', { nom_connecte: nom_connecte, mdp: mdp }, function (data, status) { diff --git a/public/js/script.js b/public/js/script.js index fe77086..f344981 100644 --- a/public/js/script.js +++ b/public/js/script.js @@ -9,7 +9,7 @@ function addRecord(antenne_slug, antenne_id, nom_connecte, id_user) { var quantite = $("#quantite").val(); var prix = $("#prix").val(); // Add record - $.post("/ajax/addRecord.php", { + $.post("/models/addRecord.php", { produit: produit, image: nom_image, vendeur: vendeur, @@ -46,7 +46,7 @@ function addRecord2(antenne_slug, antenne_id, nom_connecte, id_user) { var quantite = $("#quantite").val(); var prix = $("#prix").val(); // Add record - $.post("/ajax/addRecord2.php", { + $.post("/models/addRecord2.php", { produit: produit, image: nom_image, acheteur: acheteur, @@ -75,7 +75,7 @@ function addRecord2(antenne_slug, antenne_id, nom_connecte, id_user) { // READ records function readRecords(antenne_slug, nom_connecte) { - $.get("/ajax/readRecords.php", { + $.get("/models/readRecords.php", { antenne_slug: antenne_slug, nom_connecte: nom_connecte }, function (data, status) { @@ -84,7 +84,7 @@ function readRecords(antenne_slug, nom_connecte) { } // READ records2 function readRecords2(antenne_slug, nom_connecte) { - $.get("/ajax/readRecords2.php", { + $.get("/models/readRecords2.php", { antenne_slug: antenne_slug, nom_connecte: nom_connecte }, function (data, status) { @@ -96,7 +96,7 @@ function DeleteProduits(id, antenne_slug, nom_image) { $("#hidden_antenne_slug").val(antenne_slug); var conf = confirm("Etes-vous sûr(e) de vouloir supprimer ce bien ou service ?"); if (conf == true) { - $.post("/ajax/deleteProduits.php", { + $.post("/models/deleteProduits.php", { id: id, antenne_slug: antenne_slug, nom_image: nom_image @@ -114,7 +114,7 @@ function DeleteRecherches(id, antenne_slug, nom_image) { $("#hidden_antenne_slug_r").val(antenne_slug); var conf = confirm("Etes-vous sûr(e) de vouloir supprimer ce bien ou service ?"); if (conf == true) { - $.post("/ajax/deleteRecherches.php", { + $.post("/models/deleteRecherches.php", { id_r: id, antenne_slug: antenne_slug, nom_image: nom_image @@ -132,7 +132,7 @@ function GetProduitsDetails(id, antenne_slug, nom_image) { $("#hidden_user_id").val(id); $("#hidden_antenne_slug").val(antenne_slug); $("#hidden_image_name").val(nom_image); - $.post("/ajax/readProduitsDetails.php", { + $.post("/models/readProduitsDetails.php", { id: id }, function (data, status) { @@ -153,7 +153,7 @@ function GetRecherchesDetails(id, antenne_slug, nom_image) { $("#hidden_user_id_r").val(id); $("#hidden_antenne_slug_r").val(antenne_slug); $("#hidden_image_name_r").val(nom_image); - $.post("/ajax/readRecherchesDetails.php", { + $.post("/models/readRecherchesDetails.php", { id_r: id }, function (data, status) { @@ -180,7 +180,7 @@ function UpdateProduitsDetails(nom_connecte) { // Champs cachés var id = $("#hidden_user_id").val(); var antenne_slug = $("#hidden_antenne_slug").val(); - $.post("/ajax/updateProduitsDetails.php", { + $.post("/models/updateProduitsDetails.php", { id: id, produit: produit, image: nom_image, @@ -208,7 +208,7 @@ function UpdateRecherchesDetails(nom_connecte) { var id = $("#hidden_user_id_r").val(); var antenne_slug = $("#hidden_antenne_slug_r").val(); // Update the details by requesting to the server using ajax - $.post("/ajax/updateRecherchesDetails.php", { + $.post("/models/updateRecherchesDetails.php", { id: id, produit: produit, image: nom_image, @@ -252,7 +252,7 @@ $(document).ready(function () { // requête AJAX pour copier la photo et l'afficher $.ajax({ - url: '/ajax/upload.php', + url: '/models/upload.php', type: 'post', data: fd_add, contentType: false, @@ -283,7 +283,7 @@ $(document).ready(function () { fd.append('source',source); // requête AJAX pour copier la photo et l'afficher $.ajax({ - url: '/ajax/upload.php', + url: '/models/upload.php', type: 'post', data: fd, contentType: false, diff --git a/public/ajax/addRecord.php b/public/models/addRecord.php similarity index 100% rename from public/ajax/addRecord.php rename to public/models/addRecord.php diff --git a/public/ajax/addRecord2.php b/public/models/addRecord2.php similarity index 100% rename from public/ajax/addRecord2.php rename to public/models/addRecord2.php diff --git a/public/ajax/connexion.php b/public/models/connexion.php similarity index 100% rename from public/ajax/connexion.php rename to public/models/connexion.php diff --git a/public/ajax/deleteProduits.php b/public/models/deleteProduits.php similarity index 100% rename from public/ajax/deleteProduits.php rename to public/models/deleteProduits.php diff --git a/public/ajax/deleteRecherches.php b/public/models/deleteRecherches.php similarity index 100% rename from public/ajax/deleteRecherches.php rename to public/models/deleteRecherches.php diff --git a/public/ajax/getG1PubKey.php b/public/models/getG1PubKey.php similarity index 100% rename from public/ajax/getG1PubKey.php rename to public/models/getG1PubKey.php diff --git a/public/ajax/readProduitsDetails.php b/public/models/readProduitsDetails.php similarity index 100% rename from public/ajax/readProduitsDetails.php rename to public/models/readProduitsDetails.php diff --git a/public/ajax/readRecherchesDetails.php b/public/models/readRecherchesDetails.php similarity index 100% rename from public/ajax/readRecherchesDetails.php rename to public/models/readRecherchesDetails.php diff --git a/public/ajax/readRecords.php b/public/models/readRecords.php similarity index 97% rename from public/ajax/readRecords.php rename to public/models/readRecords.php index 8077419..21d686b 100644 --- a/public/ajax/readRecords.php +++ b/public/models/readRecords.php @@ -1,8 +1,9 @@ '.$cle_pub_format.''; $data .= ''.$row['quantite'].''; $data .= ''.$prix.''; - if ($row['username'] == $_GET['nom_connecte'] ) { + if ($row['username'] == $nom_connecte ) { $data .= ''; $data .= ' + onclick="connexion(document.getElementById('pseudo').value,document.getElementById('mdp').value)">Valider