Просмотр исходного кода

use only switches and routers in unknown log mac page for search

Dmitriev Roman 3 лет назад
Родитель
Сommit
4aad24ab34
2 измененных файлов с 15 добавлено и 3 удалено
  1. 3 3
      html/admin/logs/unknown.php
  2. 12 0
      html/inc/common.php

+ 3 - 3
html/admin/logs/unknown.php

@@ -19,7 +19,7 @@ if ($f_id > 0) { $where_dev = " and D.id=$f_id "; }
 <div id="cont">
 <br>
 	<form action="<?=$_SERVER['PHP_SELF']?>" method="post">
-  Отчёт по свичу&nbsp<?php print_device_select($db_link, "device_show", $f_id); ?>
+  Отчёт по свичу&nbsp<?php print_netdevice_select($db_link, "device_show", $f_id); ?>
   Начало:&nbsp<input type="date" name="date_start" value="<?php echo $date1; ?>" />
   Конец:&nbsp<input type="date" name="date_stop" value="<?php echo $date2; ?>" />
   Отображать:<?php print_row_at_pages('rows',$displayed); ?>
@@ -27,7 +27,7 @@ if ($f_id > 0) { $where_dev = " and D.id=$f_id "; }
 </form>
 
 <?php
-$countSQL="SELECT Count(*) FROM Unknown_mac AS U, devices AS D, device_ports AS DP  WHERE U.device_id = D.id  AND U.port_id = DP.id AND U.timestamp>='$date1' AND U.timestamp<'$date2' $where_dev";
+$countSQL="SELECT Count(*) FROM Unknown_mac AS U, devices AS D, device_ports AS DP  WHERE D.device_type<=2 and U.device_id = D.id  AND U.port_id = DP.id AND U.timestamp>='$date1' AND U.timestamp<'$date2' $where_dev";
 $res = mysqli_query($db_link, $countSQL);
 $count_records = mysqli_fetch_array($res);
 $total=ceil($count_records[0]/$displayed);
@@ -46,7 +46,7 @@ print_navigation($page_url,$page,$displayed,$count_records[0],$total);
 </tr>
 <?php
 
-$sSQL = "SELECT U.mac, U.timestamp, DP.port, D.device_name FROM Unknown_mac AS U, devices AS D, device_ports AS DP  WHERE U.device_id = D.id  AND U.port_id = DP.id AND U.timestamp>='$date1' AND U.timestamp<'$date2' $where_dev ORDER BY U.mac LIMIT $start,$displayed";
+$sSQL = "SELECT U.mac, U.timestamp, DP.port, D.device_name FROM Unknown_mac AS U, devices AS D, device_ports AS DP  WHERE D.device_type<=2 and U.device_id = D.id  AND U.port_id = DP.id AND U.timestamp>='$date1' AND U.timestamp<'$date2' $where_dev ORDER BY U.mac LIMIT $start,$displayed";
 $maclog = get_records_sql($db_link, $sSQL);
 foreach ($maclog as $row) {
     print "<tr align=center align=center class=\"tr1\" onmouseover=\"className='tr2'\" onmouseout=\"className='tr1'\">\n";

+ 12 - 0
html/inc/common.php

@@ -998,6 +998,18 @@ function print_device_select($db, $field_name, $device_id)
     print "</select>\n";
 }
 
+function print_netdevice_select($db, $field_name, $device_id)
+{
+    print "<select name=\"$field_name\" class=\"js-select-single\" >\n";
+    $d_sql = "SELECT D.device_name, D.id FROM devices AS D Where D.deleted=0 and D.device_type<=2 order by D.device_name ASC";
+    $t_device = mysqli_query($db, $d_sql);
+    print_select_item('Все',0,$device_id);
+    while (list ($f_name, $f_device_id) = mysqli_fetch_array($t_device)) {
+	print_select_item($f_name,$f_device_id,$device_id);
+    }
+    print "</select>\n";
+}
+
 function print_vlan_select($db, $field_name, $vlan)
 {
     print "<select name=\"$field_name\" class=\"js-select-single\">\n";