From 4c5f7a8287b6520bd21df21c2ffa2ebe4d42f6ce Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 18 Mar 2014 21:25:52 +0100 Subject: [PATCH] Modification arborescence --- ajax.php => include/ajax.php | 4 ++-- include/config.php | 7 +++++++ connexion_bdd.php.example => include/config.php.example | 0 include/connexion_bdd.php | 6 ++++++ index.php | 8 ++------ js/index.js | 6 +++--- 6 files changed, 20 insertions(+), 11 deletions(-) rename ajax.php => include/ajax.php (99%) create mode 100644 include/config.php rename connexion_bdd.php.example => include/config.php.example (100%) create mode 100644 include/connexion_bdd.php diff --git a/ajax.php b/include/ajax.php similarity index 99% rename from ajax.php rename to include/ajax.php index bef21b5..45839ba 100644 --- a/ajax.php +++ b/include/ajax.php @@ -4,7 +4,7 @@ if(!isset($_SESSION['admin_id'])) exit -1; - require('connexion_bdd.php'); + require(basename(__FILE__) . 'connexion_bdd.php'); function datetosql($date) { return implode('-', array_reverse(explode('/', $date))); @@ -178,4 +178,4 @@ $req->execute(array($_POST['del_admin_id'])); } -?> \ No newline at end of file +?> diff --git a/include/config.php b/include/config.php new file mode 100644 index 0000000..6e226a3 --- /dev/null +++ b/include/config.php @@ -0,0 +1,7 @@ + diff --git a/connexion_bdd.php.example b/include/config.php.example similarity index 100% rename from connexion_bdd.php.example rename to include/config.php.example diff --git a/include/connexion_bdd.php b/include/connexion_bdd.php new file mode 100644 index 0000000..b4f2895 --- /dev/null +++ b/include/connexion_bdd.php @@ -0,0 +1,6 @@ + diff --git a/index.php b/index.php index 204e90d..3d76111 100644 --- a/index.php +++ b/index.php @@ -8,18 +8,14 @@ // Tentative de connexion ? if(isset($_POST['id'], $_POST['pass'])){ - require('connexion_bdd.php'); + require('include/connexion_bdd.php'); $req = $bdd->prepare('SELECT * FROM admin WHERE admin_id = ? AND admin_pass = ?'); $req->execute(array($_POST['id'], sha1($_POST['pass']))); if($data = $req->fetch()){ $_SESSION['admin_id'] = $data['admin_id']; - unset($_POST['id'], $_POST['pass']); - $connexion = true; - } - else{ - $connexion = false; + header("Location: ."); } } ?> diff --git a/js/index.js b/js/index.js index c7b8fae..bc060ce 100644 --- a/js/index.js +++ b/js/index.js @@ -7,7 +7,7 @@ $(function () { // Selection des users $.ajax({ type: "POST", - url: "ajax.php", + url: "include/ajax.php", dataType: 'json', data: "select=user", success: function (json) { @@ -60,7 +60,7 @@ $(function () { $.ajax({ type: "POST", - url: "ajax.php", + url: "include/ajax.php", dataType: "json", data: {del_user_id: id}, error: function () { @@ -115,7 +115,7 @@ $(function () { // Suppression dans la bdd $.ajax({ type: "POST", - url: "ajax.php", + url: "include/ajax.php", dataType: "json", data: item, error: function () {