관리-도구
편집 파일: memberGrouping.php
<?php include("../connect.php"); if ($_GET['baseTask'] == 'DeleteGroup') { $sql = "select grpname from memgroup where id='".$_GET['memberGrpID']."'"; $res = mysql_query($sql); $row = mysql_fetch_row($res); $sql = "delete from memgroup where grpname = '".$row[0]."'"; $res = mysql_query($sql); header("location:membergrpList.php?type=Delete&actionmessage=Member Group Deleted Successfully."); } if ($_GET['baseTask'] == 'EditGroup') { $sql = "select grpname,grpdesc from memgroup where id='".$_GET['memberGrpID']."'"; $res = mysql_query($sql); $row = mysql_fetch_row($res); $grpName = $row[0]; $grpDesc = $row[1]; $sql = "select * from member order by firstname, lastname"; $res = mysql_query($sql); } if ($_GET['baseTask'] == 'CreateGroup') { $sql = "select * from member order by firstname, lastname"; $res = mysql_query($sql); } if (($_POST['Submit']) && ($_POST['action'] == 'CreateGroup')) { $sql = "select id from member order by firstname, lastname"; $res=mysql_query($sql); $insertsql=""; while ($row = mysql_fetch_row($res)) { $chkname = 'chk' . $row[0]; if ($_POST[$chkname] == 'Y') $insertsql = "insert into memgroup values ('','".$_POST['txtgrpname']."','".$_POST['txtgrpdesc']."','".$row[0]."')"; $res1 = mysql_query($insertsql); } header("location:membergrpList.php?type=Add&actionmessage=Member Group Created Successfully."); } if (($_POST['Submit']) && ($_POST['action'] == 'EditGroup')) { $sql = "delete from memgroup where grpname='".$_POST['grpName']."'"; $res=mysql_query($sql); $sql = "select id from member order by firstname, lastname"; $res=mysql_query($sql); $insertsql=""; while ($row = mysql_fetch_row($res)) { $chkname = 'chk' . $row[0]; if ($_POST[$chkname] == 'Y') $insertsql = "insert into memgroup values ('','".$_POST['txtgrpname']."','".$_POST['txtgrpdesc']."','".$row[0]."')"; $res1 = mysql_query($insertsql); } header("location:membergrpList.php?type=Add&actionmessage=Member Group Modified Successfully."); } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Untitled Document</title> <style type="text/css"> <!-- .style5 {font-family: Arial, Helvetica, sans-serif; font-size: 13px; } .style6 { font-family: Arial, Helvetica, sans-serif; font-weight: bold; } .style7 {font-family: Arial, Helvetica, sans-serif; font-size: 13px; font-weight: bold; } --> </style> </head> <body> <form id="frmGrpMember" name="frmGrpMember" method="post" action="memberGrouping.php"> <input name="action" type="hidden" id="action" value="<?php echo $_GET['baseTask']; ?>" /> <input name="grpName" type="hidden" id="grpName" value="<?php echo $grpName; ?>" /> <table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#333333"> <tr> <td><table width="100%" border="0" cellspacing="1" cellpadding="4"> <tr> <td height="40" colspan="2" align="left" valign="middle" bgcolor="#FFFFFF"><span class="style6">Each1 Bless1 -> Members List</span> </td> </tr> <tr> <td width="50%" align="right" valign="top" bgcolor="#FFFFFF"><span class="style5">Enter Member Group Name : </span></td> <td width="50%" bgcolor="#FFFFFF"><input name="txtgrpname" type="text" id="txtgrpname" value="<?php echo $grpName; ?>" /></td> </tr> <tr> <td width="50%" align="right" valign="top" bgcolor="#FFFFFF"><span class="style5">Enter Member Group Description : </span></td> <td width="50%" bgcolor="#FFFFFF"><input name="txtgrpdesc" type="text" id="txtgrpdesc" value="<?php echo $grpDesc; ?>" size="50" /></td> </tr> <tr> <td colspan="2" bgcolor="#FFFFFF"><table width="100%" border="0" cellspacing="2" cellpadding="4"> <tr> <td width="6%" align="left" valign="middle" class="style5"> </td> <td width="94%" align="left" valign="middle" class="style7">Select Members which will be added to this Group. </td> </tr> <? while ($row = mysql_fetch_row($res)) { $sql1 = "select * from memgroup where grpname = '".$grpName."' and memberid='".$row[0]."'"; $res1 = mysql_query($sql1); ?> <tr> <td align="left" valign="middle" class="style5"> </td> <td align="left" valign="middle" class="style5"> <input name="chk<?php echo $row[0]; ?>" type="checkbox" value="Y" <?php if (mysql_num_rows($res1) > 0) {?> checked="checked" <?php } ?> /> <?php echo $row[1] . " " . $row[2]; ?> </td> </tr> <?php } ?> </table></td> </tr> <tr> <td colspan="2" bgcolor="#FFFFFF"><div align="center"> <input type="submit" name="Submit" value="Process Member Grouping" /> </div></td> </tr> </table></td> </tr> </table> </form> </body> </html>