index.php 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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["remove"])) {
  5. $fid = $_POST["f_id"];
  6. foreach ($fid as $key => $val) {
  7. if (isset($val) and $val > 0) {
  8. run_sql($db_link, "UPDATE User_list SET ou_id=0 WHERE ou_id=$val");
  9. run_sql($db_link, "UPDATE User_auth SET ou_id=0 WHERE ou_id=$val");
  10. run_sql($db_link, "DELETE FROM auth_rules WHERE ou_id=$val");
  11. delete_record($db_link, "OU", "id=" . $val);
  12. }
  13. }
  14. header("Location: " . $_SERVER["REQUEST_URI"]);
  15. exit;
  16. }
  17. if (isset($_POST["create"])) {
  18. $ou_name = $_POST["new_ou"];
  19. if (isset($ou_name)) {
  20. $new['ou_name'] = $ou_name;
  21. insert_record($db_link, "OU", $new);
  22. }
  23. header("Location: " . $_SERVER["REQUEST_URI"]);
  24. exit;
  25. }
  26. unset($_POST);
  27. require_once ($_SERVER['DOCUMENT_ROOT']."/inc/header.php");
  28. ?>
  29. <div id="cont">
  30. <b><?php echo WEB_list_ou; ?></b><br>
  31. <form name="def" action="index.php" method="post">
  32. <table class="data">
  33. <tr align="center">
  34. <td><input type="checkbox" onClick="checkAll(this.checked);"></td>
  35. <td><b>Id</b></td>
  36. <td><b><?php echo WEB_cell_flags; ?></b></td>
  37. <td><b><?php echo WEB_cell_name; ?></b></td>
  38. <td><b><?php echo WEB_cell_dynamic; ?></b></td>
  39. <td>
  40. <input type="submit" onclick="return confirm('<?php echo WEB_msg_delete; ?>?')" name="remove" value="<?php echo WEB_btn_delete; ?>">
  41. </td>
  42. </tr>
  43. <?php
  44. $t_ou = get_records($db_link,'OU','TRUE ORDER BY ou_name');
  45. foreach ($t_ou as $row) {
  46. print "<tr align=center>\n";
  47. print "<td class=\"data\" style='padding:0'><input type=checkbox name=f_id[] value='{$row['id']}'></td>\n";
  48. print "<td class=\"data\"><input type=\"hidden\" name='r_id[]' value='{$row['id']}'>{$row['id']}</td>\n";
  49. $flag='';
  50. if ($row['default_users'] == 1) { $flag='D'; }
  51. if ($row['default_hotspot'] == 1) { $flag='H'; }
  52. print "<td class=\"data\">$flag</td>\n";
  53. print "<td class=\"data\">"; print_url($row['ou_name'],"/admin/groups/edit_group.php?id=".$row['id']); print "</td>\n";
  54. print_yes_no($row['dynamic'],'custom','data');
  55. print "<td class=\"data\"></td>\n";
  56. print "</tr>\n";
  57. }
  58. ?>
  59. </table>
  60. <div>
  61. <input type=text name=new_ou value="Unknown"></td>
  62. <input type="submit" name="create" value="<?php echo WEB_btn_add; ?>">
  63. </div>
  64. </form>
  65. <?php
  66. require_once ($_SERVER['DOCUMENT_ROOT']."/inc/footer.php");
  67. ?>