diff --git a/admin/connexions.php b/admin/connexions.php
index a4c98bb..37e801b 100644
--- a/admin/connexions.php
+++ b/admin/connexions.php
@@ -244,7 +244,7 @@ function Connexions_wifi() {
$db = db_connect();
$req_close = "UPDATE wifi SET close = 1 WHERE DATE(wifi_deb_conn) < CURDATE()";
- $req = "SELECT wifi_id, wifi_username, wifi_ip, wifi_browser, wifi_deb_conn, prenom, nom, groupe FROM wifi, comptes WHERE close = 0 AND username = wifi_username ORDER BY wifi_deb_conn DESC";
+ $req = "SELECT wifi_id, wifi_username, wifi_ip, wifi_browser, wifi_deb_conn, prenom, nom, groupe FROM wifi LEFT JOIN comptes ON wifi_username = username WHERE close = 0 ORDER BY wifi_deb_conn DESC";
db_query($db, $req_close);
$res = db_query($db, $req);
@@ -302,8 +302,11 @@ function Connexions_blacklist_live($delay, &$machines) {
// Ferme les connexions encore ouvertes des jours antérieurs au jour courant dans la table connexions
// Copie toutes les connexions fermées des jours antérieurs dans la table total_connexions
// Purge les connexions copiées de la table connexions
+// Idem pour les connexions Wifi avec les tables wifi et total_wifi
// Retourne le nombre de connexions archivées
function ArchiveConnexions() {
+ $nb_archivables = 0;
+ $nb_archivables_wifi = 0;
$db = db_connect();
$req_marque_archivables = 'UPDATE connexions SET close = 1, archivable = 1 where DATE(fin_con) < CURDATE()';
@@ -313,11 +316,22 @@ function ArchiveConnexions() {
if ($nb_archivables != 0) {
$req_archive = 'INSERT INTO total_connexions SELECT con_id, username, hote, ip, fin_con, debut_con FROM connexions WHERE archivable = 1';
$req_purge_archivees = 'DELETE FROM connexions WHERE archivable = 1';
- db_query($db, $req_marque_archivables);
db_query($db, $req_archive);
db_query($db, $req_purge_archivees);
}
- return $nb_archivables;
+
+ $req_marque_archivables_wifi = 'UPDATE wifi SET close = 1, archivable = 1 where DATE(wifi_deb_conn) < CURDATE()';
+ $res_wifi = db_query($db, $req_marque_archivables_wifi);
+ $nb_archivables_wifi = db_affected_rows($db);
+
+ if ($nb_archivables_wifi != 0) {
+ $req_archive_wifi = 'INSERT INTO total_wifi SELECT wifi_id, wifi_username, wifi_ip, wifi_browser, wifi_deb_conn FROM wifi WHERE archivable = 1';
+ $req_purge_archivees_wifi = 'DELETE FROM wifi WHERE archivable = 1';
+ db_query($db, $req_archive_wifi);
+ db_query($db, $req_purge_archivees_wifi);
+ }
+
+ return $nb_archivables + $nb_archivables_wifi;
}
// Fonction PingTimestamp() :
diff --git a/admin/recherche.php b/admin/recherche.php
index 98ca8bd..71607bc 100644
--- a/admin/recherche.php
+++ b/admin/recherche.php
@@ -265,35 +265,43 @@ function RechercheWifi(&$db) {
$contrainte = false;
$req_wifi = "SELECT wifi_username AS 'Compte', nom AS 'Nom', prenom AS 'Prénom', groupe AS 'Groupe', wifi_ip AS 'Adresse IP', wifi_browser AS 'Browser/Device', wifi_deb_conn AS 'Heure connexion', close AS 'Fermée ?'";
- $req_wifi = $req_wifi." FROM wifi, comptes WHERE wifi_username = username ";
- $where = "";
+ $req_wifi = $req_wifi." FROM wifi LEFT OUTER JOIN comptes ON wifi.wifi_username = comptes.username ";
+ $req_total_wifi = "SELECT wifi_username AS 'Compte', nom AS 'Nom', prenom AS 'Prénom', groupe AS 'Groupe', wifi_ip AS 'Adresse IP', wifi_browser AS 'Browser/Device', wifi_deb_conn AS 'Heure connexion', 1 AS 'Fermée ?'";
+ $req_total_wifi = $req_total_wifi." FROM total_wifi LEFT OUTER JOIN comptes ON total_wifi.wifi_username = comptes.username ";
+ $where = " WHERE ";
+ $contrainte = false;
if ($compte != "") {
- $where = $where . " AND wifi_username LIKE \"$compte\" ";
+ $where = $where . " wifi_username LIKE \"$compte\" ";
$liste_const = $liste_const. "compte = $compte
";
$contrainte = true;
}
if ($nom != "") {
- $where = $where ." AND nom LIKE \"{$nom}\"";
+ $and = ($contrainte) ? " AND " : "";
+ $where = $where . $and ."nom LIKE \"{$nom}\"";
$liste_const = $liste_const. "nom = $nom
";
$contrainte = true;
}
if ($prenom != "") {
- $where = $where . " AND prenom LIKE \"{$prenom}\"";
+ $and = ($contrainte) ? " AND " : "";
+ $where = $where . $and . "prenom LIKE \"{$prenom}\"";
$liste_const = $liste_const. "prénom = $prenom
";
$contrainte = true;
}
if ($groupe != "") {
- $where = $where . " AND groupe LIKE \"{$groupe}\"";
+ $and = ($contrainte) ? " AND " : "";
+ $where = $where . "groupe LIKE \"{$groupe}\"";
$liste_const = $liste_const. "groupe = $groupe
";
$contrainte = true;
}
if ($ip != "") {
- $where = $where ." AND wifi_ip LIKE \"{$ip}\"";
+ $and = ($contrainte) ? " AND " : "";
+ $where = $where . $and . "wifi_ip LIKE \"{$ip}\"";
$liste_const = $liste_const. "adresse IP = $ip
";
$contrainte = true;
}
if ($browser != "") {
- $where = $where . "AND wifi_browser LIKE \"{$browser}\"";
+ $and = ($contrainte) ? " AND " : "";
+ $where = $where . $and . "wifi_browser LIKE \"{$browser}\"";
$liste_const = $liste_const. "browser/device = $browser
";
$contrainte = true;
}
@@ -306,7 +314,8 @@ function RechercheWifi(&$db) {
$isodate_f = sprintf( "%04d-%02d-%02d", (int)trim($tab_fin[2]), (int)trim($tab_fin[1]), (int)trim($tab_fin[0]) );
$date_debut_00 = "$isodate_d 00:00:00";
$date_fin_24 = "$isodate_f 23:59:59";
- $where = $where . " AND wifi_deb_conn >= \"{$date_debut_00}\" AND wifi_deb_conn <= \"{$date_fin_24}\"";
+ $and = ($contrainte) ? " AND " : "";
+ $where = $where . $and . "wifi_deb_conn >= \"{$date_debut_00}\" AND wifi_deb_conn <= \"{$date_fin_24}\"";
$liste_const = $liste_const. "du $date_debut au $date_fin
";
$contrainte = true;
}
@@ -318,7 +327,8 @@ function RechercheWifi(&$db) {
$isodate_d = sprintf( "%04d-%02d-%02d", (int)trim($tab_deb[2]), (int)trim($tab_deb[1]), (int)trim($tab_deb[0]) );
$date_debut_00 = "$isodate_d 00:00:00";
$date_debut_24 = "$isodate_d 23:59:59";
- $where = $where . " AND wifi_deb_conn >= \"{$date_debut_00}\" AND wifi_deb_conn <= \"{$date_debut_24}\"";
+ $and = ($contrainte) ? " AND " : "";
+ $where = $where . $and . "wifi_deb_conn >= \"{$date_debut_00}\" AND wifi_deb_conn <= \"{$date_debut_24}\"";
$liste_const = $liste_const. "date : $date_debut
";
$contrainte = true;
}
@@ -326,11 +336,9 @@ function RechercheWifi(&$db) {
if (!$contrainte) {
return false;
}
- $req = "$req_wifi $where ORDER BY wifi_deb_conn DESC";
+ $req = "($req_wifi $where) UNION ($req_total_wifi $where) ORDER BY'Heure connexion' DESC";
$res = db_query($db, $req);
-
return $res;
-
}
// fonction AfficheResultats($tab) : formatte l'affichage d'un jeu de résultats
diff --git a/admin/salles/A102.php b/admin/salles/A102.php
index 975790a..9587af9 100644
--- a/admin/salles/A102.php
+++ b/admin/salles/A102.php
@@ -60,7 +60,7 @@ $police["A102"] = 11;
$orientation["A102"][0]="V";
$ligne_coord["A102"][0] = array(100, 100);
-$ligne_machines["A102"][0] = array('A102Z1','A102A1');
+$ligne_machines["A102"][0] = array('A102Z1','A102A1','A102A2','A102A3');
$shift["A102"][0] = 10;
$orientation["A102"][1]="V";
diff --git a/admin/winlog_admin_conf.php.example b/admin/winlog_admin_conf.php.example
index d9c08d2..ea50d57 100644
--- a/admin/winlog_admin_conf.php.example
+++ b/admin/winlog_admin_conf.php.example
@@ -1,6 +1,6 @@
\ No newline at end of file