Browse Source

Corrections bugs dus à la nouvelle arborescence

feature/ldap
Chocobozzz 11 years ago
parent
commit
6751b6aaf2
  1. 2
      include/ajax.php
  2. 4
      include/config.php
  3. 6
      include/connexion_bdd.php
  4. 7
      index.php
  5. 12
      js/index.js

2
include/ajax.php

@ -4,7 +4,7 @@
if(!isset($_SESSION['admin_id'])) if(!isset($_SESSION['admin_id']))
exit -1; exit -1;
require(basename(__FILE__) . 'connexion_bdd.php'); require(dirname(__FILE__) . '/connexion_bdd.php');
function datetosql($date) { function datetosql($date) {
return implode('-', array_reverse(explode('/', $date))); return implode('-', array_reverse(explode('/', $date)));

4
include/config.php

@ -2,6 +2,6 @@
$hote='localhost'; $hote='localhost';
$port='3306'; $port='3306';
$bd='vpn'; $bd='vpn';
$utilisateur='user'; $utilisateur='florian';
$mdp="password"; $mdp="sysko&'";
?> ?>

6
include/connexion_bdd.php

@ -1,6 +1,6 @@
<?php <?php
require(basename(__FILE__) . "/config.php"); require(dirname(__FILE__) . "/config.php");
$pdo_options[PDO::ATTR_ERRMODE] = PDO::ERRMODE_EXCEPTION; $options[PDO::ATTR_ERRMODE] = PDO::ERRMODE_EXCEPTION;
$bdd = new PDO("mysql:host='.$hote.';port='.$port.';dbname='.$bd, $utilisateur, $mdp, $options); $bdd = new PDO("mysql:host=$hote;port=$port;dbname=$bd", $utilisateur, $mdp, $options);
?> ?>

7
index.php

@ -8,7 +8,7 @@
// Tentative de connexion ? // Tentative de connexion ?
if(isset($_POST['id'], $_POST['pass'])){ if(isset($_POST['id'], $_POST['pass'])){
require('include/connexion_bdd.php'); require(dirname(__FILE__) . '/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'])));
@ -17,6 +17,9 @@
$_SESSION['admin_id'] = $data['admin_id']; $_SESSION['admin_id'] = $data['admin_id'];
header("Location: ."); header("Location: .");
} }
else {
$connexion_erreur = true;
}
} }
?> ?>
@ -36,6 +39,8 @@
<?php <?php
// Si pas connecté on affiche le formulaire // Si pas connecté on affiche le formulaire
if(!isset($_SESSION['admin_id'])){ if(!isset($_SESSION['admin_id'])){
if($connexion_erreur)
echo "<strong style='color: red'>Erreur connexion</strong>";
?> ?>
<div id="bloc_connexion"> <div id="bloc_connexion">
<form id="form_connexion" method="POST"> <form id="form_connexion" method="POST">

12
js/index.js

@ -140,7 +140,7 @@ $(function () {
$.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 () {
@ -168,7 +168,7 @@ $(function () {
// Selection des admins // Selection des admins
$.ajax({ $.ajax({
type: "POST", type: "POST",
url: "ajax.php", url: "include/ajax.php",
dataType: 'json', dataType: 'json',
data: "select=admin", data: "select=admin",
success: function (json) { success: function (json) {
@ -212,7 +212,7 @@ $(function () {
var me = $(this), id = me.attr('id'), data = grid.getData(); var me = $(this), id = me.attr('id'), data = grid.getData();
$.ajax({ $.ajax({
type: "POST", type: "POST",
url: "ajax.php", url: "include/ajax.php",
dataType: "json", dataType: "json",
data: {del_admin_id: id}, data: {del_admin_id: id},
error: function () { error: function () {
@ -260,7 +260,7 @@ $(function () {
// Modification de la bdd // Modification de 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 () {
@ -285,7 +285,7 @@ $(function () {
// Maj de la bdd // Maj de 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 () {
@ -347,7 +347,7 @@ $(function () {
// Pagination // Pagination
pager = new Slick.Controls.EnhancementPager({ pager = new Slick.Controls.EnhancementPager({
container: $("#pagination"), container: $("#pagination"),
remoteUrl: "ajax.php", remoteUrl: "include/ajax.php",
params: {select: "log"}, params: {select: "log"},
datagrid: grid, datagrid: grid,
pagerType: "" pagerType: ""

Loading…
Cancel
Save