switchport-conn.php 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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. $device=get_record($db_link,'devices',"id=?", [ $id ]);
  6. if (getPOST("remove") !== null) {
  7. $fid = getPOST("f_id", null, []);
  8. if (!empty($fid) && is_array($fid)) {
  9. foreach ($fid as $val) {
  10. $val = trim($val);
  11. if ($val !== '' && $val != 1) {
  12. LOG_VERBOSE($db_link, "Remove connection id: $val " . dump_record($db_link, 'connections', 'id = ?', [$val]));
  13. delete_record($db_link, "connections", "id = ?", [(int)$val]);
  14. }
  15. }
  16. }
  17. header("Location: " . $_SERVER["REQUEST_URI"]);
  18. exit;
  19. }
  20. unset($_POST);
  21. $user_info = get_record_sql($db_link,"SELECT * FROM user_list WHERE id=?", [ $device['user_id'] ]);
  22. require_once ($_SERVER['DOCUMENT_ROOT']."/inc/header.php");
  23. print_device_submenu($page_url);
  24. print_editdevice_submenu($page_url,$id,$device['device_type'],$user_info['login']);
  25. ?>
  26. <div id="contsubmenu">
  27. <form name="def" action="switchport-conn.php?id=<?php echo $id; ?>" method="post">
  28. <br>
  29. <?php print "<b>".WEB_device_port_connections."&nbsp".$device['device_name']." - ".$device['ip']."</b><br>\n"; ?>
  30. <table class="data">
  31. <tr>
  32. <td width=20><input type="checkbox" onClick="checkAll(this.checked);"></td>
  33. <td width=40><b><?php echo WEB_device_port_number; ?></b></td>
  34. <td ><b><?php echo WEB_cell_login; ?></b></td>
  35. <td width=100><input type="submit" onclick="return confirm('<?php echo WEB_msg_delete; ?>?')" name="remove" value="<?php echo WEB_btn_delete; ?>"></td>
  36. </tr>
  37. <?php
  38. $connections = get_records_sql($db_link,"SELECT C.* FROM connections as C,user_auth as A WHERE A.id=C.auth_id AND A.deleted=0 AND C.device_id=? ORDER BY C.port_id ASC", [ $id ]);
  39. foreach ($connections as $key => $value) {
  40. print "<tr align=center>\n";
  41. print "<td class=\"data\" style='padding:0'><input type=checkbox name=f_id[] value='{$value['id']}'></td>\n";
  42. $port = get_record($db_link,"device_ports","id=?", [$value['port_id']]);
  43. print "<td class=\"data\">". $port['port'] . "</a></td>\n";
  44. print "<td class=\"data\">";
  45. print_auth_detail($db_link, $value['auth_id']);
  46. print "</td>\n";
  47. print "<td class=\"data\"></td>\n";
  48. print "</tr>";
  49. }
  50. print "</table>\n";
  51. ?>
  52. </form>
  53. <?php
  54. require_once ($_SERVER['DOCUMENT_ROOT']."/inc/footer.php");
  55. ?>