index.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["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. delete_record($db_link, "OU", "id=" . $val);
  11. }
  12. }
  13. header("Location: " . $_SERVER["REQUEST_URI"]);
  14. exit;
  15. }
  16. if (isset($_POST["create"])) {
  17. $ou_name = $_POST["new_ou"];
  18. if (isset($ou_name)) {
  19. $new['ou_name'] = $ou_name;
  20. insert_record($db_link, "OU", $new);
  21. }
  22. header("Location: " . $_SERVER["REQUEST_URI"]);
  23. exit;
  24. }
  25. unset($_POST);
  26. require_once ($_SERVER['DOCUMENT_ROOT']."/inc/header.php");
  27. ?>
  28. <div id="cont">
  29. <table>
  30. <tr>
  31. <td><b><?php echo WEB_list_ou; ?></b><br>
  32. <form name="def" action="index.php" method="post">
  33. <table class="data">
  34. <tr align="center">
  35. <td><input type="checkbox" onClick="checkAll(this.checked);"></td>
  36. <td><b>Id</b></td>
  37. <td><b><?php echo WEB_cell_flags; ?></b></td>
  38. <td><b><?php echo WEB_cell_name; ?></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 "<td class=\"data\"></td>\n";
  55. print "</tr>\n";
  56. }
  57. ?>
  58. </table>
  59. <div>
  60. <input type=text name=new_ou value="Unknown"></td>
  61. <input type="submit" name="create" value="<?php echo WEB_btn_add; ?>">
  62. </div>
  63. </form>
  64. <?php
  65. require_once ($_SERVER['DOCUMENT_ROOT']."/inc/footer.php");
  66. ?>