Modification arborescence
This commit is contained in:
parent
18550b42fe
commit
4c5f7a8287
@ -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']));
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
7
include/config.php
Normal file
7
include/config.php
Normal file
@ -0,0 +1,7 @@
|
||||
<?php
|
||||
$hote='localhost';
|
||||
$port='3306';
|
||||
$bd='vpn';
|
||||
$utilisateur='user';
|
||||
$mdp="password";
|
||||
?>
|
6
include/connexion_bdd.php
Normal file
6
include/connexion_bdd.php
Normal file
@ -0,0 +1,6 @@
|
||||
<?php
|
||||
require(basename(__FILE__) . "/config.php");
|
||||
|
||||
$pdo_options[PDO::ATTR_ERRMODE] = PDO::ERRMODE_EXCEPTION;
|
||||
$bdd = new PDO("mysql:host='.$hote.';port='.$port.';dbname='.$bd, $utilisateur, $mdp, $options);
|
||||
?>
|
@ -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: .");
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@ -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 () {
|
||||
|
Loading…
Reference in New Issue
Block a user