Ver Fonte

bugfixes in html

root há 3 anos atrás
pai
commit
df2c61d886

+ 16 - 9
html/admin/customers/control-options.php

@@ -8,7 +8,8 @@ if (isset($_POST["remove"])) {
     if (!empty($fid)) {
         foreach ($fid as $key => $val) {
             if (isset($val) and $val != 1) {
-                LOG_INFO($db_link, "Remove config option id: $val");
+                $opt_def = get_record($db_link, "config_options","id=$val");
+                LOG_INFO($db_link, WEB_config_remove_option." id: ".$val." name: ".$opt_def["option_name"]);
                 delete_record($db_link, "config", "id=" . $val);
                 }
             }
@@ -27,7 +28,12 @@ if (isset($_POST['save'])) {
             $value = $_POST['f_config_value'][$j];
             if (isset($value) and $value!=='********') {
                 $new['value'] = $value;
-                update_record($db_link, "config", "id='{$save_id}'", $new);
+                $opt_cur = get_record($db_link, "config","id=$save_id");
+                if (isset($opt_cur) and !empty($opt_cur["option_id"])) {
+                    $opt_def = get_record($db_link, "config_options","id=".$opt_cur["option_id"]);
+                    LOG_INFO($db_link, WEB_config_set_option." id: ".$save_id." name: ".$opt_def["option_name"]." = ".$value);
+                    update_record($db_link, "config", "id='$save_id'", $new);
+                    }
             }
         }
     }
@@ -40,7 +46,8 @@ if (isset($_POST["create"])) {
     if (isset($new_option)) {
         $new['option_id'] = $new_option;
         $new['value'] = get_option($db_link,$new_option);
-        LOG_INFO($db_link, "Add config option $new_option");
+        $opt_def = get_record($db_link, "config_options","id=$new_option");
+        LOG_INFO($db_link, WEB_config_add_option." id: ".$new_option." name: ".$opt_def["option_name"]." = ".$new['value']);
         insert_record($db_link, "config", $new);
         }
     header("Location: " . $_SERVER["REQUEST_URI"]);
@@ -59,15 +66,15 @@ print_control_submenu($page_url);
 <div id="cont">
 <br>
 <form name="def" action="control-options.php" method="post">
-<br><b>Настройки</b><br>
+<br><b><?php print WEB_config_parameters; ?></b><br>
 <table class="data" width=800>
 <tr align="center">
 <td width=20><input type="checkbox" onClick="checkAll(this.checked);"></td>
 <td width=30><b>Id</b></td>
-<td width=150><b>Параметр</b></td>
-<td width=150><b>Значение</b></td>
-<td width=350><b>Комментарий</b></td>
-<td width=100><input type="submit" onclick="return confirm('Удалить?')" name="remove" value="Удалить"></td>
+<td width=150><b><?php print WEB_config_option; ?></b></td>
+<td width=150><b><?php print WEB_config_value; ?></b></td>
+<td width=350><b><?php print WEB_msg_comment; ?></b></td>
+<td width=100><input type="submit" onclick="return confirm('<?php print WEB_msg_delete; ?>?')" name="remove" value="<?php print WEB_msg_delete; ?>"></td>
 </tr>
 
 <?php
@@ -105,7 +112,7 @@ while ($row = mysqli_fetch_array($t_config)) {
 }
 ?>
 <tr>
-<td colspan=5 class="data">Добавить параметр :<?php print_option_select($db_link, "f_new_option"); ?></td>
+<td colspan=5 class="data"><?php print WEB_msg_add." ".mb_strtolower(WEB_config_option).":&nbsp"; print_option_select($db_link, "f_new_option"); ?></td>
 <td><input type="submit" name="create" value="Добавить"></td>
 </tr>
 </table>

+ 3 - 1
html/admin/customers/editcustom.php

@@ -19,11 +19,13 @@ if (isset($_POST["edituser"])) {
 
 unset($_POST);
 
+print_control_submenu($page_url);
+
 require_once ($_SERVER['DOCUMENT_ROOT']."/inc/header.php");
 $customer=get_record($db_link,'Customers',"id=".$id);
 ?>
 <div id="cont">
-
+<br><b>Пользователь</b><br>
 	<form name="def" action="editcustom.php?id=<?php echo $id; ?>" method="post">
 		<input type="hidden" name="id" value=<?php echo $id; ?>>
 		<table class="data">

+ 1 - 0
html/admin/devices/editdevice.php

@@ -83,6 +83,7 @@ $user_info = get_record_sql($db_link,"SELECT * FROM User_list WHERE id=".$device
 unset($_POST);
 
 require_once ($_SERVER['DOCUMENT_ROOT']."/inc/header.php");
+
 print_editdevice_submenu($page_url,$id,$device['device_type']);
 
 ?>

+ 43 - 21
html/admin/filters/editfilter.php

@@ -10,9 +10,10 @@ if (isset($_POST["editfilter"])) {
     $new['dstport'] = str_replace(':', '-', $_POST["f_dstport"]);
     $new['srcport'] = str_replace(':', '-', $_POST["f_srcport"]);
     $new['action'] = $_POST["f_action"] * 1;
+    $new['comment'] = $_POST["f_comment"];
     update_record($db_link, "Filter_list", "id='$id'", $new);
     unset($_POST);
-    header("location: index.php");
+    header("Location: " . $_SERVER["REQUEST_URI"]);
     exit;
 }
 
@@ -22,40 +23,61 @@ require_once ($_SERVER['DOCUMENT_ROOT']."/inc/header.php");
 
 $filter = get_record($db_link, 'Filter_list','id='.$id);
 
+print_filters_submenu($page_url);
+
 print "<div id=cont>";
-print "<form name=def action=editfilter.php?id=$id method=post>";
+
+print "<br> <b>Фильтр</b> <br>";
+
+print "<form name=def action='editfilter.php?id=".$id."' method=post>";
 print "<input type=hidden name=id value=$id>";
 
 if (isset($filter['type']) and $filter['type'] == 0) {
     print "<table class=\"data\" cellspacing=\"0\" cellpadding=\"4\">";
     print "<tr><td><b>Имя</b></td>";
+    print "<td ><b>Комментарий</b></td>";
+    print "<td ><b>Действие</b></td>";
+    print "</tr>";
+    print "<tr>";
+    print "<td align=left><input type=text name=f_name value='".$filter['name']."'></td>";
+    print "<td ><input type=text name=f_comment value='".$filter['comment']."'></td>";
+    print "<td>";
+    print_action_select('f_action', $filter['action']);
+    print "</td>";
+    print "<td><input type=submit name=editfilter value=Сохранить></td>";
+    print "</tr>";
+    print "<tr>";
     print "<td ><b>Протокол</b></td>";
     print "<td ><b>Адрес назначения</b></td>";
     print "<td ><b>Порт назначения</b></td>";
     print "<td ><b>Порт источник</b></td>";
+    print "</tr>";
+    print "<tr>";
+    print "<td ><input type=text name=f_proto value='".$filter['proto']."'></td>";
+    print "<td ><input type=text name=f_dst value='".$filter['dst']."'></td>";
+    print "<td ><input type=text name=f_dstport value='".$filter['dstport']."'></td>";
+    print "<td ><input type=text name=f_srcport value='".$filter['srcport']."'></td>";
+    print "</tr>";
+    print "</table>";
+} else {
+    print "<table class=\"data\" cellspacing=\"0\" cellpadding=\"4\">";
+    print "<tr><td><b>Имя</b></td>";
+    print "<td ><b>Комментарий</b></td>";
     print "<td ><b>Действие</b></td>";
-
-    print "</tr><td align=left><input type=text name=f_name value=".$filter['name']."></td>";
-    print "<td ><input type=text name=f_proto value=".$filter['proto']."></td>";
-    print "<td ><input type=text name=f_dst value=".$filter['dst']."></td>";
-    print "<td ><input type=text name=f_dstport value=".$filter['dstport']."></td>";
-    print "<td ><input type=text name=f_srcport value=".$filter['srcport']."></td>";
+    print "<td><input type=submit name=editfilter value=Сохранить></td>";
+    print "</tr>";
+    print "<tr>";
+    print "<td align=left><input type=text name=f_name value='".$filter['name']."'></td>";
+    print "<td ><input type=text name=f_comment value='".$filter['comment']."'></td>";
     print "<td>";
     print_action_select('f_action', $filter['action']);
-    print "</td></tr>";
-    print "<tr><td colspan=2><input type=submit name=editfilter value=Сохранить></td>";
-    print "</tr></table>";
-} else {
-    print "<table class=\"data\" cellspacing=\"0\" cellpadding=\"4\">";
-    print "<tr><td ><b>Имя</b></td>";
-    print "<td ><b>Адрес назначения</b></td>";
-    print "<td ><b>Действие</b></td></tr>";
-
-    print "<td align=left><input type=text name=f_name value=".$filter['name']."></td>";
-    print "<td ><input type=text name=f_dst value=".$filter['dst']."></td>";
+    print "</td>";
+    print "<td ><input type=text name=f_dst value='".$filter['dst']."'></td>";
+    print "</td>";
     print_action_select('f_action', $filter['action']);
-    print "<tr><td colspan=2><input type=submit name=editfilter value=Сохранить></td>";
-    print "</tr></table>";
+    print "</td>";
+    print "</tr>";
+    print "</table>";
 }
 print "</form>";
 require_once ($_SERVER['DOCUMENT_ROOT']."/inc/footer.php");

+ 14 - 6
html/admin/filters/editgroup.php

@@ -4,9 +4,10 @@ require_once ($_SERVER['DOCUMENT_ROOT']."/inc/languages/" . HTML_LANG . ".php");
 require_once ($_SERVER['DOCUMENT_ROOT']."/inc/idfilter.php");
 
 if (isset($_POST["editgroup"])) {
-    $new['group_name'] = substr($_POST["f_group_name"], 0, 30);
+    $new['group_name'] = $_POST["f_group_name"];
+    $new['comment'] = $_POST["f_group_comment"];
     update_record($db_link, "Group_list", "id='$id'", $new);
-    header("location: index.php");
+    header("Location: " . $_SERVER["REQUEST_URI"]);
     exit;
 }
 
@@ -46,17 +47,24 @@ if (isset($_POST["saveorder"])) {
 }
 
 unset($_POST);
-$group_name = get_group($db_link, $id);
+
+$group = get_record_sql($db_link, "SELECT * FROM Group_list WHERE id=".$id);
+
+print_filters_submenu($page_url);
 
 require_once ($_SERVER['DOCUMENT_ROOT']."/inc/header.php");
 ?>
 <div id="cont">
+<br> <b>Группа</b> <br>
+
 <form name="def" action="editgroup.php?id=<?php echo $id; ?>" method="post">
 <input type="hidden" name="id" value=<?php echo $id; ?>>
 <table class="data">
 <tr>
 <td>Название</td>
-<td><input type="text" name="f_group_name" value="<?php echo $group_name; ?>" size=25></td>
+<td><input type="text" name="f_group_name" value="<?php echo $group['group_name']; ?>"></td>
+<td>Комментарий</td>
+<td><input type="text" name="f_group_comment" value="<?php echo $group['comment']; ?>"></td>
 </tr>
 <tr>
 <td colspan=2><input type="submit" name="editgroup"	value="Сохранить"></td>
@@ -72,14 +80,14 @@ require_once ($_SERVER['DOCUMENT_ROOT']."/inc/header.php");
 </tr>
 
 <?php
-$sSQL = "SELECT G.id, G.filter_id, F.name, G.order FROM Group_filters G, Filter_list F WHERE F.id=G.filter_id and group_id=$id Order by G.order";
+$sSQL = "SELECT G.id, G.filter_id, F.name, G.order, F.comment FROM Group_filters G, Filter_list F WHERE F.id=G.filter_id and group_id=$id Order by G.order";
 $flist = get_records_sql($db_link,$sSQL);
 foreach ($flist as $row) {
     print "<tr align=center>\n";
     print "<td class=\"data\" style='padding:0'><input type=checkbox name=fgid[] value=".$row['id']."></td>\n";
     print "<td class=\"data\" align=left><input type=text name=ford[] value=".$row['order']." size=4 ></td>\n";
     print "<td class=\"data\" align=left><a href=editfilter.php?id=".$row['filter_id'].">" . $row['name'] . "</a></td>\n";
-    print "<td class=\"data\"></td>\n";
+    print "<td class=\"data\" align=left>" . $row['comment'] . "</a></td>\n";
     print "</tr>";
 }
 ?>

+ 7 - 6
html/admin/filters/groups.php

@@ -29,21 +29,22 @@ require_once ($_SERVER['DOCUMENT_ROOT']."/inc/header.php");
 print_filters_submenu($page_url);
 ?>
 <div id="cont">
-<br> <b>Список групп</b> <br>
 <form name="def" action="groups.php" method="post">
 <table class="data">
 <tr align="center">
 	<td><input type="checkbox" onClick="checkAll(this.checked);"></td>
 	<td><b>Id</b></td>
 	<td width=200><b>Название</b></td>
+	<td width=200><b>Комментарий</b></td>
 </tr>
 <?php
-$users = mysqli_query($db_link, "select * from Group_list order by id");
-while (list ($id, $grpname) = mysqli_fetch_array($users)) {
+$groups = get_records_sql($db_link,'SELECT * FROM Group_list ORDER BY id');
+foreach ($groups as $row) {
     print "<tr align=center>\n";
-    print "<td class=\"data\" style='padding:0'><input type=checkbox name=fid[] value=$id></td>\n";
-    print "<td class=\"data\" ><input type=\"hidden\" name=\"id\" value=$id>$id</td>\n";
-    print "<td class=\"data\"><a href=editgroup.php?id=$id>" . $grpname . "</a></td>\n";
+    print "<td class=\"data\" style='padding:0'><input type=checkbox name=fid[] value=".$row["id"]."></td>\n";
+    print "<td class=\"data\" ><input type=\"hidden\" name=\"".$row["id"]."\" value=".$row["id"].">".$row["id"]."</td>\n";
+    print "<td class=\"data\"><a href=editgroup.php?id=".$row["id"].">" . $row["group_name"] . "</a></td>\n";
+    print "<td class=\"data\">" . $row["comment"] . "</td>\n";
 }
 ?>
 </table>

+ 13 - 3
html/admin/filters/index.php

@@ -45,28 +45,38 @@ print_filters_submenu($page_url);
 		<td><b>Порт назначения</b></td>
 		<td><b>Порт источник</b></td>
 		<td><b>Действие</b></td>
+		<td><b>Комментарий</b></td>
 	</tr>
 <?php
-$filters = get_records($db_link,'Filter_list','TRUE ORDER BY name');
+$filters = get_records_sql($db_link,'SELECT * FROM Filter_list ORDER BY name');
 foreach ($filters as $row) {
     print "<tr align=center>\n";
     print "<td class=\"data\" style='padding:0'><input type=checkbox name=fid[] value=".$row['id']."></td>\n";
     print "<td class=\"data\" ><input type=hidden name=\"id\" value=".$row['id'].">".$row['id']."</td>\n";
     print "<td class=\"data\" align=left><a href=editfilter.php?id=".$row['id'].">" . $row['name'] . "</a></td>\n";
+    if (empty($row['comment'])) { $row['comment']=''; }
+    if (empty($row['proto'])) { $row['proto']=''; }
+    if (empty($row['dst'])) { $row['dst']=''; }
+    if (empty($row['dstport'])) { $row['dstport']=''; }
+    if (empty($row['srcport'])) { $row['srcport']=''; }
     if ($row['type'] == 0) {
         print "<td class=\"data\">IP фильтр</td>\n";
         print "<td class=\"data\">".$row['proto']."</td>\n";
         print "<td class=\"data\">".$row['dst']."</td>\n";
         print "<td class=\"data\">".$row['dstport']."</td>\n";
         print "<td class=\"data\">".$row['srcport']."</td>\n";
-        print "<td class=\"data\">" . get_action($row['action']) . "</td>\n<tr>";
+        print "<td class=\"data\">" . get_action($row['action']) . "</td>\n";
+        print "<td class=\"data\">".$row['comment']."</td>\n";
     } else {
         print "<td class=\"data\">Name фильтр</td>\n";
         print "<td class=\"data\"></td>\n";
         print "<td class=\"data\">".$row['dst']."</td>\n";
         print "<td class=\"data\"></td>\n";
-        print "<td class=\"data\">" . get_action($row['action']) . "</td>\n<tr>";
+        print "<td class=\"data\"></td>\n";
+        print "<td class=\"data\">" . get_action($row['action']) . "</td>\n";
+        print "<td class=\"data\">".$row['comment']."</td>\n";
     }
+    print "</tr>";
 }
 ?>
 </table>

+ 3 - 3
html/admin/groups/edit_group.php

@@ -62,14 +62,14 @@ if (isset($_POST["s_create"])) {
     exit;
 }
 
-unset($_POST);
 require_once ($_SERVER['DOCUMENT_ROOT']."/inc/header.php");
 
 fix_auth_rules($db_link);
 
 ?>
 <div id="cont">
-<form name="def" action="edit_group.php" method="post">
+<form name="def" action="edit_group.php?id=<?php echo $id; ?>" method="post">
+<input type="hidden" name="id" value=<?php echo $id; ?>>
 <table class="data">
 <tr align="center">
 <td colspan=2><b>Название</b></td>
@@ -107,7 +107,7 @@ print "<td class=\"data\"><input type=\"text\" name='f_nagios_service' value='{$
 </tr>
 </table>
 <br>
-<b>Правила автоназначения адресов в <?php print_url($auth_info['login'],"/admin/users/edituser.php?id=$id"); ?></b>
+<b>Правила автоназначения адресов в <?php print $ou_info['ou_name']; ?></b>
 <br>
 Порядок применения: hotspot => subnet => mac => hostname => default user
 <br><br>

+ 6 - 6
html/admin/logs/authlog.php

@@ -16,7 +16,7 @@ if (!isset($auth_id)) { header('Location: /admin/logs/index.php', true, 301); ex
 Начало:<input type="date" name="date_start" value="<?php echo $date1; ?>" />
 Конец:<input type="date" name="date_stop" value="<?php echo $date2; ?>" />
 Отображать:<?php print_row_at_pages('rows',$displayed); ?>
-Уровень логов:<?php print_loglevel_select('log_level',get_const('log_level')); ?>
+Уровень логов:<?php print_loglevel_select('display_log_level',$display_log_level); ?>
 <input type="submit" value="OK"><br><br>
 Фильтр Источник:<input name="customer" value="<?php echo $fcustomer; ?>" />
 Сообщение:<input name="message" value="<?php echo $fmessage; ?>" />
@@ -25,11 +25,11 @@ if (!isset($auth_id)) { header('Location: /admin/logs/index.php', true, 301); ex
 <?php
 $log_filter ='';
 
-
-if (get_const('log_level') == L_INFO) { $log_filter = " and `level`=L_INFO "; }
-if (get_const('log_level') == L_ERROR) { $log_filter = " and (`level`=L_INFO or `level`=L_ERROR) "; }
-if (get_const('log_level') == L_VERBOSE) { $log_filter = " and (`level`=L_INFO or `level`=L_ERROR or `level`=L_VERBOSE) "; }
-if (get_const('log_level') == L_DEBUG) { $log_filter = ""; }
+if ($display_log_level == L_ERROR) { $log_filter = " and `level`=". L_ERROR." "; }
+if ($display_log_level == L_WARNING) { $log_filter = " and `level`<=".L_WARNING." "; }
+if ($display_log_level == L_INFO) { $log_filter = " and `level`<=".L_INFO." "; }
+if ($display_log_level == L_VERBOSE) { $log_filter = " and `level`<=".L_VERBOSE." "; }
+if ($display_log_level == L_DEBUG) { $log_filter = ""; }
 
 if (!empty($log_filter)) { $log_filter = $log_filter." and auth_id=".$auth_id; } else { $log_filter = " and auth_id=".$auth_id; }
 if (!empty($fcustomer)) { $log_filter = $log_filter." and customer LIKE '%".$fcustomer."%'"; }

+ 6 - 7
html/admin/logs/index.php

@@ -14,7 +14,7 @@ print_log_submenu($page_url);
 Начало:<input type="date" name="date_start" value="<?php echo $date1; ?>" />
 Конец:<input type="date" name="date_stop" value="<?php echo $date2; ?>" />
 Отображать:<?php print_row_at_pages('rows',$displayed); ?>
-Уровень логов:<?php print_loglevel_select('log_level',get_const('log_level')); ?>
+Уровень логов:<?php print_loglevel_select('display_log_level',$display_log_level); ?>
 <input type="submit" value="OK"><br><br>
 Фильтр Источник:<input name="customer" value="<?php echo $fcustomer; ?>" />
 Сообщение:<input name="message" value="<?php echo $fmessage; ?>" />
@@ -23,12 +23,11 @@ print_log_submenu($page_url);
 <?php
 $log_filter ='';
 
-
-if (get_const('log_level') === L_ERROR) { $log_filter = " and `level`=L_ERROR "; }
-if (get_const('log_level') === L_WARNING) { $log_filter = " and `level`<=L_WARNING "; }
-if (get_const('log_level') === L_INFO) { $log_filter = " and `level`<=L_INFO "; }
-if (get_const('log_level') === L_VERBOSE) { $log_filter = " and `level`<=L_VERBOSE "; }
-if (get_const('log_level') === L_DEBUG) { $log_filter = ""; }
+if ($display_log_level == L_ERROR) { $log_filter = " and `level`=". L_ERROR." "; }
+if ($display_log_level == L_WARNING) { $log_filter = " and `level`<=".L_WARNING." "; }
+if ($display_log_level == L_INFO) { $log_filter = " and `level`<=".L_INFO." "; }
+if ($display_log_level == L_VERBOSE) { $log_filter = " and `level`<=".L_VERBOSE." "; }
+if ($display_log_level == L_DEBUG) { $log_filter = ""; }
 
 if (!empty($fcustomer)) { $log_filter = $log_filter." and customer LIKE '%".$fcustomer."%'"; }
 if (!empty($fmessage)) { $log_filter = $log_filter." and message LIKE '%".$fmessage."%'"; }

+ 1 - 1
html/admin/reports/index-full.php

@@ -86,7 +86,7 @@ while (list ($s_login,$s_ou_id,$u_id,$s_ip,$s_auth_id, $s_router_id, $traf_day_i
     if ($traf_day_in + $traf_day_out ==0) { continue; }
     $total_in += $traf_day_in;
     $total_out += $traf_day_out;
-    $s_router = $gateway_list[$s_router_id];
+    if (!empty($gateway_list[$s_router_id])) { $s_router = $gateway_list[$s_router_id]; } else { $s_router=''; }
     $cl = "data";
     if ($traf_day_out > 2 * $traf_day_in) { $cl = "nb"; }
     print "<tr align=center class=\"tr1\" onmouseover=\"className='tr2'\" onmouseout=\"className='tr1'\">\n";

+ 1 - 1
html/admin/reports/index.php

@@ -68,7 +68,7 @@ while (list ($s_login,$s_ou_id,$u_id,$s_auth_id, $s_router_id, $traf_day_in, $tr
     if ($traf_day_in + $traf_day_out ==0) { continue; }
     $total_in += $traf_day_in;
     $total_out += $traf_day_out;
-    $s_router = $gateway_list[$s_router_id];
+    if (!empty($gateway_list[$s_router_id])) { $s_router = $gateway_list[$s_router_id]; } else { $s_router=''; }
     $cl = "data";
     if ($traf_day_out > 2 * $traf_day_in) { $cl = "nb"; }
     print "<tr align=center class=\"tr1\" onmouseover=\"className='tr2'\" onmouseout=\"className='tr1'\">\n";

+ 29 - 33
html/admin/users/add_dhcp.php

@@ -1,11 +1,10 @@
 <?php
 require_once ($_SERVER['DOCUMENT_ROOT']."/inc/qauth.php");
 
-
 if (!empty($_GET["ip"]) and !empty($_GET["mac"])) {
     $ip = $_GET["ip"];
     $mac = mac_dotted(trim($_GET["mac"]));
-    $dhcp_hostname = NULL;
+    $dhcp_hostname = '';
     if (!empty($_GET["hostname"])) { $dhcp_hostname = trim($_GET["hostname"]); }
     $faction = $_GET["action"] * 1;
     $action = 'add';
@@ -16,7 +15,6 @@ if (!empty($_GET["ip"]) and !empty($_GET["mac"])) {
     if (checkValidIp($ip) and is_our_network($db_link, $ip)) {
 	$log_dhcp = 1;
         $ip_aton = ip2long($ip);
-
 	//check hotspot
 	$hotspot_user = is_hotspot($db_link,$ip);
 	if ($hotspot_user) {
@@ -25,46 +23,44 @@ if (!empty($_GET["ip"]) and !empty($_GET["mac"])) {
 		if (!isset($log_dhcp_hotspot)) { $log_dhcp_hotspot = 0; }
 		$log_dhcp = !$log_dhcp_hotspot;
 		}
-
 	$auth = get_record_sql($db_link,"SELECT * FROM User_auth WHERE ip_int=" . $ip_aton . " AND deleted=0");
-
 	$aid = NULL;
 	if (!empty($auth)) {
 	    $aid = $auth['id'];
 	    LOG_VERBOSE($db_link,"Found auth for dhcp id: $aid with ip: $ip mac: $mac",$aid);
-	    }
-
-	if ($action ==='add' and empty($auth)) {
+            } else {
+	    LOG_VERBOSE($db_link,"User ip record not found for ip: $ip mac: $mac action: $action. Create it!",0);
 	    $aid = resurrection_auth($db_link, $ip, $mac, $action, $dhcp_hostname);
-	    if (empty($aid)) { return; }
-	    LOG_VERBOSE($db_link,"Add user by dhcp request ip: $ip mac: $mac",$aid);
+	    if (empty($aid)) {
+                LOG_ERRROR($db_link,"Failed create new user record",0);
+                exit;
+                }
+	    LOG_VERBOSE($db_link,"Add user by dhcp request ip: $ip mac: $mac action: $action",$aid);
+            $auth = get_record_sql($db_link,"SELECT * FROM User_auth WHERE id=" . $aid);
             }
-
-	if ($action ==='del' and !empty($auth)) {
-            $last_time = strtotime($auth['dhcp_time']);
-            LOG_VERBOSE($db_link,"Delete action found for ip $ip (id: $aid, userid: ".$auth['user_id']."). Last timestamp = ".strftime('%Y-%m-%d %H-%M-%S',$last_time)." Now = ".strftime('%Y-%m-%d %H-%M-%S',time()),$aid);
-	    if ((time() - $last_time>60) and ($auth['ou_id'] == get_const('default_user_ou_id') or $auth['ou_id'] == get_const('default_hotspot_ou_id'))) {
-                LOG_VERBOSE($db_link,"Remove dynamic user ip (id: $aid) by dhcp request for ip: $ip mac: $mac",$aid);
-	        delete_record($db_link,"User_auth","id=".$aid);
-	        $u_count=get_count_records($db_link,'User_auth','deleted=0 and user_id='.$auth['user_id']);
-	        if ($u_count == 0) {
-	    	    delete_record($db_link,"User_list","id=".$auth['user_id']);
-                    LOG_VERBOSE($db_link,"Remove dynamic user id: ".$auth['user_id']." by dhcp request",$aid);
+        if ($action ==='del' and !empty($auth['dhcp_time'])) {
+                $last_time = strtotime($auth['dhcp_time']);
+                LOG_VERBOSE($db_link,"Delete action found for ip $ip (id: $aid, userid: ".$auth['user_id']."). Last timestamp = ".strftime('%Y-%m-%d %H-%M-%S',$last_time)." Now = ".strftime('%Y-%m-%d %H-%M-%S',time()),$aid);
+	        if ((time() - $last_time>60) and ($auth['ou_id'] == get_const('default_user_ou_id') or $auth['ou_id'] == get_const('default_hotspot_ou_id'))) {
+                    LOG_VERBOSE($db_link,"Remove dynamic user ip (id: $aid) by dhcp request for ip: $ip mac: $mac",$aid);
+	            delete_record($db_link,"User_auth","id=".$aid);
+	            $u_count=get_count_records($db_link,'User_auth','deleted=0 and user_id='.$auth['user_id']);
+	            if ($u_count == 0) {
+	    	        delete_record($db_link,"User_list","id=".$auth['user_id']);
+                        LOG_VERBOSE($db_link,"Remove dynamic user id: ".$auth['user_id']." by dhcp request",$aid);
 	    	    }
 	        }
 	    }
-	
-	if ($log_dhcp) {
-    	    $dhcp_log['auth_id'] = $aid;
-            $dhcp_log['ip'] = $ip;
-	    $dhcp_log['ip_int'] = $ip_aton;
-            $dhcp_log['mac'] = $mac;
-	    $dhcp_log['action'] = $action;
-    	    insert_record($db_link, "dhcp_log", $dhcp_log); 
-    	    }
-        } else {
-        LOG_ERROR($db_link, "$ip - wrong network!");
-        }
+        if ($log_dhcp) {
+    	        $dhcp_log['auth_id'] = $aid;
+                $dhcp_log['ip'] = $ip;
+	        $dhcp_log['ip_int'] = $ip_aton;
+                $dhcp_log['mac'] = $mac;
+	        $dhcp_log['action'] = $action;
+	        $dhcp_log['dhcp_hostname'] = $dhcp_hostname;
+    	        insert_record($db_link, "dhcp_log", $dhcp_log); 
+    	        }
+        } else { LOG_ERROR($db_link, "$ip - wrong network!"); }
 }
 unset($_GET);
 ?>

+ 4 - 4
html/admin/users/editauth.php

@@ -30,7 +30,7 @@ if (isset($_POST["editauth"]) and !$old_auth_info['deleted']) {
 		}
 	//disable dhcp for secondary ip
 	$f_dhcp = $_POST["f_dhcp"] * 1;
-	if (in_array($parent_id,$mac_exists['users_id'])) {
+	if (!empty($mac_exists) and in_array($parent_id,$mac_exists['users_id'])) {
 	    if ($parent_id != $mac_exists['users_id'][0]) { $f_dhcp = 0; }
 	    }
 	//search ip
@@ -48,7 +48,7 @@ if (isset($_POST["editauth"]) and !$old_auth_info['deleted']) {
         $new['ip_int'] = $ip_aton;
         $new['mac'] = mac_dotted($_POST["f_mac"]);
         $new['comments'] = $_POST["f_comments"];
-        $new['firmware'] = $_POST["f_firmware"];
+//        $new['firmware'] = $_POST["f_firmware"];
         $new['WikiName'] = $_POST["f_wiki"];
         $f_dnsname=trim($_POST["f_dns_name"]);
 //        if (!empty($f_dnsname) and checkValidHostname($f_dnsname) and checkUniqHostname($db_link,$id,$f_dnsname)) { $new['dns_name'] = $f_dnsname; }
@@ -80,7 +80,7 @@ if (isset($_POST["editauth"]) and !$old_auth_info['deleted']) {
             }
         if ($new['nagios'] ==0) { $new['nagios_status']='UP'; }
         $changes = get_diff_rec($db_link,"User_auth","id='$id'", $new, 0);
-        if (!empty($changes)) { LOG_WARNING($db_link,"Изменена запись для адреса $ip! Список изменений: $changes",$id); }
+        if (!empty($changes)) { LOG_WARNING($db_link,"Изменена запись для адреса $ip! Список изменений: ".$changes,$id); }
         if (is_auth_bind_changed($db_link,$id,$ip,$mac)) {
             $new_id = copy_auth($db_link,$id,$new);
             header("Location: /admin/users/editauth.php?id=".$new_id,TRUE, 302);
@@ -99,7 +99,7 @@ if (isset($_POST["editauth"]) and !$old_auth_info['deleted']) {
 if (isset($_POST["moveauth"]) and !$old_auth_info['deleted']) {
     $new_parent_id = $_POST["f_new_parent"]*1;
     $changes=apply_auth_rule($db_link,$id,$new_parent_id);
-    LOG_WARNING($db_link,"Адрес доступа перемещён к другому пользователю! Применено: $changes",$id);
+    LOG_WARNING($db_link,"Адрес доступа перемещён к другому пользователю! Применено: ".get_rec_str($changes),$id);
     header("Location: " . $_SERVER["REQUEST_URI"]);
     exit;
     }

+ 0 - 1
html/admin/users/edituser.php

@@ -296,7 +296,6 @@ if ($msg_error) { print "<div id='msg'><b>$msg_error</b></div><br>\n"; }
 
 $sort_table = 'User_auth';
 $sort_url = "<a href=edituser.php?id=" . $id;
-if ($id == $default_user_id or $id == $hotspot_user_id) { $default_sort = 'last_found DESC'; }
 ?>
 
 <br><b>Список адресов доступа</b><br>

+ 0 - 1
html/admin/users/index.php

@@ -180,7 +180,6 @@ foreach ($users as $row) {
     }
     print "<tr align=center>\n";
     print "<td class=\"$cl\" style='padding:0'><input type=checkbox name=fid[] value=".$row['id']."></td>\n";
-    print "<td class=\"$cl\" ><input type=hidden name=\"id\" value=".$row['id'].">".$row['id']."</td>\n";
     if (empty($row['login'])) { $row['login']=$row['id']; }
     print "<td class=\"$cl\" align=left><a href=edituser.php?id=".$row['id'].">" . $row['login'] . "</a></td>\n";
     print "<td class=\"$cl\">".$row['fio']."</td>\n";

+ 43 - 23
html/inc/common.php

@@ -29,6 +29,12 @@ $config["init"]=0;
 // 17, 'Maipu'
 // 18, 'Asus'
 
+function mb_ucfirst($str) {
+    $str = mb_strtolower($str);
+    $fc = mb_strtoupper(mb_substr($str, 0, 1));
+    return $fc.mb_substr($str, 1);
+}
+
 function get_user_ip()
 {
     $auth_ip = getenv("HTTP_CLIENT_IP");
@@ -1024,39 +1030,40 @@ function get_device_ips($db, $device_id)
 function get_device_id($db, $device_name)
 {
     $d_sql = "SELECT id FROM devices WHERE device_name='$device_name' and deleted=0";
-    $t_device = mysqli_query($db, $d_sql);
-    list ($f_device_id) = mysqli_fetch_array($t_device);
-    return $f_device_id;
+    $dev = get_record_sql($db,$d_sql);
+    if (empty($dev)) { return NULL; }
+    return $dev["id"];
 }
 
 function get_device_name($db, $device_id)
 {
     $d_sql = "SELECT device_name FROM devices WHERE id='$device_id'";
-    $t_device = mysqli_query($db, $d_sql);
-    list ($f_device_name) = mysqli_fetch_array($t_device);
-    return $f_device_name;
+    $dev = get_record_sql($db,$d_sql);
+    if (empty($dev)) { return NULL; }
+    return $dev["device_name"];
 }
 
 function get_auth_by_ip($db, $ip)
 {
     $d_sql = "SELECT id FROM User_auth WHERE ip='$ip' and deleted=0";
-    $auth_q = mysqli_query($db, $d_sql);
-    list ($f_auth_id) = mysqli_fetch_array($auth_q);
-    return $f_auth_id;
+    $auth = get_record_sql($db,$d_sql);
+    if (empty($auth)) { return NULL; }
+    return $auth["id"];
 }
 
 function get_user_by_ip($db, $ip)
 {
     $d_sql = "SELECT user_id FROM User_auth WHERE ip='$ip' and deleted=0";
-    $auth_q = mysqli_query($db, $d_sql);
-    list ($f_auth_id) = mysqli_fetch_array($auth_q);
-    return $f_auth_id;
+    $auth = get_record_sql($db,$d_sql);
+    if (empty($auth)) { return NULL; }
+    return $auth["user_id"];
 }
 
 function get_device_by_auth($db, $id)
 {
     $d_sql = "SELECT id FROM devices WHERE user_id=$id and deleted=0";
     $f_dev = get_record_sql($db,$d_sql);
+    if (empty($f_dev)) { return NULL; }
     return $f_dev['id'];
 }
 
@@ -1326,6 +1333,7 @@ if (!empty($ou_info)) {
     }
 
 $result = insert_record($db,"User_list",$user);
+$auto_mac_rule = get_option($db, 64);
 if (!empty($result) and $auto_mac_rule and $user_info['mac']) {
     $auth_rule['user_id'] = $result;
     $auth_rule['type'] = 2;
@@ -2784,12 +2792,13 @@ function get_records_sql($db, $sql)
 
 function get_record_sql($db, $sql)
 {
+    $result = NULL;
     if (! isset($sql)) {
         LOG_ERROR($db, "Empty query! Skip command.");
-        return;
+        return $result;
     }
     $record = mysqli_query($db, $sql." LIMIT 1") or LOG_ERROR($db, "SQL: $sql LIMIT 1: ".mysqli_error($db));
-    $result = NULL;
+    if (!isset($record)) { return $result; }
     $rec = mysqli_fetch_array($record, MYSQLI_ASSOC);
     if (!empty($rec)) {
         foreach ($rec as $key => $value) {
@@ -2920,10 +2929,12 @@ function delete_record($db, $table, $filter)
     $old_record = mysqli_query($db, $old_sql) or LOG_ERROR($db, "SQL: $old_sql :".mysqli_error($db));
     $old = mysqli_fetch_array($old_record, MYSQLI_ASSOC);
     $changed_log = 'record: ';
-    foreach ($old as $key => $value) {
-        if (! isset($value)) { $value = ''; }
-        $changed_log = $changed_log . " $key => $value,";
-    }
+    if (!empty($old)) {
+        foreach ($old as $key => $value) {
+            if (! isset($value)) { $value = ''; }
+            $changed_log = $changed_log . " $key => $value,";
+            }
+        }
     //never delete user ip record
     if ($table === 'User_auth') {
         $changed_time = GetNowTimeString();
@@ -2981,6 +2992,13 @@ function insert_record($db, $table, $newvalue)
     return $last_id;
 }
 
+function get_rec_str ($array) {
+    $result='';
+    foreach ($array as $key => $value) { $result .= "[".$key."]=".$value.", "; }
+    $result = preg_replace('/,\s+$/','',$result);
+    return $result;
+}
+
 function get_diff_rec($db, $table, $filter, $newvalue, $only_changed)
 {
     if (! isset($table)) {
@@ -3008,7 +3026,7 @@ function get_diff_rec($db, $table, $filter, $newvalue, $only_changed)
     if (!$only_changed) {
         $old_record = "\r\n Не изменялось:\r\n";
 	foreach ($old as $key => $value) {
-            if (!$newvalue[$key]) { $old_record = $old_record . " $key = $value,\r\n"; }
+            if (!empty($newvalue[$key])) { $old_record = $old_record . " $key = $value,\r\n"; }
             }
 	$old_record = substr_replace($old_record, "", -3);
 	}
@@ -3178,14 +3196,15 @@ function get_new_user_id($db, $ip, $mac, $hostname)
     if (!empty($mac)) {
         $mac_rules=get_records_sql($db,"SELECT * FROM auth_rules WHERE type=2 AND LENGTH(rule)>0 AND user_id IS NOT NULL");
         foreach ($mac_rules as $row) {
-            if (!empty($row['rule']) and preg_match(mac_simplify($row['rule']), mac_simplify($mac))) { $result['user_id']=$row['user_id']; }
+            $pattern = '/'.mac_simplify($row['rule']).'/';
+            if (!empty($row['rule']) and preg_match($pattern, mac_simplify($mac))) { $result['user_id']=$row['user_id']; }
             }
         }
     //hostname
     if (!empty($hostname)) {
         $mac_rules=get_records_sql($db,"SELECT * FROM auth_rules WHERE type=3 AND LENGTH(rule)>0 AND user_id IS NOT NULL");
         foreach ($mac_rules as $row) {
-            if (!empty($row['rule']) and preg_match($row['rule'], $mac)) { $result['user_id']=$row['user_id']; }
+            if (!empty($row['rule']) and preg_match($row['rule'], $hostname)) { $result['user_id']=$row['user_id']; }
             }
         }
 
@@ -3204,14 +3223,15 @@ function get_new_user_id($db, $ip, $mac, $hostname)
     if (!empty($mac)) {
         $mac_rules=get_records_sql($db,"SELECT * FROM auth_rules WHERE type=2 AND LENGTH(rule)>0 AND ou_id IS NOT NULL");
         foreach ($mac_rules as $row) {
-            if (!empty($row['rule']) and preg_match(mac_simplify($row['rule']), mac_simplify($mac))) { $result['ou_id']=$row['ou_id']; }
+            $pattern = '/'.mac_simplify($row['rule']).'/';
+            if (!empty($row['rule']) and preg_match($pattern, mac_simplify($mac))) { $result['ou_id']=$row['ou_id']; }
             }
         }
     //hostname
     if (!empty($hostname)) {
         $mac_rules=get_records_sql($db,"SELECT * FROM auth_rules WHERE type=3 AND LENGTH(rule)>0 AND ou_id IS NOT NULL");
         foreach ($mac_rules as $row) {
-            if (!empty($row['rule']) and preg_match($row['rule'], $mac)) { $result['ou_id']=$row['ou_id']; }
+            if (!empty($row['rule']) and preg_match($row['rule'], $hostname)) { $result['ou_id']=$row['ou_id']; }
             }
         }
 

+ 1 - 0
html/inc/idfilter.php

@@ -11,4 +11,5 @@ if (empty($id)) {
     }
 
 $_SESSION[$page_url]['id']=$id;
+
 ?>

+ 131 - 0
html/inc/languages/russian2.php

@@ -1,4 +1,97 @@
 <?php
+
+$m = array(
+    1 => "Январь",
+    2 => "Февраль",
+    3 => "Март",
+    4 => "Апрель",
+    5 => "Май",
+    6 => "Июнь",
+    7 => "Июль",
+    8 => "Август",
+    9 => "Сентябрь",
+    10 => "Октябрь",
+    11 => "Ноябрь",
+    12 => "Декабрь"
+);
+
+/* header title */
+$title_reports = "Отчёт";
+$title_groups = "Группы";
+$title_users = "Пользователи";
+$title_users_ips = "Все IP";
+$title_filters = "Фильтры";
+$title_shapers = "Шейперы";
+$title_devices = "Инфраструктура";
+
+/* traffic headers */
+$title_ip = "Адрес";
+$title_date = "Дата";
+$title_input = "Входящий";
+$title_output = "Исходящий";
+$title_pktin = "IN, pkt/s";
+$title_pktout = "OUT, pkt/s";
+$title_maxpktin = "Max IN, pkt/s";
+$title_maxpktout = "Max OUT, pkt/s";
+$title_sum = "Суммарно";
+$title_itog = "Итого";
+
+/* table cell names */
+$cell_login = "Логин";
+$cell_fio = "ФИО";
+$cell_ou = "Группа";
+$cell_enabled = "Включен";
+$cell_blocked = "Блокировка";
+$cell_perday = "В день";
+$cell_permonth = "В месяц";
+$cell_report = "Отчёт";
+$cell_name = "Название";
+$cell_ip = "IP";
+$cell_mac = "MAC";
+$cell_clientid = "Client-id";
+$cell_host_firmware = "Firmware";
+$cell_comment = "Комментарий";
+$cell_wikiname = "Wiki Name";
+$cell_filter = "Фильтр";
+$cell_proxy = "Proxy";
+$cell_dhcp = "Dhcp";
+$cell_nat = "Nat";
+$cell_transparent = "Transparent";
+$cell_shaper = "Шейпер";
+$cell_connection = "Подключен";
+$cell_dns_name = "Имя в dns";
+$cell_host_model = "Модель устройства";
+$cell_nagios = "Мониторинг";
+$cell_nagios_handler = "Реакция на событие";
+$cell_link = "Линк";
+$cell_traf = "Запись трафика";
+$cell_acl = "dhcp acl";
+$cell_rule = "Правил";
+
+/* lists name */
+$list_ou = "Список групп";
+$list_subnet = "Список подсетей";
+$list_customers = "Список администраторов";
+$list_filters = "Список фильтров";
+$list_users = "Список полльзователей";
+
+/* button names */
+$btn_remove = "Удалить";
+$btn_add = "Добавить";
+$btn_save = "Сохранить";
+$btn_move = "Переместить";
+$btn_apply = "Применить конфигурацию";
+$btn_device = "+Устройство";
+$btn_mac_add = "+MAC";
+$btn_mac_del = "-MAC";
+$btn_ip_add = "+IP";
+$btn_ip_del = "-IP";
+
+/* error messages */
+$msg_exists = "уже существует!";
+$msg_ip_error = "Формат адреса не верен!";
+
+
 define("WEB_MONTHS", array(
 1 => "Январь",
 2 => "Февраль",
@@ -14,6 +107,24 @@ define("WEB_MONTHS", array(
 12 => "Декабрь"
 ));
 
+/* common */
+define("WEB_msg_IP","IP-адрес");
+define("WEB_msg_ERROR","Ошибка!");
+define("WEB_auth_unknown","IP-адрес клиента не установлен");
+define("WEB_msg_enabled","Включен");
+define("WEB_msg_disabled","Выключен");
+define("WEB_msg_login","Логин");
+define("WEB_msg_fullname","ФИО");
+define("WEB_msg_comment","Комментарий");
+define("WEB_msg_now","Сейчас");
+define("WEB_msg_forbidden","Запрещено");
+define("WEB_msg_traffic_blocked","Блок по трафику");
+define("WEB_msg_internet","Интернет");
+define("WEB_msg_run","Выполнить");
+define("WEB_msg_delete","Удалить");
+define("WEB_msg_apply","Применить");
+define("WEB_msg_add","Добавить");
+
 /* header title */
 define("WEB_title_reports","Отчёт");
 define("WEB_title_groups","Группы");
@@ -66,6 +177,10 @@ define("WEB_cell_link","Линк");
 define("WEB_cell_traf","Запись трафика");
 define("WEB_cell_acl","dhcp acl");
 define("WEB_cell_le","Правил");
+define("WEB_ceil_login_quote_month","Квота на логин, месяц");
+define("WEB_ceil_ip_quote_month","Квота на адрес, месяц");
+define("WEB_ceil_login_quote_day","Квота на логин, день");
+define("WEB_ceil_ip_quote_day","Квота на адрес, день");
 
 /* lists name */
 define("WEB_list_ou","Список групп");
@@ -92,4 +207,20 @@ define("WEB_msg_ip_error","Формат адреса не верен!");
 
 /* log messages */
 
+/* control options */
+define("WEB_config_remove_option","Удалён параметр");
+define("WEB_config_set_option","Изменён параметр");
+define("WEB_config_add_option","Добавлен параметр");
+define("WEB_config_parameters","Настройки");
+define("WEB_config_option","Параметр");
+define("WEB_config_value","Значение");
+
+/* public user */
+define("WEB_msg_auth_unknown","в списках не значится");
+define("WEB_msg_user_unknown","принадлежит несуществующему юзеру. Вероятно запись удалена.");
+define("WEB_msg_traffic_for_ip","Трафик на адрес");
+define("WEB_msg_traffic_for_login","Трафик клиента");
+define("WEB_public_day_traffic","за день, (Вх/Исх)");
+define("WEB_public_month_traffic","за месяц, (Вх/Исх)");
+
 ?>

+ 9 - 5
html/inc/loglevelfilter.php

@@ -1,10 +1,14 @@
 <?php
 if (! defined("CONFIG")) die("Not defined");
-if (isset($_POST['log_level']) or isset($_GET['log_level'])) {
-    if (isset($_GET['log_level'])) { get_const('log_level') = $_GET['log_level']*1; }
-    if (isset($_POST['log_level'])) { get_const('log_level') = $_POST['log_level']*1; }
+
+if (isset($_POST['display_log_level']) or isset($_GET['display_log_level'])) {
+    if (isset($_GET['display_log_level'])) { $display_log_level = $_GET['display_log_level']*1; }
+    if (isset($_POST['display_log_level'])) { $display_log_level = $_POST['display_log_level']*1; }
     } else {
-    if (isset($_SESSION[$page_url]['log_level'])) { get_const('log_level')=$_SESSION[$page_url]['log_level']; } else { get_const('log_level') = 1; }
+    if (isset($_SESSION[$page_url]['display_log_level'])) { $display_log_level=$_SESSION[$page_url]['display_log_level']; } else { $display_log_level = 1; }
     }
-$_SESSION[$page_url]['log_level']=get_const('log_level');
+
+if (empty($display_log_level)) { $display_log_level=1; }
+
+$_SESSION[$page_url]['display_log_level']=$display_log_level;
 ?>

+ 1 - 2
scripts/fetch_new_arp.pl

@@ -30,8 +30,6 @@ flock(SELF, LOCK_EX|LOCK_NB) or exit 1;
 
 setpriority(0,0,19);
 
-$debug = 1;
-
 my %mac_history;
 
 my ($sec,$min,$hour,$day,$month,$year,$zone) = localtime(time());
@@ -39,6 +37,7 @@ $month += 1;
 $year += 1900;
 
 my $fork_count = $cpu_count*5;
+
 #disable fork for debug
 #if ($debug) { $fork_count = 0; }
 

+ 10 - 0
updates/20230224/mysql-20230224.sql

@@ -0,0 +1,10 @@
+ALTER TABLE `Filter_list` ADD `comment` VARCHAR(250) NULL DEFAULT NULL AFTER `name`;
+ALTER TABLE `Filter_list` CHANGE `name` `name` VARCHAR(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL;
+ALTER TABLE `Group_list` CHANGE `group_name` `group_name` VARCHAR(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL;
+ALTER TABLE `Group_list` ADD `comment` VARCHAR(250) NULL DEFAULT NULL AFTER `group_name`;
+ALTER TABLE `mac_history` ADD `dhcp_hostname` VARCHAR(250) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL AFTER `auth_id`;
+ALTER TABLE `auth_rules` ADD `comment` VARCHAR(250) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL AFTER `rule`;
+ALTER TABLE `building` CHANGE `comment` `comment` VARCHAR(250) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL;
+UPDATE `config_options` SET `default_value` = '/usr/local/scripts/sync_mikrotik.pl' WHERE `config_options`.`id` = 37;
+ALTER TABLE `dhcp_log` ADD `dhcp_hostname` VARCHAR(250) NULL DEFAULT NULL AFTER `auth_id`;
+ALTER TABLE `OU` ADD `comment` VARCHAR(250) NULL DEFAULT NULL AFTER `ou_name`;