switchport-conn.php 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <?php
  2. require_once ($_SERVER['DOCUMENT_ROOT']."/inc/auth.php");
  3. require_once ($_SERVER['DOCUMENT_ROOT']."/inc/languages/" . $language . ".php");
  4. require_once ($_SERVER['DOCUMENT_ROOT']."/inc/idfilter.php");
  5. $switch=get_record($db_link,'devices',"id=".$id);
  6. if (isset($_POST["remove"])) {
  7. $fid = $_POST["f_id"];
  8. foreach ($fid as $key => $val) {
  9. if (isset($val) and $val != 1) {
  10. LOG_INFO($db_link, "Remove connection id: $val");
  11. delete_record($db_link, "connections", "id=" . $val);
  12. }
  13. }
  14. header("Location: " . $_SERVER["REQUEST_URI"]);
  15. exit;
  16. }
  17. unset($_POST);
  18. require_once ($_SERVER['DOCUMENT_ROOT']."/inc/header.php");
  19. print_editdevice_submenu($page_url,$id,$device['device_type']);
  20. ?>
  21. <div id="cont">
  22. <form name="def" action="switchport-conn.php?id=<?php echo $id; ?>" method="post">
  23. <br>
  24. <?php print "<b>Список соединений на портах ".$switch['device_name']." - ".$switch['ip']."</b><br>\n"; ?>
  25. <table class="data">
  26. <tr>
  27. <td width=20><input type="checkbox" onClick="checkAll(this.checked);"></td>
  28. <td width=40><b>Порт</b></td>
  29. <td ><b>Юзер</b></td>
  30. <td width=100><input type="submit" onclick="return confirm('Удалить?')" name="remove" value="Удалить"></td>
  31. </tr>
  32. <?php
  33. $connections = get_records($db_link,"connections","device_id=$id ORDER BY port_id ASC");
  34. foreach ($connections as $key => $value) {
  35. print "<tr align=center>\n";
  36. print "<td class=\"data\" style='padding:0'><input type=checkbox name=f_id[] value='{$value['id']}'></td>\n";
  37. $port = get_record($db_link,"device_ports","id=".$value['port_id']);
  38. print "<td class=\"data\">". $port['port'] . "</a></td>\n";
  39. print "<td class=\"data\">";
  40. print_auth_detail($db_link, $value['auth_id']);
  41. print "</td>\n";
  42. print "<td class=\"data\"></td>\n";
  43. print "</tr>";
  44. }
  45. print "</table>\n";
  46. ?>
  47. </form>
  48. <?php
  49. require_once ($_SERVER['DOCUMENT_ROOT']."/inc/footer.small.php");
  50. ?>