ipcam.php 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <?php
  2. require_once ($_SERVER['DOCUMENT_ROOT']."/inc/auth.php");
  3. require_once ($_SERVER['DOCUMENT_ROOT']."/inc/languages/" . HTML_LANG . ".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. // Включение портов
  7. if (getPOST("port_on") !== null) {
  8. $port_on = getPOST("port_on", null, []);
  9. if (is_array($port_on)) {
  10. foreach ($port_on as $building_id) {
  11. $building_id = (int)$building_id;
  12. if ($building_id > 0) {
  13. set_port_for_group($db_link, $f_ou_id, $building_id, 1);
  14. }
  15. }
  16. }
  17. header("Location: " . $_SERVER["REQUEST_URI"]);
  18. exit;
  19. }
  20. // Отключение портов
  21. if (getPOST("port_off") !== null) {
  22. $port_off = getPOST("port_off", null, []);
  23. if (is_array($port_off)) {
  24. foreach ($port_off as $building_id) {
  25. $building_id = (int)$building_id;
  26. if ($building_id > 0) {
  27. set_port_for_group($db_link, $f_ou_id, $building_id, 0);
  28. }
  29. }
  30. }
  31. header("Location: " . $_SERVER["REQUEST_URI"]);
  32. exit;
  33. }
  34. unset($_POST);
  35. require_once ($_SERVER['DOCUMENT_ROOT']."/inc/header.php");
  36. ?>
  37. <div id="cont">
  38. <form name="def" action="ipcam.php" method="post">
  39. <?php
  40. print "<table cellspacing=\"0\" cellpadding=\"0\" width=\"500\">";
  41. print "<tr >\n";
  42. print "<td align=center colspan=2>".WEB_control_group."</td><td>";
  43. print_ou_select($db_link, 'f_ou_id', $f_ou_id);
  44. print "</td>\n";
  45. print "</tr>\n";
  46. print "<tr><td colspan=3><br></td></tr>\n";
  47. $t_config = get_records_sql($db_link, "SELECT * FROM building ORDER BY name");
  48. foreach ($t_config as $row) {
  49. print "<tr align=center>\n";
  50. print "<td class=\"$cl\" style='padding:0'><input type=checkbox name=fid[] value=".$row['id']."></td>\n";
  51. print "<td class=\"data\"><input type=\"text\" name='f_name[".$row['id']."]' value='".$row['name']."' disabled=true readonly=true></td>\n";
  52. print "<td class=\"data\"><button name='port_on[".$row['id']."]' value='".$row['id']."'>".WEB_control_port_poe_on."</button></td>\n";
  53. print "<td class=\"data\"><button name='port_off[".$row['id']."]' value='".$row['id']."'>".WEB_control_port_poe_off."</button></td>\n";
  54. print "</tr>\n";
  55. }
  56. ?>
  57. </table>
  58. </form>