Modification arborescence
This commit is contained in:
parent
18550b42fe
commit
4c5f7a8287
@ -4,7 +4,7 @@
|
|||||||
if(!isset($_SESSION['admin_id']))
|
if(!isset($_SESSION['admin_id']))
|
||||||
exit -1;
|
exit -1;
|
||||||
|
|
||||||
require('connexion_bdd.php');
|
require(basename(__FILE__) . 'connexion_bdd.php');
|
||||||
|
|
||||||
function datetosql($date) {
|
function datetosql($date) {
|
||||||
return implode('-', array_reverse(explode('/', $date)));
|
return implode('-', array_reverse(explode('/', $date)));
|
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 ?
|
// Tentative de connexion ?
|
||||||
if(isset($_POST['id'], $_POST['pass'])){
|
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 = $bdd->prepare('SELECT * FROM admin WHERE admin_id = ? AND admin_pass = ?');
|
||||||
$req->execute(array($_POST['id'], sha1($_POST['pass'])));
|
$req->execute(array($_POST['id'], sha1($_POST['pass'])));
|
||||||
|
|
||||||
if($data = $req->fetch()){
|
if($data = $req->fetch()){
|
||||||
$_SESSION['admin_id'] = $data['admin_id'];
|
$_SESSION['admin_id'] = $data['admin_id'];
|
||||||
unset($_POST['id'], $_POST['pass']);
|
header("Location: .");
|
||||||
$connexion = true;
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
$connexion = false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
@ -7,7 +7,7 @@ $(function () {
|
|||||||
// Selection des users
|
// Selection des users
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "POST",
|
type: "POST",
|
||||||
url: "ajax.php",
|
url: "include/ajax.php",
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
data: "select=user",
|
data: "select=user",
|
||||||
success: function (json) {
|
success: function (json) {
|
||||||
@ -60,7 +60,7 @@ $(function () {
|
|||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "POST",
|
type: "POST",
|
||||||
url: "ajax.php",
|
url: "include/ajax.php",
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
data: {del_user_id: id},
|
data: {del_user_id: id},
|
||||||
error: function () {
|
error: function () {
|
||||||
@ -115,7 +115,7 @@ $(function () {
|
|||||||
// Suppression dans la bdd
|
// Suppression dans la bdd
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "POST",
|
type: "POST",
|
||||||
url: "ajax.php",
|
url: "include/ajax.php",
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
data: item,
|
data: item,
|
||||||
error: function () {
|
error: function () {
|
||||||
|
Loading…
Reference in New Issue
Block a user