1
0

index.php 2.3 KB

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