ipcam.php 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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. 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. exit;
  14. }
  15. if (isset($_POST['port_off'])) {
  16. $len = is_array($_POST['port_off']) ? count($_POST['port_off']) : 0;
  17. for ($i = 0; $i < $len; $i ++) {
  18. $building_id = intval($_POST['port_off'][$i]);
  19. set_port_for_group($db_link, $f_ou_id, $building_id, 0);
  20. }
  21. header("Location: " . $_SERVER["REQUEST_URI"]);
  22. exit;
  23. }
  24. unset($_POST);
  25. require_once ($_SERVER['DOCUMENT_ROOT']."/inc/header.php");
  26. ?>
  27. <div id="cont">
  28. <form name="def" action="ipcam.php" method="post">
  29. <?php
  30. print "<table cellspacing=\"0\" cellpadding=\"0\" width=\"500\">";
  31. print "<tr >\n";
  32. print "<td align=center colspan=2>".WEB_control_group."</td><td>";
  33. print_ou_select($db_link, 'f_ou_id', $f_ou_id);
  34. print "</td>\n";
  35. print "</tr>\n";
  36. print "<tr><td colspan=3><br></td></tr>\n";
  37. $t_config = get_records_sql($db_link, "select id,name from building order by name");
  38. foreach ($t_config as $row) {
  39. print "<tr align=center>\n";
  40. print "<td class=\"data\"><input type=\"text\" name='f_name[]' value='{$row['name']}' disabled=true readonly=true></td>\n";
  41. print "<td class=\"data\"><button name='port_on[]' value='{$row['id']}'>".WEB_control_port_poe_on."</button></td>\n";
  42. print "<td class=\"data\"><button name='port_off[]' value='{$row['id']}'>".WEB_control_port_poe_off."</button></td>\n";
  43. print "</tr>\n";
  44. }
  45. print "<tr align=center>\n";
  46. print "<td class=\"data\"><input type=\"text\" name='f_name[]' value='ALL' disabled=true readonly=true></td>\n";
  47. print "<td class=\"data\"><button name='port_on[]' value='{0}'>".WEB_control_port_poe_on."</button></td>\n";
  48. print "<td class=\"data\"><button name='port_off[]' value='{0}'>".WEB_control_port_poe_off."</button></td>\n";
  49. print "</tr>\n";
  50. ?>
  51. </table>
  52. </form>