1
0

index.php 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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>
  39. <input type="submit" onclick="return confirm('<?php echo WEB_msg_delete; ?>?')" name="remove" value="<?php echo WEB_btn_delete; ?>">
  40. </td>
  41. </tr>
  42. <?php
  43. $t_ou = get_records($db_link,'OU','TRUE ORDER BY ou_name');
  44. foreach ($t_ou as $row) {
  45. print "<tr align=center>\n";
  46. print "<td class=\"data\" style='padding:0'><input type=checkbox name=f_id[] value='{$row['id']}'></td>\n";
  47. print "<td class=\"data\"><input type=\"hidden\" name='r_id[]' value='{$row['id']}'>{$row['id']}</td>\n";
  48. $flag='';
  49. if ($row['default_users'] == 1) { $flag='D'; }
  50. if ($row['default_hotspot'] == 1) { $flag='H'; }
  51. print "<td class=\"data\">$flag</td>\n";
  52. print "<td class=\"data\">"; print_url($row['ou_name'],"/admin/groups/edit_group.php?id=".$row['id']); print "</td>\n";
  53. print "<td class=\"data\"></td>\n";
  54. print "</tr>\n";
  55. }
  56. ?>
  57. </table>
  58. <div>
  59. <input type=text name=new_ou value="Unknown"></td>
  60. <input type="submit" name="create" value="<?php echo WEB_btn_add; ?>">
  61. </div>
  62. </form>
  63. <?php
  64. require_once ($_SERVER['DOCUMENT_ROOT']."/inc/footer.php");
  65. ?>