switchport-conn.php 2.3 KB

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