X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=modules%2Fadmin.php;h=c2eceb7655e7ec357eebf29fc7031c6d3f5e0468;hb=9797734d81089ee75f6fa3e855d48b9a9bc5523a;hp=74edd0e56f2f02ffe6b7ba1eecb001646133843c;hpb=b71f7275d0abe31614da74e05524ac08033bbe18;p=platal.git diff --git a/modules/admin.php b/modules/admin.php index 74edd0e..c2eceb7 100644 --- a/modules/admin.php +++ b/modules/admin.php @@ -1,6 +1,6 @@ assign('action', $action); if ($action == 'list') { - $sql = "SELECT w.ip, IF(w.ip = s.ip, s.host, s.forward_host), w.detection, w.state, a.alias AS forlife + $sql = "SELECT w.ip, IF(s.ip IS NULL, + IF(w.ip = s2.ip, s2.host, s2.forward_host), + IF(w.ip = s.ip, s.host, s.forward_host)), + w.detection, w.state, a.alias AS forlife FROM ip_watch AS w - LEFT JOIN logger.sessions AS s ON (s.ip = w.ip OR s.forward_ip = w.ip) - LEFT JOIN aliases AS a ON (a.id = s.uid AND a.type = 'a_vie') + LEFT JOIN logger.sessions AS s ON (s.ip = w.ip) + LEFT JOIN logger.sessions AS s2 ON (s2.forward_ip = w.ip) + LEFT JOIN aliases AS a ON (a.id = s.uid AND a.type = 'a_vie') GROUP BY w.ip, a.alias ORDER BY w.state, w.ip, a.alias"; $it = Xdb::iterRow($sql); @@ -1071,6 +1076,7 @@ class AdminModule extends PLModule $table = array(); $props = array(); while (list($ip, $host, $date, $state, $forlife) = $it->next()) { + $ip = uint_to_ip($ip); if (count($props) == 0 || $props['ip'] != $ip) { if (count($props) > 0) { $table[] = $props; @@ -1098,7 +1104,7 @@ class AdminModule extends PLModule WHERE w.ip = {?} GROUP BY a2.alias ORDER BY a2.alias"; - $it = Xdb::iterRow($sql, $ip); + $it = Xdb::iterRow($sql, ip_to_uint($ip)); $props = array(); while (list($detection, $state, $last, $description, $edit, $forlife, $host) = $it->next()) {