editauth.php 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474
  1. <?php
  2. require_once($_SERVER['DOCUMENT_ROOT'] . "/inc/auth.php");
  3. require_once($_SERVER['DOCUMENT_ROOT'] . "/inc/languages/" . HTML_LANG . ".php");
  4. require_once($_SERVER['DOCUMENT_ROOT'] . "/inc/idfilter.php");
  5. $msg_error = "";
  6. $old_auth_info = get_record_sql($db_link, "SELECT * FROM User_auth WHERE id=" . $id);
  7. if (empty($old_auth_info)) {
  8. header("Location: /admin/");
  9. }
  10. $parent_id = $old_auth_info['user_id'];
  11. $user_info = get_record_sql($db_link, "SELECT * FROM User_list WHERE id=" . $parent_id);
  12. $parent_ou_id = $user_info['ou_id'];
  13. $user_enabled = $user_info['enabled'];
  14. if (isset($_POST["editauth"]) and !$old_auth_info['deleted']) {
  15. $ip = trim($_POST["f_ip"]);
  16. if (checkValidIp($ip)) {
  17. $ip_aton = ip2long($ip);
  18. $mac = mac_dotted($_POST["f_mac"]);
  19. //search mac
  20. $mac_exists = find_mac_in_subnet($db_link, $ip, $mac);
  21. if (isset($mac_exists) and $mac_exists['count'] >= 1 and !in_array($parent_id, $mac_exists['users_id'])) {
  22. $dup_sql = "SELECT * FROM User_list WHERE id=" . $mac_exists['users_id']['0'];
  23. $dup_info = get_record_sql($db_link, $dup_sql);
  24. $msg_error = "Mac already exists at another user in this subnet! Skip creating $ip [$mac].<br>Old user id: " . $dup_info['id'] . " login: " . $dup_info['login'];
  25. $_SESSION[$page_url]['msg'] = $msg_error;
  26. LOG_ERROR($db_link, $msg_error);
  27. header("Location: " . $_SERVER["REQUEST_URI"]);
  28. exit;
  29. }
  30. //disable dhcp for secondary ip
  31. $f_dhcp = $_POST["f_dhcp"] * 1;
  32. if (!empty($mac_exists) and in_array($parent_id, $mac_exists['users_id'])) {
  33. if ($parent_id != $mac_exists['users_id'][0]) {
  34. $f_dhcp = 0;
  35. }
  36. }
  37. //search ip
  38. $dup_ip_record = get_record_sql($db_link, "SELECT * FROM User_auth WHERE `ip_int`=$ip_aton AND id<>$id AND deleted=0");
  39. if (!empty($dup_ip_record)) {
  40. $dup_info = get_record_sql($db_link, "SELECT * FROM User_list WHERE id=" . $dup_ip_record['user_id']);
  41. $msg_error = "$ip already exists. Skip creating $ip [$mac].<br>Old user id: " . $dup_info['id'] . " login: " . $dup_info['login'];
  42. $_SESSION[$page_url]['msg'] = $msg_error;
  43. LOG_ERROR($db_link, $msg_error);
  44. header("Location: " . $_SERVER["REQUEST_URI"]);
  45. exit;
  46. }
  47. $new['ip'] = $ip;
  48. $new['ou_id'] = $parent_ou_id;
  49. $new['ip_int'] = $ip_aton;
  50. $new['mac'] = mac_dotted($_POST["f_mac"]);
  51. $new['comments'] = $_POST["f_comments"];
  52. $new['WikiName'] = $_POST["f_wiki"];
  53. $f_dnsname = trim($_POST["f_dns_name"]);
  54. $dns_alias_count = get_count_records($db_link,'User_auth_alias','auth_id='.$id);
  55. if (!empty($f_dnsname)) {
  56. $domain_zone = get_option($db_link, 33);
  57. $f_dnsname = preg_replace('/'.$domain_zone.'/','',$f_dnsname);
  58. $f_dnsname = preg_replace('/\.$/','',$f_dnsname);
  59. $f_dnsname = preg_replace('/\s+/','-',$f_dnsname);
  60. $f_dnsname = preg_replace('/\./','-',$f_dnsname);
  61. //disable change dns name when exists aliases
  62. if ($dns_alias_count >0 and $f_dnsname !== $old_auth_info['dns_name']) {
  63. $f_dnsname = $old_auth_info['dns_name'];
  64. } else {
  65. if (checkValidHostname($f_dnsname) and checkUniqHostname($db_link,$id,$f_dnsname)) {
  66. $new['dns_name'] = $f_dnsname;
  67. } else {
  68. $msg_error = "DNS $f_dnsname already exists at: ".searchHostname($db_link,$id,$f_dnsname)." Discard changes!";
  69. $_SESSION[$page_url]['msg'] = $msg_error;
  70. LOG_ERROR($db_link, $msg_error);
  71. header("Location: " . $_SERVER["REQUEST_URI"]);
  72. exit;
  73. }
  74. }
  75. } else {
  76. //remove all dns aliases
  77. $new['dns_name'] = '';
  78. $t_User_auth_alias = get_records($db_link,'User_auth_alias',"auth_id=$id ORDER BY alias");
  79. if (!empty($t_User_auth_alias)) {
  80. foreach ( $t_User_auth_alias as $row ) {
  81. LOG_INFO($db_link, "Remove alias id: ".$row['id']." for auth_id: $id :: ".dump_record($db_link,'User_auth_alias','id='.$row['id']));
  82. delete_record($db_link,'User_auth_alias','id='.$row['id']);
  83. }
  84. }
  85. }
  86. $new['save_traf'] = $_POST["f_save_traf"] * 1;
  87. $new['dhcp_acl'] = trim($_POST["f_acl"]);
  88. $new['dynamic'] = trim($_POST["f_dynamic"]);
  89. if ($new['dynamic']) { $new['eof'] = trim($_POST["f_eof"]); }
  90. if (get_const('default_user_ou_id') == $parent_ou_id or get_const('default_hotspot_ou_id') == $parent_ou_id) {
  91. $new['nagios_handler'] = '';
  92. $new['enabled'] = 0;
  93. $new['link_check'] = 0;
  94. $new['nagios'] = 0;
  95. $new['blocked'] = 0;
  96. $new['day_quota'] = 0;
  97. $new['month_quota'] = 0;
  98. $new['queue_id'] = 0;
  99. $new['filter_group_id'] = 0;
  100. } else {
  101. $new['nagios_handler'] = $_POST["f_handler"];
  102. $new['enabled'] = get_int($_POST["f_enabled"]);
  103. $new['link_check'] = get_int($_POST["f_link"]);
  104. $new['nagios'] = get_int($_POST["f_nagios"]);
  105. $new['dhcp'] = $f_dhcp;
  106. $new['blocked'] = get_int($_POST["f_blocked"]);
  107. $new['day_quota'] = get_int($_POST["f_day_q"]);
  108. $new['month_quota'] = get_int($_POST["f_month_q"]);
  109. $new['queue_id'] = get_int($_POST["f_queue_id"]);
  110. $new['filter_group_id'] = get_int($_POST["f_group_id"]);
  111. }
  112. if ($new['nagios'] == 0) {
  113. $new['nagios_status'] = 'UP';
  114. }
  115. if (!$user_enabled) { $new['enabled']=0; }
  116. $changes = get_diff_rec($db_link, "User_auth", "id='$id'", $new, 0);
  117. if (!empty($changes)) {
  118. LOG_WARNING($db_link, "Changed record for $ip! Log: " . $changes, $id);
  119. }
  120. if (is_auth_bind_changed($db_link, $id, $ip, $mac)) {
  121. $new_id = copy_auth($db_link, $id, $new);
  122. if (!empty($new_id)) {
  123. header("Location: /admin/users/editauth.php?id=" . $new_id, TRUE, 302);
  124. } else {
  125. header("Location: " . $_SERVER["REQUEST_URI"]);
  126. }
  127. exit;
  128. } else {
  129. update_record($db_link, "User_auth", "id='$id'", $new);
  130. }
  131. } else {
  132. $msg_error = "$msg_ip_error xxx.xxx.xxx.xxx";
  133. $_SESSION[$page_url]['msg'] = $msg_error;
  134. }
  135. header("Location: " . $_SERVER["REQUEST_URI"]);
  136. exit;
  137. }
  138. if (isset($_POST["moveauth"]) and !$old_auth_info['deleted']) {
  139. $new_parent_id = $_POST["f_new_parent"] * 1;
  140. $moved_auth = get_record_sql($db_link,"SELECT comments FROM User_auth WHERE id=".$id);
  141. $changes = apply_auth_rule($db_link, $moved_auth, $new_parent_id);
  142. update_record($db_link, "User_auth", "id='$id'", $changes);
  143. LOG_WARNING($db_link, "IP-address moved to another user! Applyed: " . get_rec_str($changes), $id);
  144. run_sql($db_link,"DELETE FROM auth_rules WHERE user_id=".$old_auth_info["user_id"]." AND rule='".$old_auth_info["mac"]."' AND type=2");
  145. run_sql($db_link,"DELETE FROM auth_rules WHERE user_id=".$old_auth_info["user_id"]." AND rule='".$old_auth_info["ip"]."' AND type=1");
  146. LOG_INFO($db_link,"Autorules removed for user_id: ".$old_auth_info["user_id"]." login: ".$user_info["login"]." by mac and ip");
  147. header("Location: " . $_SERVER["REQUEST_URI"]);
  148. exit;
  149. }
  150. if (isset($_POST["recovery"]) and $old_auth_info['deleted']) {
  151. $ip = trim($_POST["f_ip"]);
  152. if (checkValidIp($ip)) {
  153. $ip_aton = ip2long($ip);
  154. $mac = mac_dotted($_POST["f_mac"]);
  155. //search mac
  156. $mac_exists = find_mac_in_subnet($db_link, $ip, $mac);
  157. if (isset($mac_exists) and $mac_exists['count'] >= 1 and !in_array($parent_id, $mac_exists['users_id'])) {
  158. $dup_sql = "SELECT * FROM User_list WHERE id=" . $mac_exists['users_id']['0'];
  159. $dup_info = get_record_sql($db_link, $dup_sql);
  160. $msg_error = "Mac already exists at another user in this subnet! Skip creating $ip [$mac].<br>Old user id: " . $dup_info['id'] . " login: " . $dup_info['login'];
  161. $_SESSION[$page_url]['msg'] = $msg_error;
  162. LOG_ERROR($db_link, $msg_error);
  163. header("Location: " . $_SERVER["REQUEST_URI"]);
  164. exit;
  165. }
  166. //disable dhcp for secondary ip
  167. $f_dhcp = $_POST["f_dhcp"] * 1;
  168. if (in_array($parent_id, $mac_exists['users_id'])) {
  169. if ($parent_id != $mac_exists['users_id'][0]) {
  170. $f_dhcp = 0;
  171. }
  172. }
  173. //search ip
  174. $dup_ip_record = get_record_sql($db_link, "SELECT * FROM User_auth WHERE `ip_int`=$ip_aton AND id<>$id AND deleted=0");
  175. if (!empty($dup_ip_record)) {
  176. $dup_info = get_record_sql($db_link, "SELECT * FROM User_list WHERE id=" . $dup_ip_record['user_id']);
  177. $msg_error = "$ip already exists. Skip creating $ip [$mac].<br>Old user id: " . $dup_info['id'] . " login: " . $dup_info['login'];
  178. $_SESSION[$page_url]['msg'] = $msg_error;
  179. LOG_ERROR($db_link, $msg_error);
  180. header("Location: " . $_SERVER["REQUEST_URI"]);
  181. exit;
  182. }
  183. $new['deleted'] = 0;
  184. $new['dynamic'] = 0;
  185. $f_dnsname = trim($_POST["f_dns_name"]);
  186. if (!empty($f_dnsname)) {
  187. $domain_zone = get_option($db_link, 33);
  188. $f_dnsname = preg_replace('/'.$domain_zone.'/','',$f_dnsname);
  189. $f_dnsname = preg_replace('/\.$/','',$f_dnsname);
  190. $f_dnsname = preg_replace('/\s+/','-',$f_dnsname);
  191. $f_dnsname = preg_replace('/\./','-',$f_dnsname);
  192. }
  193. if (!empty($f_dnsname) and checkValidHostname($f_dnsname) and checkUniqHostname($db_link,$id,$f_dnsname)) {
  194. run_sql($db_link,"UPDATE User_auth SET dns_name='' WHERE id=".$id);
  195. $new['dns_name'] = $f_dnsname;
  196. } else { $new['dns_name']=''; }
  197. $parent_id = $old_auth_info['user_id'];
  198. $old_parent = get_record_sql($db_link, "SELECT * FROM User_list WHERE id=".$parent_id);
  199. if (empty($old_parent)) {
  200. $new_user_info = get_new_user_id($db_link, $ip, $mac, NULL);
  201. if ($new_user_info['user_id']) { $new_user_id = $new_user_info['user_id']; }
  202. if (empty($new_user_id)) { $new_user_id = new_user($db_link, $new_user_info); }
  203. $new['user_id'] = $new_user_id;
  204. }
  205. //save comments
  206. $new['comments']=$old_parent['comments'];
  207. if (get_const('default_user_ou_id') == $parent_ou_id or get_const('default_hotspot_ou_id') == $parent_ou_id) {
  208. $new['nagios_handler'] = '';
  209. $new['enabled'] = 0;
  210. $new['link_check'] = 0;
  211. $new['nagios'] = 0;
  212. $new['blocked'] = 0;
  213. $new['day_quota'] = 0;
  214. $new['month_quota'] = 0;
  215. $new['queue_id'] = 0;
  216. $new['filter_group_id'] = 0;
  217. } else {
  218. $new['nagios_handler'] = $_POST["f_handler"];
  219. $new['enabled'] = get_int($_POST["f_enabled"]);
  220. $new['link_check'] = get_int($_POST["f_link"]);
  221. $new['nagios'] = get_int($_POST["f_nagios"]);
  222. $new['dhcp'] = get_int($_POST["f_dhcp"]);
  223. $new['blocked'] = get_int($_POST["f_blocked"]);
  224. $new['day_quota'] = get_int($_POST["f_day_q"]);
  225. $new['month_quota'] = get_int($_POST["f_month_q"]);
  226. $new['queue_id'] = get_int($_POST["f_queue_id"]);
  227. $new['filter_group_id'] = get_int($_POST["f_group_id"]);
  228. }
  229. $changes = get_diff_rec($db_link, "User_auth", "id='$id'", $new, 0);
  230. if (!empty($changes)) {
  231. LOG_WARNING($db_link, "Recovered ip-address. Applyed: $changes", $id);
  232. }
  233. $new = apply_auth_rule($db_link, $new, $new['user_id']);
  234. update_record($db_link, "User_auth", "id='$id'", $new);
  235. } else {
  236. $msg_error = "$msg_ip_error xxx.xxx.xxx.xxx/xx";
  237. $_SESSION[$page_url]['msg'] = $msg_error;
  238. }
  239. header("Location: " . $_SERVER["REQUEST_URI"]);
  240. exit;
  241. }
  242. unset($_POST);
  243. require_once($_SERVER['DOCUMENT_ROOT'] . "/inc/header.php");
  244. $sSQL = "SELECT * FROM User_auth WHERE id=$id";
  245. $auth_info = get_record_sql($db_link, $sSQL);
  246. $device = get_record_sql($db_link, "SELECT * FROM devices WHERE user_id=" . $auth_info['user_id']);
  247. $parent_name = get_login($db_link, $auth_info['user_id']);
  248. if ($auth_info['dhcp_time'] == '0000-00-00 00:00:00') {
  249. $dhcp_str = '';
  250. } else {
  251. $dhcp_str = $auth_info['dhcp_time'] . " (" . $auth_info['dhcp_action'] . ")";
  252. }
  253. if ($auth_info['last_found'] == '0000-00-00 00:00:00') { $auth_info['last_found'] = ''; }
  254. if ($auth_info['arp_found'] == '0000-00-00 00:00:00') { $auth_info['arp_found'] = ''; }
  255. $now = DateTime::createFromFormat("Y-m-d H:i:s",date('Y-m-d H:i:s'));
  256. $created = DateTime::createFromFormat("Y-m-d H:i:s",$auth_info['timestamp']);
  257. if (empty($auth_info['eof']) or $auth_info['eof'] == '0000-00-00 00:00:00') {
  258. $now->modify('+1 day');
  259. $auth_info['eof'] = $now->format('Y-m-d H:i:s');
  260. }
  261. ?>
  262. <div id="cont">
  263. <?php
  264. if (!empty($_SESSION[$page_url]['msg'])) {
  265. print '<div id="msg">' . $_SESSION[$page_url]['msg'] . '</div>';
  266. unset($_SESSION[$page_url]['msg']);
  267. }
  268. print "<b>" . WEB_user_title . "&nbsp<a href=/admin/users/edituser.php?id=" . $auth_info['user_id'] . ">" . $parent_name . "</a> </b>";
  269. $alias_link = '';
  270. if (!empty($auth_info['dns_name'])) { $alias_link="/admin/users/edit_alias.php?id=".$id; }
  271. if (empty($auth_info['created_by'])) { $auth_info['created_by'] = '-'; }
  272. ?>
  273. <form name="def" action="editauth.php?id=<?php echo $id; ?>" method="post">
  274. <input type="hidden" name="id" value=<?php echo $id; ?>>
  275. <table class="data">
  276. <tr>
  277. <td width=200><?php print WEB_cell_dns_name . " &nbsp | &nbsp ";
  278. print_url(WEB_cell_aliases, $alias_link); ?></td>
  279. <td width=200><?php print WEB_cell_comment; ?></td>
  280. <td width=70><?php print WEB_cell_enabled; ?></td>
  281. <td><?php print WEB_cell_traf; ?></td>
  282. <td></td>
  283. </tr>
  284. <tr>
  285. <td><input type="text" name="f_dns_name" value="<?php echo $auth_info['dns_name']; ?>" pattern="^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])$"></td>
  286. <td><input type="text" name="f_comments" value="<?php echo $auth_info['comments']; ?>"></td>
  287. <td><?php print_qa_select('f_enabled', $auth_info['enabled']); ?></td>
  288. <td><?php print_qa_select('f_save_traf', $auth_info['save_traf']); ?></td>
  289. <td></td>
  290. </tr>
  291. <tr>
  292. <td><?php print WEB_cell_ip; ?></td>
  293. <td><?php print WEB_cell_mac; ?></td>
  294. <td><?php print WEB_cell_dhcp; ?></td>
  295. <td><?php print WEB_cell_acl; ?></td>
  296. <td></td>
  297. <tr>
  298. <td><input type="text" name="f_ip" value="<?php echo $auth_info['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])$"></td>
  299. <td><input type="text" name="f_mac" value="<?php echo $auth_info['mac']; ?>" pattern="^(([0-9A-Fa-f]{2}[\.\:\-]){5}[0-9A-Fa-f]{2}|([0-9a-fA-F]{4}[\.\-][0-9a-fA-F]{4}[\.\-][0-9a-fA-F]{4})|[0-9A-Fa-f]{12})$"></td>
  300. <td><?php print_qa_select('f_dhcp', $auth_info['dhcp']); ?></td>
  301. <td colspan=2><input type="text" name="f_acl" value="<?php echo $auth_info['dhcp_acl']; ?>"></td>
  302. </tr>
  303. <tr>
  304. <td><?php print WEB_cell_filter; ?></td>
  305. <td><?php print WEB_cell_shaper; ?></td>
  306. <td><?php print WEB_cell_blocked; ?></td>
  307. <td><?php print WEB_cell_perday; ?></td>
  308. <td><?php print WEB_cell_permonth; ?></td>
  309. </tr>
  310. <tr>
  311. <td><?php print_group_select($db_link, 'f_group_id', $auth_info['filter_group_id']); ?> </td>
  312. <td><?php print_queue_select($db_link, 'f_queue_id', $auth_info['queue_id']); ?> </td>
  313. <td><?php print_qa_select('f_blocked', $auth_info['blocked']); ?></td>
  314. <td><input type="text" name="f_day_q" value="<?php echo $auth_info['day_quota']; ?>" size=5></td>
  315. <td><input type="text" name="f_month_q" value="<?php echo $auth_info['month_quota']; ?>" size=5></td>
  316. </tr>
  317. <tr>
  318. <td><?php print WEB_cell_nagios_handler; ?></td>
  319. <td width=200>
  320. <?php
  321. if (!empty($auth_info['WikiName'])) {
  322. $wiki_url = rtrim(get_option($db_link, 60), '/');
  323. if (preg_match('/127.0.0.1/', $wiki_url)) {
  324. print WEB_cell_wikiname;
  325. } else {
  326. $wiki_web = rtrim(get_option($db_link, 63), '/');
  327. $wiki_web = ltrim($wiki_web, '/');
  328. $wiki_link = $wiki_url . '/' . $wiki_web . '/' . $auth_info['WikiName'];
  329. print_url(WEB_cell_wikiname, $wiki_link);
  330. }
  331. } else {
  332. print WEB_cell_wikiname;
  333. }
  334. $dev_id = get_device_by_auth($db_link, $auth_info['user_id']);
  335. if (isset($dev_id)) {
  336. print "&nbsp|&nbsp";
  337. print_url('Device', '/admin/devices/editdevice.php?id=' . $dev_id);
  338. }
  339. ?>
  340. </td>
  341. <td><?php if (empty($device) or (!empty($device) and $device['device_type'] > 2)) {
  342. print WEB_cell_nagios;
  343. } ?></td>
  344. <td><?php if (empty($device) or (!empty($device) and $device['device_type'] > 2)) {
  345. print WEB_cell_link;
  346. } ?></td>
  347. <tr>
  348. <td><input type="text" name="f_handler" value="<?php echo $auth_info['nagios_handler']; ?>"></td>
  349. <td><input type="text" name="f_wiki" value="<?php echo $auth_info['WikiName']; ?>"></td>
  350. <td><?php if (empty($device) or (!empty($device) and $device['device_type'] > 2)) {
  351. print_qa_select('f_nagios', $auth_info['nagios']);
  352. } ?>
  353. </td>
  354. <td><?php if (empty($device) or (!empty($device) and $device['device_type'] > 2)) {
  355. print_qa_select('f_link', $auth_info['link_check']);
  356. } ?>
  357. </td>
  358. <td></td>
  359. </tr>
  360. <tr>
  361. <td><?php print WEB_cell_temporary; ?></td>
  362. <td><?php print WEB_cell_eof; ?></td>
  363. <td></td>
  364. <td></td>
  365. <td></td>
  366. </tr>
  367. <tr>
  368. <td><?php print_qa_select('f_dynamic',$auth_info['dynamic']); ?></td>
  369. <td><input type="datetime-local" id="f_eof" name="f_eof" min="<?php print $created->format('Y-m-d H:i:s'); ?>" value="<?php print $auth_info['eof']; ?>"
  370. <?php if (!$auth_info['dynamic']) { print "disabled"; } ?>
  371. step=1 ></td>
  372. <td></td>
  373. <td></td>
  374. <td></td>
  375. </tr>
  376. <tr>
  377. <td colspan=3><input type="submit" name="moveauth" value=<?php print WEB_btn_move; ?>><?php print_login_select($db_link, 'f_new_parent', $auth_info['user_id']); ?></td>
  378. <?php
  379. if ($auth_info['deleted']) {
  380. print "<td ><font color=red>" . WEB_deleted . ": " . $auth_info['changed_time'] . "</font></td>";
  381. print "<td align=right><input type=\"submit\" name=\"recovery\" value='" . WEB_btn_recover . "'></td>";
  382. } else {
  383. print "<td ></td>";
  384. print "<td align=right><input type=\"submit\" name=\"editauth\" value='" . WEB_btn_save . "'></td>";
  385. }
  386. ?>
  387. </tr>
  388. </table>
  389. <table class="data">
  390. <tr>
  391. <td class="data" colspan=2><?php echo WEB_status . ":"; ?></td>
  392. <td align=right ><a href=/admin/logs/authlog.php?auth_id=<?php print $id; ?>><?php print WEB_log; ?></a></td>
  393. <td align=right ><?php print_url(WEB_report_by_day, "/admin/reports/authday.php?id=$id"); ?></td>
  394. </tr>
  395. <tr>
  396. <td ><?php echo WEB_cell_created_by . ":"; ?></td>
  397. <td class="data" ></td>
  398. <td class="data" colspan=2 align=right><?php echo $auth_info['created_by']; ?></td>
  399. </tr>
  400. <tr>
  401. <td><?php print WEB_cell_created; ?></td>
  402. <td class="data" align=right><?php print $auth_info['timestamp']; ?></td>
  403. <td><?php print WEB_cell_connection . ": "; ?></td>
  404. <td class="data" align=right><?php print get_connection($db_link, $id) ; ?></td>
  405. </tr>
  406. <tr>
  407. <td ><?php print WEB_cell_dhcp_hostname.":"; ?></td>
  408. <td class="data"><?php print $auth_info['dhcp_hostname']; ?></td>
  409. <td ><?php print "Dhcp event: "; ?></td>
  410. <td class="data" align=right><?php print $dhcp_str; ?></td>
  411. </tr>
  412. <tr>
  413. <td ><?php print WEB_cell_arp_found . ": "; ?></td>
  414. <td class="data" align=right><?php print $auth_info['arp_found'] ; ?></td>
  415. <td ><?php print WEB_cell_last_found . ": "; ?></td>
  416. <td class="data" align=right><?php print $auth_info['last_found'] ; ?></td>
  417. </tr>
  418. <tr>
  419. </tr>
  420. </table>
  421. <?php
  422. if ($msg_error) {
  423. print "<div id='msg'><b>$msg_error</b></div><br>\n";
  424. }
  425. ?>
  426. </form>
  427. <br>
  428. <script>
  429. document.getElementById('f_dynamic').addEventListener('change', function(event) {
  430. const selectValue = this.value;
  431. const inputField = document.getElementById('f_eof');
  432. if (selectValue === '1') {
  433. inputField.disabled = false;
  434. } else {
  435. inputField.disabled = true;
  436. }
  437. });
  438. </script>
  439. <?php require_once($_SERVER['DOCUMENT_ROOT'] . "/inc/footer.simple.php"); ?>