fix UNION/ORDER BY sur requetes connexions

This commit is contained in:
jbousquie 2016-12-08 09:55:07 +01:00
parent 7ad45bdfc7
commit 6e5cf004e7

View File

@ -20,8 +20,8 @@ function RechercheConnexions(&$db) {
$date_debut = db_escape_string($db, $_POST["date_debut"]); $date_debut = db_escape_string($db, $_POST["date_debut"]);
$date_fin = db_escape_string($db, $_POST["date_fin"]); $date_fin = db_escape_string($db, $_POST["date_fin"]);
$req_connexions = "SELECT username AS 'Compte', hote AS 'Machine', debut_con AS 'Début connexion', fin_con AS 'Fin connexion', close AS 'fermée ?', ip AS 'Adresse IP', con_id AS 'Id connexion' FROM connexions"; $req_connexions = "SELECT username AS 'Compte', hote AS 'Machine', debut_con AS 'Début connexion', fin_con AS 'Fin connexion', close AS 'fermée ?', ip AS 'Adresse IP', con_id FROM connexions";
$req_total_connexions = "SELECT username AS 'Compte', hote AS 'Machine', debut_con AS 'Début connexion', fin_con AS 'Fin connexion', 1 AS 'fermée ?', ip AS 'Adresse IP', con_id AS 'Id connexion' FROM total_connexions"; $req_total_connexions = "SELECT username AS 'Compte', hote AS 'Machine', debut_con AS 'Début connexion', fin_con AS 'Fin connexion', 1 AS 'fermée ?', ip AS 'Adresse IP', con_id FROM total_connexions";
$where = " WHERE "; $where = " WHERE ";
$contrainte = false; $contrainte = false;
if ($salle != "") { if ($salle != "") {
@ -81,7 +81,7 @@ function RechercheConnexions(&$db) {
if (!$contrainte) { if (!$contrainte) {
return false; return false;
} }
$req = "($req_connexions $where) UNION ($req_total_connexions $where) ORDER BY 'Id connexion' DESC"; $req = "($req_connexions $where) UNION ($req_total_connexions $where) ORDER BY con_id DESC";
$res = db_query($db, $req); $res = db_query($db, $req);
return $res; return $res;