groups.php 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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)) { delete_record($db_link, "Group_list", "id=" . $val * 1); }
  19. }
  20. header("Location: " . $_SERVER["REQUEST_URI"]);
  21. exit;
  22. }
  23. unset($_POST);
  24. require_once ($_SERVER['DOCUMENT_ROOT']."/inc/header.php");
  25. print_filters_submenu($page_url);
  26. ?>
  27. <div id="cont">
  28. <form name="def" action="groups.php" method="post">
  29. <table class="data">
  30. <tr align="center">
  31. <td><input type="checkbox" onClick="checkAll(this.checked);"></td>
  32. <td><b>Id</b></td>
  33. <td width=200><b><?php echo WEB_cell_name; ?></b></td>
  34. <td width=200><b><?php echo WEB_cell_comment; ?></b></td>
  35. <td><input type="submit" onclick="return confirm('<?php echo WEB_msg_delete; ?>?')" name="remove" value="<?php echo WEB_btn_delete; ?>"></td>
  36. </tr>
  37. <?php
  38. $groups = get_records_sql($db_link,'SELECT * FROM Group_list ORDER BY id');
  39. foreach ($groups as $row) {
  40. print "<tr align=center>\n";
  41. print "<td class=\"data\" style='padding:0'><input type=checkbox name=fid[] value=".$row["id"]."></td>\n";
  42. print "<td class=\"data\" ><input type=\"hidden\" name=\"".$row["id"]."\" value=".$row["id"].">".$row["id"]."</td>\n";
  43. print "<td class=\"data\"><a href=editgroup.php?id=".$row["id"].">" . $row["group_name"] . "</a></td>\n";
  44. print "<td class=\"data\">" . $row["comment"] . "</td>\n";
  45. print "<td></td></tr>";
  46. }
  47. ?>
  48. </table>
  49. <div>
  50. <?php echo WEB_cell_name; ?><input type=text name=newgroup value="Unknown">
  51. <input type="submit" name="create" value="<?php echo WEB_btn_add; ?>">
  52. </div>
  53. </form>
  54. <?php
  55. require_once ($_SERVER['DOCUMENT_ROOT']."/inc/footer.php");
  56. ?>