-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
+ Affichage des logs avec gestion d'un gros volume de donnée + Activation de menus
- Loading branch information
1 parent
24519d0
commit 8ee1d44
Showing
4 changed files
with
223 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,54 +1,54 @@ | ||
<?php | ||
|
||
/* | ||
La table LOGS Commprendra | ||
Un ID INT | ||
Un utilisateur VARCHAR 16 | ||
Une action INT | ||
Une date VARCHAR 10 | ||
Une heure VARCHAR 5 | ||
Une cible (ticket, utilisateur ou licence en question) VARCHAR 256 | ||
Liste des différentes actions possibles : | ||
# LES TICKETS | ||
- 1 : Créer un ticket | ||
- 2 : Afficher les détails d'un ticket | ||
- 3 : Prendre en charge un ticket | ||
- 4 : Archiver un ticket | ||
- 5 : Désarchiver un ticket | ||
# Paramettres | ||
- 6 : Créer un utilisateur | ||
- 7 : Supprimer un utilisateur | ||
- 8 : Changer le mdp d'un utilisateur | ||
- 9 : Enregistrer une licence | ||
Options à enregistrer : | ||
# LES TICKETS | ||
- 1 : Quel ticket | ||
- 2 : Quel ticket | ||
- 3 : Quel ticket | ||
- 4 : Quel ticket | ||
- 5 : Quel ticket | ||
# Paramettres | ||
- 6 : Quel utilisateur | ||
- 7 : Quel utilisateur | ||
- 8 : Quel utilisateur | ||
- 9 : Quelle licence | ||
*/ | ||
|
||
function SEND_LOGS($hotedeconnexion,$utilisateur,$motdepasse,$basededonnee,$action,$cible) | ||
{ | ||
// On récupére les variables | ||
$user = $_SESSION['utilisateur']; | ||
$date = strftime("%d/%m/%Y"); | ||
$heure = strftime("%H:%M:%S"); | ||
|
||
// Envoie à la DB | ||
$cnx = new PDO("mysql:host=$hotedeconnexion;dbname=$basededonnee", "$utilisateur", "$motdepasse"); | ||
$req = "INSERT INTO `logs` (`utilisateur`, `action`, `date`, `heure`, `cible`) VALUES ('$user', '$action', '$date', '$heure', '$cible');"; | ||
$cnx->query($req); | ||
return; | ||
} | ||
<?php | ||
|
||
/* | ||
La table LOGS Commprendra | ||
Un ID INT | ||
Un utilisateur VARCHAR 16 | ||
Une action INT | ||
Une date VARCHAR 10 | ||
Une heure VARCHAR 5 | ||
Une cible (ticket, utilisateur ou licence en question) VARCHAR 256 | ||
Liste des différentes actions possibles : | ||
# LES TICKETS | ||
- 1 : Créer un ticket --> INFO | ||
- 2 : Afficher les détails d'un ticket --> INFO | ||
- 3 : Prendre en charge un ticket --> INFO | ||
- 4 : Archiver un ticket --> INFO | ||
- 5 : Désarchiver un ticket --> INFO | ||
# Paramettres | ||
- 6 : Créer un utilisateur --> Warning | ||
- 7 : Supprimer un utilisateur --> Warning | ||
- 8 : Changer le mdp d'un utilisateur --> Warning | ||
- 9 : Enregistrer une licence --> INFO | ||
Options à enregistrer : | ||
# LES TICKETS | ||
- 1 : Quel ticket | ||
- 2 : Quel ticket | ||
- 3 : Quel ticket | ||
- 4 : Quel ticket | ||
- 5 : Quel ticket | ||
# Paramettres | ||
- 6 : Quel utilisateur | ||
- 7 : Quel utilisateur | ||
- 8 : Quel utilisateur | ||
- 9 : Quelle licence | ||
*/ | ||
|
||
function SEND_LOGS($hotedeconnexion,$utilisateur,$motdepasse,$basededonnee,$action,$cible) | ||
{ | ||
// On récupére les variables | ||
$user = $_SESSION['utilisateur']; | ||
$date = strftime("%d/%m/%Y"); | ||
$heure = strftime("%H:%M:%S"); | ||
|
||
// Envoie à la DB | ||
$cnx = new PDO("mysql:host=$hotedeconnexion;dbname=$basededonnee", "$utilisateur", "$motdepasse"); | ||
$req = "INSERT INTO `logs` (`utilisateur`, `action`, `date`, `heure`, `cible`) VALUES ('$user', '$action', '$date', '$heure', '$cible');"; | ||
$cnx->query($req); | ||
return; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,167 @@ | ||
<?php | ||
session_start(); | ||
|
||
if(!isset($_SESSION['utilisateur'])) { | ||
header('Location: ../connexion.php'); | ||
exit(); | ||
} | ||
include '../includes/verif_licence_enfants.php'; | ||
?> | ||
<!DOCTYPE html> | ||
<!-- | ||
Projet réalisé par Nem-developing, tout droits réservés. | ||
--> | ||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> | ||
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css" integrity="sha384-9aIt2nRpC12Uk9gS9baDl411NQApFmC26EwAOH8WgZl5MYYxFfc+NcPb1dKGj7Sk" crossorigin="anonymous"> | ||
<link href="../css/index.css" rel="stylesheet" type="text/css"/> | ||
<title>Fix - Logs</title> | ||
<link rel="shortcut icon" type="image/x-icon" href="../favicon.ico" /> | ||
</body> | ||
</head> | ||
<body> | ||
|
||
<?php | ||
|
||
include '../includes/menu-enfants.php'; | ||
|
||
?> | ||
|
||
|
||
<ul style="padding-bottom: 1px;" class="nav nav-tabs bg-dark text-white" > | ||
<li class="nav-item"> | ||
<a class="nav-link text-white" aria-current="page" href="parametres.php">À Propos</a> | ||
</li> | ||
<li class="nav-item"> | ||
<a class="nav-link text-white" href="#">Gestion des Utilisateurs</a> | ||
</li> | ||
<li class="nav-item"> | ||
<a class="nav-link active text-white bg-success" href="logs.php">Logs</a> | ||
</li> | ||
</ul> | ||
|
||
|
||
<!-- | ||
Liste des logs | ||
--> | ||
|
||
|
||
<?php | ||
|
||
if (!$_GET['offset']){ | ||
$offset = 0; | ||
} else { | ||
$offset = $_GET['offset']; | ||
} | ||
|
||
|
||
|
||
|
||
?> | ||
|
||
<div class="bg-dark"> | ||
<div class="table-responsive"> | ||
<table class="table table-dark"> | ||
<thead> | ||
<tr> | ||
<th scope="col">Journal</th> | ||
<th scope="col">Type</th> | ||
<th scope="col">Date</th> | ||
<th scope="col">Heure</th> | ||
<th scope="col">Utilisateur</th> | ||
<th scope="col">Action Réalisée</th> | ||
<th scope="col">Détail</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<?php | ||
include '../config/config.php'; // Import des informations de connexion à la base de données. | ||
$cnx = new PDO("mysql:host=$hotedeconnexion;dbname=$basededonnee", "$utilisateur", "$motdepasse"); | ||
|
||
$cpt =0; | ||
$req = "SELECT * FROM `logs` ORDER BY id DESC LIMIT 50 OFFSET $offset;"; | ||
$res = $cnx->query($req); | ||
while ($ligne = $res->fetch(PDO::FETCH_OBJ)) { | ||
|
||
|
||
switch ($ligne->action) { | ||
case 1: | ||
// Ticket créé | ||
$message1 = "<td><a class='text-success'>INFO</a></td>"; | ||
$message2 = "<td><a href = './ticket.php?id=$ligne->cible' class='text-success'>A créé un ticket</a></td><td><a href = './ticket.php?id=$ligne->cible' class='text-success'>Ticket N°$ligne->cible</a></td></tr>"; | ||
break; | ||
case 2: | ||
// Afficher les détails d'un ticket | ||
$message1 = "<td><a class='text-success'>INFO</a></td>"; | ||
$message2 = "<td><a href = './ticket.php?id=$ligne->cible' class='text-success'>A affiché les détails d'un ticket</a></td><td><a href = './ticket.php?id=$ligne->cible' class='text-success'>Ticket N°$ligne->cible</a></td></tr>"; | ||
break; | ||
case 3: | ||
// Prendre en charge un ticket | ||
$message1 = "<td><a class='text-success'>INFO</a></td>"; | ||
$message2 = "<td><a href = './ticket.php?id=$ligne->cible' class='text-success'>A pris en charge un ticket</a></td><td><a href = './ticket.php?id=$ligne->cible' class='text-success'>Ticket N°$ligne->cible</a></td></tr>"; | ||
break; | ||
case 4: | ||
// Archiver un ticket | ||
$message1 = "<td><a class='text-success'>INFO</a></td>"; | ||
$message2 = "<td><a href = './ticket.php?id=$ligne->cible' class='text-success'>A archivé un ticket</a></td><td><a href = './ticket.php?id=$ligne->cible' class='text-success'>Ticket N°$ligne->cible</a></td></tr>"; | ||
break; | ||
case 5: | ||
// Désarchiver un ticket | ||
$message1 = "<td><a class='text-success'>INFO</a></td>"; | ||
$message2 = "<td><a href = './ticket.php?id=$ligne->cible' class='text-success'>A désarchivé un ticket</a></td><td><a href = './ticket.php?id=$ligne->cible' class='text-success'>Ticket N°$ligne->cible</a></td></tr>"; | ||
break; | ||
case 6: | ||
// Créer un utilisateur | ||
$message1 = "<td><a class='text-warning'>Prudence</a></td>"; | ||
$message2 = "<td><a href = './gestion-utilisateurs.php' class='text-warning'>A créé un utilisateur</a></td><td><a href = './ticket.php?id=$ligne->cible' class='text-success'>Utilisateur : $ligne->cible</a></td></tr>"; | ||
|
||
break; | ||
case 7: | ||
// Supprimer un utilisateur | ||
$message1 = "<td><a class='text-warning'>Prudence</a></td>"; | ||
$message2 = "<td><a href = './gestion-utilisateurs.php' class='text-warning'>A supprimé un utilisateur</td><td><a href = './parametres.php' class='text-warning'>Utilisateur : $ligne->cible</a></td></tr>"; | ||
break; | ||
case 8: | ||
// Changer le mdp d'un utilisateur | ||
$message1 = "<td><a class='text-warning'>Prudence</a></td>"; | ||
$message2 = "<td><a href = './gestion-utilisateurs.php' class='text-warning'>A changé le mot de passe d'un utilisateur</a></td><td><a href = './parametres.php' class='text-warning'>Utilisateur : $ligne->cible</a></td></tr>"; | ||
|
||
break; | ||
case 9: | ||
// Enregistrer une licence | ||
$message1 = "<td><a class='text-success'>INFO</a></td>"; | ||
$message2 = "<td><a href = './parametres.php' class='text-success'>A enregistré une nouvelle licence</a></td><td><a href = './parametres.php' class='text-success'>Licence N°$ligne->cible</a></td></tr>"; | ||
break; | ||
} | ||
echo "<tr class='bg-white text-white'> | ||
<th scope='row'>N°$ligne->id</th> | ||
$message1 | ||
<td><a class='text-white-50'>$ligne->date</a></td> | ||
<td><a class='text-white-50'>$ligne->heure</a></td> | ||
<td><a class='text-white'>$ligne->utilisateur</a></td> | ||
$message2"; | ||
$cpt+=1; | ||
|
||
} | ||
|
||
|
||
|
||
|
||
echo " </tbody> | ||
</table> | ||
</div> | ||
</div>"; | ||
|
||
$offset += 50; | ||
if ($cpt === 50){ | ||
echo "<a href='?offset=$offset'><button type='button' class='btn btn-primary btn-lg btn-block'>Afficher les Journeaux plus anciens</button></a>"; | ||
} | ||
?> | ||
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script> | ||
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script> | ||
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.min.js" integrity="sha384-OgVRvuATP1z7JjHLkuOU7Xw704+h835Lr+6QL9UvYjZE3Ipu6Tp75j7Bh/kR0JKI" crossorigin="anonymous"></script> | ||
|
||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters