Modification arborescence

This commit is contained in:
Chocobozzz 2014-03-18 21:25:52 +01:00
parent 18550b42fe
commit 4c5f7a8287
6 changed files with 20 additions and 11 deletions

View File

@ -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
View File

@ -0,0 +1,7 @@
<?php
$hote='localhost';
$port='3306';
$bd='vpn';
$utilisateur='user';
$mdp="password";
?>

View 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);
?>

View File

@ -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: .");
}
}
?>

View File

@ -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 () {