ListBuyGroup.php 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  1. <?php
  2. define('EmpireCMSAdmin','1');
  3. require("../../class/connect.php");
  4. require("../../class/db_sql.php");
  5. require("../../class/functions.php");
  6. require "../".LoadLang("pub/fun.php");
  7. $link=db_connect();
  8. $empire=new mysqlquery();
  9. $editor=1;
  10. //验证用户
  11. $lur=is_login();
  12. $logininid=$lur['userid'];
  13. $loginin=$lur['username'];
  14. $loginrnd=$lur['rnd'];
  15. $loginlevel=$lur['groupid'];
  16. $loginadminstyleid=$lur['adminstyleid'];
  17. //ehash
  18. $ecms_hashur=hReturnEcmsHashStrAll();
  19. //验证权限
  20. CheckLevel($logininid,$loginin,$classid,"buygroup");
  21. //充值类型
  22. function ReturnBuyGroupVar($add){
  23. $add[gmoney]=(int)$add[gmoney];
  24. $add[gfen]=(int)$add[gfen];
  25. $add[gdate]=(int)$add[gdate];
  26. $add[ggroupid]=(int)$add[ggroupid];
  27. $add[gzgroupid]=(int)$add[gzgroupid];
  28. $add[buygroupid]=(int)$add[buygroupid];
  29. $add[myorder]=(int)$add[myorder];
  30. $add['gname']=hRepPostStr($add['gname'],1);
  31. $add['gsay']=hRepPostStr2($add['gsay']);
  32. return $add;
  33. }
  34. //增加充值类型
  35. function AddBuyGroup($add,$userid,$username){
  36. global $empire,$dbtbpre;
  37. //验证权限
  38. CheckLevel($userid,$username,$classid,"buygroup");
  39. $add=ReturnBuyGroupVar($add);
  40. if(!$add[gname]||!$add[gmoney])
  41. {
  42. printerror('EmptyBuyGroup','history.go(-1)');
  43. }
  44. $sql=$empire->query("insert into {$dbtbpre}enewsbuygroup(gname,gmoney,gfen,gdate,ggroupid,gzgroupid,buygroupid,gsay,myorder) values('$add[gname]','$add[gmoney]','$add[gfen]','$add[gdate]','$add[ggroupid]','$add[gzgroupid]','$add[buygroupid]','$add[gsay]','$add[myorder]');");
  45. $id=$empire->lastid();
  46. if($sql)
  47. {
  48. //操作日志
  49. insert_dolog("id=$id&gname=$add[gname]&gfen=$add[gfen]&gdate=$add[gdate]");
  50. printerror('AddBuyGroupSuccess','AddBuyGroup.php?enews=AddBuyGroup'.hReturnEcmsHashStrHref2(0));
  51. }
  52. else
  53. {
  54. printerror('DbError','');
  55. }
  56. }
  57. //修改充值类型
  58. function EditBuyGroup($add,$userid,$username){
  59. global $empire,$dbtbpre;
  60. //验证权限
  61. CheckLevel($userid,$username,$classid,"buygroup");
  62. $id=(int)$add['id'];
  63. $add=ReturnBuyGroupVar($add);
  64. if(!$id||!$add[gname]||!$add[gmoney])
  65. {
  66. printerror('EmptyBuyGroup','history.go(-1)');
  67. }
  68. $sql=$empire->query("update {$dbtbpre}enewsbuygroup set gname='$add[gname]',gmoney='$add[gmoney]',gfen='$add[gfen]',gdate='$add[gdate]',ggroupid='$add[ggroupid]',gzgroupid='$add[gzgroupid]',buygroupid='$add[buygroupid]',gsay='$add[gsay]',myorder='$add[myorder]' where id='$id'");
  69. if($sql)
  70. {
  71. //操作日志
  72. insert_dolog("id=$id&gname=$add[gname]&gfen=$add[gfen]&gdate=$add[gdate]");
  73. printerror('EditBuyGroupSuccess','ListBuyGroup.php'.hReturnEcmsHashStrHref2(1));
  74. }
  75. else
  76. {
  77. printerror('DbError','');
  78. }
  79. }
  80. //删除充值类型
  81. function DelBuyGroup($id,$userid,$username){
  82. global $empire,$dbtbpre;
  83. //验证权限
  84. CheckLevel($userid,$username,$classid,"buygroup");
  85. $id=(int)$id;
  86. if(!$id)
  87. {
  88. printerror('EmptyBuyGroupid','');
  89. }
  90. $r=$empire->fetch1("select id,gname,gfen,gdate from {$dbtbpre}enewsbuygroup where id='$id'");
  91. if(!$r[id])
  92. {
  93. printerror('EmptyBuyGroupid','');
  94. }
  95. $sql=$empire->query("delete from {$dbtbpre}enewsbuygroup where id='$id'");
  96. if($sql)
  97. {
  98. //操作日志
  99. insert_dolog("id=$id&gname=$r[gname]&gfen=$r[gfen]&gdate=$r[gdate]");
  100. printerror('DelBuyGroupSuccess','ListBuyGroup.php'.hReturnEcmsHashStrHref2(1));
  101. }
  102. else
  103. {
  104. printerror('DbError','');
  105. }
  106. }
  107. $enews=$_POST['enews'];
  108. if(empty($enews))
  109. {$enews=$_GET['enews'];}
  110. if($enews)
  111. {
  112. hCheckEcmsRHash();
  113. }
  114. if($enews=='AddBuyGroup')//增加充值类型
  115. {
  116. AddBuyGroup($_POST,$logininid,$loginin);
  117. }
  118. elseif($enews=='EditBuyGroup')//修改充值类型
  119. {
  120. EditBuyGroup($_POST,$logininid,$loginin);
  121. }
  122. elseif($enews=='DelBuyGroup')//删除充值类型
  123. {
  124. DelBuyGroup($_GET['id'],$logininid,$loginin);
  125. }
  126. $search=$ecms_hashur['ehref'];
  127. $page=(int)$_GET['page'];
  128. $page=RepPIntvar($page);
  129. $start=0;
  130. $line=25;
  131. $page_line=25;
  132. $offset=$line*$page;
  133. $totalquery="select count(*) as total from {$dbtbpre}enewsbuygroup";
  134. $num=$empire->gettotal($totalquery);
  135. $query="select id,gname,gmoney,gfen,gdate from {$dbtbpre}enewsbuygroup";
  136. $query.=" order by myorder,id limit $offset,$line";
  137. $sql=$empire->query($query);
  138. $returnpage=page2($num,$line,$page_line,$start,$page,$search);
  139. ?>
  140. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  141. <html>
  142. <head>
  143. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  144. <title>管理充值类型</title>
  145. <link href="../adminstyle/<?=$loginadminstyleid?>/adminstyle.css" rel="stylesheet" type="text/css">
  146. </head>
  147. <body>
  148. <table width="100%" border="0" align="center" cellpadding="3" cellspacing="1">
  149. <tr>
  150. <td width="50%">位置:<a href="ListBuyGroup.php<?=$ecms_hashur['whehref']?>">管理充值类型</a></td>
  151. <td><div align="right" class="emenubutton">
  152. <input type="button" name="Submit5" value="增加充值类型" onclick="self.location.href='AddBuyGroup.php?enews=AddBuyGroup<?=$ecms_hashur['ehref']?>';">
  153. </div></td>
  154. </tr>
  155. </table>
  156. <br>
  157. <table width="100%" border="0" cellpadding="0" cellspacing="1" class="tableborder">
  158. <tr class="header">
  159. <td width="6%" height="25"> <div align="center">ID</div></td>
  160. <td width="41%" height="25"> <div align="center">类型名称</div></td>
  161. <td width="15%" height="25"> <div align="center">金额(元)</div></td>
  162. <td width="11%" height="25"> <div align="center">点数</div></td>
  163. <td width="11%"><div align="center">有效期(天)</div></td>
  164. <td width="16%" height="25"> <div align="center">操作</div></td>
  165. </tr>
  166. <?
  167. while($r=$empire->fetch($sql))
  168. {
  169. ?>
  170. <tr bgcolor="#FFFFFF" onmouseout="this.style.backgroundColor='#ffffff'" onmouseover="this.style.backgroundColor='#C3EFFF'">
  171. <td height="25"> <div align="center">
  172. <?=$r[id]?>
  173. </div></td>
  174. <td height="25"> <div align="center">
  175. <?=$r[gname]?>
  176. </div></td>
  177. <td height="25"> <div align="center">
  178. <?=$r[gmoney]?>
  179. </div></td>
  180. <td height="25"> <div align="center">
  181. <?=$r[gfen]?>
  182. </div></td>
  183. <td><div align="center">
  184. <?=$r[gdate]?>
  185. </div></td>
  186. <td height="25"> <div align="center">[<a href="AddBuyGroup.php?enews=EditBuyGroup&id=<?=$r[id]?><?=$ecms_hashur['ehref']?>">修改</a>] [<a href="ListBuyGroup.php?enews=DelBuyGroup&id=<?=$r[id]?><?=$ecms_hashur['href']?>" onclick="return confirm('确认要删除?');">删除</a>]</div></td>
  187. </tr>
  188. <?
  189. }
  190. ?>
  191. <tr bgcolor="#FFFFFF">
  192. <td height="25" colspan="6"> &nbsp;&nbsp;
  193. <?=$returnpage?>
  194. <div align="left"></div></td>
  195. </tr>
  196. <tr bgcolor="#FFFFFF">
  197. <td height="25" colspan="6">前台充值地址:<a href="<?=$public_r[newsurl].'e/member/buygroup/'?>" target="_blank"><?=$public_r[newsurl].'e/member/buygroup/'?></a></td>
  198. </tr>
  199. </table>
  200. </body>
  201. </html>
  202. <?
  203. db_close();
  204. $empire=null;
  205. ?>