groups.php 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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["create"])) {
  5. $fname = $_POST["newgroup"];
  6. if ($fname) {
  7. $new['group_name'] = $fname;
  8. $new_id = insert_record($db_link, "Group_list", $new);
  9. header("location: editgroup.php?id=$new_id");
  10. exit;
  11. }
  12. header("Location: " . $_SERVER["REQUEST_URI"]);
  13. exit;
  14. }
  15. if (isset($_POST["remove"])) {
  16. $fgid = $_POST["fid"];
  17. foreach ($fgid as $key => $val) {
  18. if (!empty($val)) {
  19. run_sql($db_link, "DELETE FROM Group_filters WHERE group_id=" . $val * 1);
  20. delete_record($db_link, "Group_list", "id=" . $val * 1);
  21. }
  22. }
  23. header("Location: " . $_SERVER["REQUEST_URI"]);
  24. exit;
  25. }
  26. unset($_POST);
  27. require_once($_SERVER['DOCUMENT_ROOT'] . "/inc/header.php");
  28. print_filters_submenu($page_url);
  29. ?>
  30. <div id="cont">
  31. <form name="def" action="groups.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 width=200><b><?php echo WEB_cell_name; ?></b></td>
  37. <td width=200><b><?php echo WEB_cell_comment; ?></b></td>
  38. <td><input type="submit" onclick="return confirm('<?php echo WEB_msg_delete; ?>?')" name="remove" value="<?php echo WEB_btn_delete; ?>"></td>
  39. </tr>
  40. <?php
  41. $groups = get_records_sql($db_link, 'SELECT * FROM Group_list ORDER BY id');
  42. foreach ($groups as $row) {
  43. print "<tr align=center>\n";
  44. print "<td class=\"data\" style='padding:0'><input type=checkbox name=fid[] value=" . $row["id"] . "></td>\n";
  45. print "<td class=\"data\" ><input type=\"hidden\" name=\"" . $row["id"] . "\" value=" . $row["id"] . ">" . $row["id"] . "</td>\n";
  46. print "<td class=\"data\"><a href=editgroup.php?id=" . $row["id"] . ">" . $row["group_name"] . "</a></td>\n";
  47. print "<td class=\"data\">" . $row["comment"] . "</td>\n";
  48. print "<td></td></tr>";
  49. }
  50. ?>
  51. </table>
  52. <div>
  53. <?php echo WEB_cell_name; ?><input type=text name=newgroup value="Unknown">
  54. <input type="submit" name="create" value="<?php echo WEB_btn_add; ?>">
  55. </div>
  56. </form>
  57. <?php
  58. require_once($_SERVER['DOCUMENT_ROOT'] . "/inc/footer.php");
  59. ?>