ipcam.php 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <?php
  2. require_once ($_SERVER['DOCUMENT_ROOT']."/inc/auth.php");
  3. require_once ($_SERVER['DOCUMENT_ROOT']."/inc/languages/" . $language . ".php");
  4. // if(isset($_POST['f_ou_id'])){ $f_ou_id=$_POST['f_ou_id']*1; } else { $f_ou_id=1; }
  5. $f_ou_id = $ipcam_group_id;
  6. if (isset($_POST['port_on'])) {
  7. $len = is_array($_POST['port_on']) ? count($_POST['port_on']) : 0;
  8. for ($i = 0; $i < $len; $i ++) {
  9. $building_id = intval($_POST['port_on'][$i]);
  10. set_port_for_group($db_link, $f_ou_id, $building_id, 1);
  11. }
  12. header("Location: " . $_SERVER["REQUEST_URI"]);
  13. }
  14. if (isset($_POST['port_off'])) {
  15. $len = is_array($_POST['port_off']) ? count($_POST['port_off']) : 0;
  16. for ($i = 0; $i < $len; $i ++) {
  17. $building_id = intval($_POST['port_off'][$i]);
  18. set_port_for_group($db_link, $f_ou_id, $building_id, 0);
  19. }
  20. header("Location: " . $_SERVER["REQUEST_URI"]);
  21. }
  22. unset($_POST);
  23. require_once ($_SERVER['DOCUMENT_ROOT']."/inc/header.php");
  24. ?>
  25. <div id="cont">
  26. <form name="def" action="ipcam.php" method="post">
  27. <?
  28. print "<table cellspacing=\"0\" cellpadding=\"0\" width=\"500\">";
  29. print "<tr >\n";
  30. print "<td align=center colspan=2>Для группы</td><td>";
  31. print_ou_select($db_link, 'f_ou_id', $f_ou_id);
  32. print "</td>\n";
  33. print "</tr>\n";
  34. print "<tr><td colspan=3><br></td></tr>\n";
  35. $t_config = get_records_sql($db_link, "select id,name from building order by name");
  36. foreach ($t_config as $row) {
  37. print "<tr align=center>\n";
  38. print "<td class=\"data\"><input type=\"text\" name='f_name[]' value='{$row['name']}' disabled=true readonly=true></td>\n";
  39. print "<td class=\"data\"><button name='port_on[]' value='{$row['id']}'>Включить порты</button></td>\n";
  40. print "<td class=\"data\"><button name='port_off[]' value='{$row['id']}'>Выключить порты</button></td>\n";
  41. print "</tr>\n";
  42. }
  43. print "<tr align=center>\n";
  44. print "<td class=\"data\"><input type=\"text\" name='f_name[]' value='ALL' disabled=true readonly=true></td>\n";
  45. print "<td class=\"data\"><button name='port_on[]' value='{0}'>Включить порты</button></td>\n";
  46. print "<td class=\"data\"><button name='port_off[]' value='{0}'>Выключить порты</button></td>\n";
  47. print "</tr>\n";
  48. ?>
  49. </table>
  50. </form>