📄 group_mgt.php
字号:
<?php/* * ITMS ValleyData source file version 1.0 May 11, 2001 * * Enables an ITMS administrator to Create, Edit, or Delete Groups * * * Internet Task Management System: An online system used for recording information about and assigning tasks and processes. * Copyright (C) 2001 ValleyData Programming Group * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * See file named "gpl.txt" included with source code or * visit http://www.gnu.org/copyleft/gpl.txt on the internet. */$title="Group Management";include("header.php");include("adminonly.php");if($ADD_GROUP == "true") //if the user hit the "add group" button{ $newgroupname = trim(make_clean($newgroupname)); if($newgroupname != "") { db_open(); db_use(); $query = "SELECT * FROM groups WHERE groupname like '$newgroupname'"; if(!isset($newgroupname) || $newgroupname == "") { message_box("Please Enter a Group Name", "error"); } else if(db_fetch_row(db_query($query))) { message_box("Duplicate name found", "error"); error_out("Couldn't add group with duplicate name: " . $newgroupname, "LOG_INFO"); } else { $query = "INSERT INTO groups (groupname) VALUES ('$newgroupname')"; if(db_query($query)) //add group { $query = "SELECT gid FROM groups WHERE groupname LIKE '$newgroupname'"; $result = db_query($query); $row = db_fetch_row($result); $group_num = $row["GID"]; foreach($HTTP_POST_VARS as $comboname => $value) { if(substr($comboname, 0, 2) == "cb") { $user_num = substr($comboname, 2); $query = "INSERT into user_groups (gid, user_id) VALUES ('$group_num', '$user_num')"; db_query($query); //add each checked user to the group } } message_box("$newgroupname group created.", "info"); } else { error_out("Could not add group to: group table", "LOG_INFO"); } }//end else not duplicate }//end blank name else { message_box("Name cannot be blank. Group was not created.<br>\n", "error"); }}print("<IMG SRC=\"images/group_mgt.jpg\" WIDTH=\"400\" HEIGHT=\"41\" BORDER=\"0\" ALT=\"Group Management\">");?><table border="0"><tr class="table-header"><td> <form METHOD=POST action="group_mgt.php"> <table> <tr> <td>Create Group:</td> </tr> <tr> <td>Group name:<INPUT TYPE="text" NAME="newgroupname" size="20"></td> </tr> <tr> <td>Users in Group:</td> <tr> <td> <table> <?php $col_num = 0; $users = get_all_users(); foreach($users as $user) { $col_num++; if($col_num == 1) print("<tr>\n"); print("<td>\n"); print("<INPUT TYPE=\"checkbox\" NAME=\"cb" . $user["USER_ID"] . "\"> " . $user["NAME"] . "<br>\n"); //***Caps Updated*** print("</td>\n"); if($col_num == 4) { print("</tr>\n"); $col_num = 0; } } ?> </table> </td> </tr> <tr> <td><INPUT TYPE="hidden" NAME="ADD_GROUP" VALUE="true"> <INPUT TYPE="submit" value="Add Group"> <INPUT TYPE="button" value="Cancel" onClick="location='index.php'"> </td> </tr> </table> </form></td></tr><tr> <td> <hr> </td></tr><tr class="table-header"><td> <form METHOD=POST action="group_edit.php"> <table> <tr> <td>Edit Group:</td> </tr> <tr> <td>Group Name:</td> <td><SELECT NAME="edit_group"> <?php $group_array = get_all_groups(); if($group_array) foreach ($group_array as $group) { print("<option value=\"" . $group["GID"] . "\">" . $group["GROUPNAME"] . "</option>\n"); //***Caps Updated*** } ?> </SELECT></td> </tr> <tr> <td colspan="2"><INPUT TYPE="submit" value="Edit Group"> <INPUT TYPE="button" value="Cancel" onClick="location='index.php'"> </td> </tr> </table> </form></td></tr><tr> <td> <hr> </td></tr><tr class="table-header"><td> <form METHOD=POST action="group_delete.php"> <table> <tr> <td>Delete Group:</td> </tr> <tr> <td>Group Name:</td> <td> <SELECT NAME="delete_group"> <?php $group_array = get_all_groups(); if($group_array) foreach ($group_array as $group) { print("<option value=\"" . $group["GID"] . "\">" . $group["GROUPNAME"] . "</option>\n"); //***Caps Updated*** } ?> </SELECT> </td> </tr> <tr> <td colspan="2"> <INPUT TYPE="submit" value="Delete Group"> <INPUT TYPE="button" value="Cancel" onClick="location='index.php'"> </td> </tr> </table> </form></td></tr></table><?php include("footer.php"); ?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -