Jelajahi Sumber

bugfix: Fixed the oldest bug for date filters with a start date setting
added: Added subnet selection for the dhcp server log

root 1 tahun lalu
induk
melakukan
915a7b7

+ 4 - 2
html/admin/logs/detaillog.php

@@ -40,16 +40,18 @@ print_log_submenu($page_url);
 <div id="contsubmenu">
 
 <form action="<?php print $page_url; ?>" method="post">
-<input type="hidden" name="id" value=<?php echo $id; ?>>
-<?php echo WEB_cell_ip; ?>:&nbsp<input type="text" name="ip" value="<?php echo $f_ip; ?>" pattern="^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$"
+<input type="hidden" name="id" value="<?php echo $id; ?>">
 <?php echo WEB_log_start_date; ?>:&nbsp<input type="datetime-local" name="date_start" value="<?php echo $date1; ?>" />
 <?php echo WEB_log_stop_date; ?>:&nbsp<input type="datetime-local" name="date_stop" value="<?php echo $date2; ?>" />
 <?php echo WEB_cell_gateway; ?>:&nbsp <?php print_gateway_select($db_link, 'gateway', $rgateway); ?>
 DNS:&nbsp <input type=checkbox name=dns value="1" <?php print $dns_checked; ?>>
 <?php print WEB_rows_at_page."&nbsp"; print_row_at_pages('rows',$displayed); ?>
+<div><br>
+<?php echo WEB_cell_ip; ?>:&nbsp<input type="text" name="ip" value="<?php echo $f_ip; ?>" pattern="^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$">
 <input type="submit" value="<?php echo WEB_btn_show; ?>">
 </form>
 
+<div><br>
 <b><?php echo WEB_log_full; ?></b>
 
 <?php

+ 14 - 2
html/admin/logs/dhcp.php

@@ -4,6 +4,7 @@ require_once ($_SERVER['DOCUMENT_ROOT']."/inc/languages/" . HTML_LANG . ".php");
 require_once ($_SERVER['DOCUMENT_ROOT']."/inc/header.php");
 $default_date_shift='d';
 require_once ($_SERVER['DOCUMENT_ROOT']."/inc/datefilter.php");
+require_once ($_SERVER['DOCUMENT_ROOT']."/inc/cidrfilter.php");
 
 if (isset($_POST['dhcp_show'])) { $f_dhcp = $_POST['dhcp_show']; }
     else {
@@ -20,6 +21,11 @@ $_SESSION[$page_url]['ip']=$f_ip;
 $dhcp_where = '';
 if ($f_dhcp != 'all') { $dhcp_where = " and action='$f_dhcp' "; }
 
+if (empty($rcidr)) { $cidr_filter = ''; } else {
+    $cidr_range = cidrToRange($rcidr);
+    if (!empty($cidr_range)) { $cidr_filter = " and (ip_int>=".ip2long($cidr_range[0])." and ip_int<=".ip2long($cidr_range[1]).")"; }
+    }
+
 if (!empty($f_ip)) {
     if (checkValidIp($f_ip)) { 
         $dhcp_where = " and ip_int=inet_aton('" . $f_ip . "') "; 
@@ -30,8 +36,11 @@ if (!empty($f_ip)) {
         }
     }
 
+$dhcp_where .= $cidr_filter;
+
 print_log_submenu($page_url);
 
+
 ?>
 
 <div id="cont">
@@ -39,10 +48,13 @@ print_log_submenu($page_url);
 <form action="<?=$_SERVER['PHP_SELF']?>" method="post">
   <?php echo WEB_log_start_date; ?>:&nbsp<input type="date" name="date_start" value="<?php echo $date1; ?>" />
   <?php echo WEB_log_stop_date; ?>:&nbsp<input type="date" name="date_stop" value="<?php echo $date2; ?>" />
-  <?php echo WEB_log_event_type; ?>:&nbsp<?php print_dhcp_select('dhcp_show', $f_dhcp); ?>
-  <?php echo WEB_log_select_ip_mac; ?>:&nbsp<input type="text" name="ip" value="<?php echo $f_ip; ?>" />
   <?php print WEB_rows_at_page."&nbsp"; print_row_at_pages('rows',$displayed); ?>
+<div><br>
+  <?php echo WEB_network_subnet; ?>:&nbsp<?php print_subnet_select_office_splitted($db_link, 'cidr', $rcidr); ?>
+  <?php echo WEB_log_event_type; ?>:&nbsp<?php print_dhcp_select('dhcp_show', $f_dhcp); ?>
   <input type="submit" value="<?php echo WEB_btn_show; ?>">
+<div><br>
+  <?php echo WEB_log_select_ip_mac; ?>:&nbsp<input type="text" name="ip" value="<?php echo $f_ip; ?>" />
 </form>
 
 <?php

+ 1 - 0
html/admin/logs/mac.php

@@ -2,6 +2,7 @@
 require_once ($_SERVER['DOCUMENT_ROOT']."/inc/auth.php");
 require_once ($_SERVER['DOCUMENT_ROOT']."/inc/languages/" . HTML_LANG . ".php");
 require_once ($_SERVER['DOCUMENT_ROOT']."/inc/header.php");
+require_once ($_SERVER['DOCUMENT_ROOT']."/inc/cidrfilter.php");
 $default_date_shift='m';
 require_once ($_SERVER['DOCUMENT_ROOT']."/inc/datefilter.php");
 

+ 2 - 2
html/inc/common.php

@@ -1429,7 +1429,7 @@ function compact_port_name($port)
 
 function print_device_port_select($db, $field_name, $device_id, $target_id)
 {
-    print "<select id=\"$field_name\" name=\"$field_name\" class=\"js-select-single\">\n";
+    print "<select id=\"$field_name\" name=\"$field_name\" class=\"js-select-single\" >\n";
     if (empty($target_id)) {
         $target_id = 0;
     }
@@ -1474,7 +1474,7 @@ function print_netdevice_select($db, $field_name, $device_id)
 
 function print_vlan_select($db, $field_name, $vlan)
 {
-    print "<select id=\"$field_name\" name=\"$field_name\" class=\"js-select-single\">\n";
+    print "<select id=\"$field_name\" name=\"$field_name\" class=\"js-select-single\" style=\"width: 100px;\" >\n";
     $d_sql = "SELECT DISTINCT vlan FROM device_ports ORDER BY vlan DESC";
     $v_device = mysqli_query($db, $d_sql);
     if (!isset($vlan) or empty($vlan)) {

+ 1 - 1
html/inc/datetimefilter.php

@@ -2,7 +2,7 @@
 
 if (!defined("CONFIG")) die("Not defined");
 
-$datetime_start = DateTime::createFromFormat("Y-m-d 00:00:00",date("Y-m-d"));
+$datetime_start = DateTime::createFromFormat("Y-m-d 00:00:00",date("Y-m-d").' 00:00:00');
 
 if (empty($default_date_shift)) { $default_date_shift='h'; }