ListInGroup.php 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  1. <?php
  2. define('EmpireCMSAdmin','1');
  3. require("../../class/connect.php");
  4. require("../../class/db_sql.php");
  5. require("../../class/functions.php");
  6. require("../../member/class/user.php");
  7. require "../".LoadLang("pub/fun.php");
  8. $link=db_connect();
  9. $empire=new mysqlquery();
  10. $editor=1;
  11. //验证用户
  12. $lur=is_login();
  13. $logininid=$lur['userid'];
  14. $loginin=$lur['username'];
  15. $loginrnd=$lur['rnd'];
  16. $loginlevel=$lur['groupid'];
  17. $loginadminstyleid=$lur['adminstyleid'];
  18. //ehash
  19. $ecms_hashur=hReturnEcmsHashStrAll();
  20. //验证权限
  21. CheckLevel($logininid,$loginin,$classid,"ingroup");
  22. //增加会员内部组
  23. function AddInGroup($add,$userid,$username){
  24. global $empire,$dbtbpre;
  25. if(empty($add['gname']))
  26. {
  27. printerror('EmptyInGroup','history.go(-1)');
  28. }
  29. $add['gname']=hRepPostStr($add['gname'],1);
  30. $add['myorder']=(int)$add['myorder'];
  31. $sql=$empire->query("insert into {$dbtbpre}enewsingroup(gname,myorder) values('$add[gname]','$add[myorder]');");
  32. //更新缓存
  33. GetMemberLevel();
  34. if($sql)
  35. {
  36. $gid=$empire->lastid();
  37. insert_dolog("gid=$gid&gname=$add[gname]");//操作日志
  38. printerror("AddInGroupSuccess","AddInGroup.php?enews=AddInGroup".hReturnEcmsHashStrHref2(0));
  39. }
  40. else
  41. {
  42. printerror("DbError","history.go(-1)");
  43. }
  44. }
  45. //修改会员内部组
  46. function EditInGroup($add,$userid,$username){
  47. global $empire,$dbtbpre;
  48. $gid=intval($add['gid']);
  49. if(empty($add['gname'])||!$gid)
  50. {
  51. printerror('EmptyInGroup','history.go(-1)');
  52. }
  53. $add['gname']=hRepPostStr($add['gname'],1);
  54. $add['myorder']=(int)$add['myorder'];
  55. $sql=$empire->query("update {$dbtbpre}enewsingroup set gname='$add[gname]',myorder='$add[myorder]' where gid='$gid'");
  56. //更新缓存
  57. GetMemberLevel();
  58. if($sql)
  59. {
  60. insert_dolog("gid=$gid&gname=$add[gname]");//操作日志
  61. printerror("EditInGroupSuccess","ListInGroup.php".hReturnEcmsHashStrHref2(1));
  62. }
  63. else
  64. {
  65. printerror("DbError","history.go(-1)");
  66. }
  67. }
  68. //删除会员内部组
  69. function DelInGroup($add,$userid,$username){
  70. global $empire,$dbtbpre;
  71. $gid=intval($add['gid']);
  72. if(!$gid)
  73. {
  74. printerror('EmptyInGroupid','history.go(-1)');
  75. }
  76. $r=$empire->fetch1("select gid,gname from {$dbtbpre}enewsingroup where gid='$gid'");
  77. if(!$r['gid'])
  78. {
  79. printerror('EmptyInGroupid','history.go(-1)');
  80. }
  81. $sql=$empire->query("delete from {$dbtbpre}enewsingroup where gid='$gid'");
  82. //更新缓存
  83. GetMemberLevel();
  84. if($sql)
  85. {
  86. insert_dolog("gid=$gid&gname=$r[gname]");//操作日志
  87. printerror("DelInGroupSuccess","ListInGroup.php".hReturnEcmsHashStrHref2(1));
  88. }
  89. else
  90. {
  91. printerror("DbError","history.go(-1)");
  92. }
  93. }
  94. $enews=$_POST['enews'];
  95. if(empty($enews))
  96. {$enews=$_GET['enews'];}
  97. if($enews)
  98. {
  99. hCheckEcmsRHash();
  100. }
  101. if($enews=="AddInGroup")
  102. {
  103. AddInGroup($_POST,$logininid,$loginin);
  104. }
  105. elseif($enews=="EditInGroup")
  106. {
  107. EditInGroup($_POST,$logininid,$loginin);
  108. }
  109. elseif($enews=="DelInGroup")
  110. {
  111. DelInGroup($_GET,$logininid,$loginin);
  112. }
  113. $search=$ecms_hashur['ehref'];
  114. $page=(int)$_GET['page'];
  115. $page=RepPIntvar($page);
  116. $start=0;
  117. $line=16;//每页显示条数
  118. $page_line=25;//每页显示链接数
  119. $offset=$page*$line;//总偏移量
  120. $query="select * from {$dbtbpre}enewsingroup";
  121. $totalquery="select count(*) as total from {$dbtbpre}enewsingroup";
  122. $num=$empire->gettotal($totalquery);//取得总条数
  123. $query=$query." order by gid desc limit $offset,$line";
  124. $sql=$empire->query($query);
  125. $returnpage=page2($num,$line,$page_line,$start,$page,$search);
  126. ?>
  127. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  128. <html>
  129. <head>
  130. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  131. <link href="../adminstyle/<?=$loginadminstyleid?>/adminstyle.css" rel="stylesheet" type="text/css">
  132. <title>会员内部组</title>
  133. </head>
  134. <body>
  135. <table width="100%" border="0" align="center" cellpadding="3" cellspacing="1">
  136. <tr>
  137. <td width="50%" height="25">位置:<a href="ListInGroup.php<?=$ecms_hashur['whehref']?>">管理会员内部组</a></td>
  138. <td><div align="right" class="emenubutton">
  139. <input type="button" name="Submit5" value="增加会员内部组" onclick="self.location.href='AddInGroup.php?enews=AddInGroup<?=$ecms_hashur['ehref']?>';">
  140. </div></td>
  141. </tr>
  142. </table>
  143. <br>
  144. <table width="100%" border="0" align="center" cellpadding="3" cellspacing="1" class="tableborder">
  145. <tr class="header">
  146. <td width="6%" height="25"> <div align="center">ID</div></td>
  147. <td width="49%" height="25"> <div align="center">组名称</div></td>
  148. <td width="24%"><div align="center">会员数</div></td>
  149. <td width="21%" height="25"> <div align="center">操作</div></td>
  150. </tr>
  151. <?php
  152. while($r=$empire->fetch($sql))
  153. {
  154. $color="#ffffff";
  155. $movejs=' onmouseout="this.style.backgroundColor=\'#ffffff\'" onmouseover="this.style.backgroundColor=\'#C3EFFF\'"';
  156. $membernum=$empire->gettotal("select count(*) as total from ".eReturnMemberTable()." where ".egetmf('ingid')."='$r[gid]'");
  157. ?>
  158. <tr bgcolor="<?=$color?>"<?=$movejs?>>
  159. <td height="25"> <div align="center">
  160. <?=$r[gid]?>
  161. </div></td>
  162. <td height="25"> <div align="center">
  163. <?=$r[gname]?>
  164. </div></td>
  165. <td><div align="center"><a href="ListMember.php?sear=1&ingid=<?=$r['gid']?><?=$ecms_hashur['ehref']?>" target="_blank" title="点击查看列表"><?=$membernum?></a></div></td>
  166. <td height="25"> <div align="center"> [<a href="AddInGroup.php?enews=EditInGroup&gid=<?=$r[gid]?><?=$ecms_hashur['ehref']?>">修改</a>]&nbsp;[<a href="ListInGroup.php?enews=DelInGroup&gid=<?=$r[gid]?><?=$ecms_hashur['href']?>" onclick="return confirm('确认要删除?');">删除</a>]</div></td>
  167. </tr>
  168. <?
  169. }
  170. ?>
  171. <tr bgcolor="#FFFFFF">
  172. <td height="25" colspan="4">&nbsp;&nbsp;&nbsp;
  173. <?=$returnpage?> </td>
  174. </tr>
  175. </table>
  176. </body>
  177. </html>
  178. <?
  179. db_close();
  180. $empire=null;
  181. ?>