ListPayfs.php 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  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,"shoppayfs");
  21. //增加支付方式
  22. function AddPayfs($add,$userid,$username){
  23. global $empire,$dbtbpre;
  24. if(empty($add[payname]))
  25. {
  26. printerror("EmptyPayname","history.go(-1)");
  27. }
  28. //验证权限
  29. CheckLevel($userid,$username,$classid,"shoppayfs");
  30. $add[userpay]=(int)$add[userpay];
  31. $add[userfen]=(int)$add[userfen];
  32. $add['isclose']=(int)$add['isclose'];
  33. $add['payname']=ehtmlspecialchars($add['payname']);
  34. $sql=$empire->query("insert into {$dbtbpre}enewsshoppayfs(payname,payurl,paysay,userpay,userfen,isclose) values('".eaddslashes($add[payname])."','".eaddslashes($add[payurl])."','".eaddslashes($add[paysay])."','$add[userpay]','$add[userfen]','$add[isclose]');");
  35. $payid=$empire->lastid();
  36. if($sql)
  37. {
  38. //操作日志
  39. insert_dolog("payid=".$payid."<br>payname=".$add[payname]);
  40. printerror("AddPayfsSuccess","AddPayfs.php?enews=AddPayfs".hReturnEcmsHashStrHref2(0));
  41. }
  42. else
  43. {
  44. printerror("DbError","history.go(-1)");
  45. }
  46. }
  47. //修改支付方式
  48. function EditPayfs($add,$userid,$username){
  49. global $empire,$dbtbpre;
  50. $add[payid]=(int)$add[payid];
  51. if(empty($add[payname])||!$add[payid])
  52. {
  53. printerror("EmptyPayname","history.go(-1)");
  54. }
  55. //验证权限
  56. CheckLevel($userid,$username,$classid,"shoppayfs");
  57. $add[userpay]=(int)$add[userpay];
  58. $add[userfen]=(int)$add[userfen];
  59. $add['isclose']=(int)$add['isclose'];
  60. $add['payname']=ehtmlspecialchars($add['payname']);
  61. $sql=$empire->query("update {$dbtbpre}enewsshoppayfs set payname='".eaddslashes($add[payname])."',payurl='".eaddslashes($add[payurl])."',paysay='".eaddslashes($add[paysay])."',userpay='$add[userpay]',userfen='$add[userfen]',isclose='$add[isclose]' where payid='$add[payid]'");
  62. if($sql)
  63. {
  64. //操作日志
  65. insert_dolog("payid=".$add[payid]."<br>payname=".$add[payname]);
  66. printerror("EditPayfsSuccess","ListPayfs.php".hReturnEcmsHashStrHref2(1));
  67. }
  68. else
  69. {
  70. printerror("DbError","history.go(-1)");
  71. }
  72. }
  73. //删除支付方式
  74. function DelPayfs($payid,$userid,$username){
  75. global $empire,$dbtbpre;
  76. $payid=(int)$payid;
  77. if(!$payid)
  78. {
  79. printerror("EmptyPayfsid","history.go(-1)");
  80. }
  81. //验证权限
  82. CheckLevel($userid,$username,$classid,"shoppayfs");
  83. $r=$empire->fetch1("select payname from {$dbtbpre}enewsshoppayfs where payid='$payid'");
  84. $sql=$empire->query("delete from {$dbtbpre}enewsshoppayfs where payid='$payid'");
  85. if($sql)
  86. {
  87. //操作日志
  88. insert_dolog("payid=".$payid."<br>payname=".$r[payname]);
  89. printerror("DelPayfsSuccess","ListPayfs.php".hReturnEcmsHashStrHref2(1));
  90. }
  91. else
  92. {
  93. printerror("DbError","history.go(-1)");
  94. }
  95. }
  96. //设置为默认支付方式
  97. function DefPayfs($payid,$userid,$username){
  98. global $empire,$dbtbpre;
  99. $payid=(int)$payid;
  100. if(!$payid)
  101. {
  102. printerror("EmptyPayfsid","history.go(-1)");
  103. }
  104. //验证权限
  105. CheckLevel($userid,$username,$classid,"shoppayfs");
  106. $r=$empire->fetch1("select payname from {$dbtbpre}enewsshoppayfs where payid='$payid'");
  107. $upsql=$empire->query("update {$dbtbpre}enewsshoppayfs set isdefault=0");
  108. $sql=$empire->query("update {$dbtbpre}enewsshoppayfs set isdefault=1 where payid='$payid'");
  109. if($sql)
  110. {
  111. //操作日志
  112. insert_dolog("payid=".$payid."<br>payname=".$r[payname]);
  113. printerror("DefPayfsSuccess","ListPayfs.php".hReturnEcmsHashStrHref2(1));
  114. }
  115. else
  116. {
  117. printerror("DbError","history.go(-1)");
  118. }
  119. }
  120. $enews=$_POST['enews'];
  121. if(empty($enews))
  122. {$enews=$_GET['enews'];}
  123. if($enews)
  124. {
  125. hCheckEcmsRHash();
  126. }
  127. if($enews=="AddPayfs")
  128. {
  129. AddPayfs($_POST,$logininid,$loginin);
  130. }
  131. elseif($enews=="EditPayfs")
  132. {
  133. EditPayfs($_POST,$logininid,$loginin);
  134. }
  135. elseif($enews=="DelPayfs")
  136. {
  137. $payid=$_GET['payid'];
  138. DelPayfs($payid,$logininid,$loginin);
  139. }
  140. elseif($enews=="DefPayfs")
  141. {
  142. $payid=$_GET['payid'];
  143. DefPayfs($payid,$logininid,$loginin);
  144. }
  145. else
  146. {}
  147. $search=$ecms_hashur['ehref'];
  148. $page=(int)$_GET['page'];
  149. $page=RepPIntvar($page);
  150. $start=0;
  151. $line=16;//每页显示条数
  152. $page_line=18;//每页显示链接数
  153. $offset=$page*$line;//总偏移量
  154. $query="select * from {$dbtbpre}enewsshoppayfs";
  155. $num=$empire->num($query);//取得总条数
  156. $query=$query." order by payid limit $offset,$line";
  157. $sql=$empire->query($query);
  158. $returnpage=page2($num,$line,$page_line,$start,$page,$search);
  159. ?>
  160. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  161. <html>
  162. <head>
  163. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  164. <link href="../adminstyle/<?=$loginadminstyleid?>/adminstyle.css" rel="stylesheet" type="text/css">
  165. <title>管理支付方式</title>
  166. </head>
  167. <body>
  168. <table width="100%" border="0" align="center" cellpadding="3" cellspacing="1">
  169. <tr>
  170. <td width="50%" height="25">位置:<a href="ListPayfs.php<?=$ecms_hashur['whehref']?>">管理支付方式</a>&nbsp;&nbsp;&nbsp;
  171. </td>
  172. <td><div align="right" class="emenubutton">
  173. <input type="button" name="Submit" value="增加支付方式" onclick="self.location.href='AddPayfs.php?enews=AddPayfs<?=$ecms_hashur['ehref']?>'">
  174. </div></td>
  175. </tr>
  176. </table>
  177. <br>
  178. <table width="100%" border="0" align="center" cellpadding="3" cellspacing="1" class="tableborder">
  179. <tr class="header">
  180. <td width="5%" height="25"> <div align="center">ID</div></td>
  181. <td width="41%" height="25"> <div align="center">支付方式</div></td>
  182. <td width="16%"><div align="center">默认</div></td>
  183. <td width="16%"><div align="center">开启</div></td>
  184. <td width="22%" height="25"> <div align="center">操作</div></td>
  185. </tr>
  186. <?
  187. while($r=$empire->fetch($sql))
  188. {
  189. ?>
  190. <tr bgcolor="#FFFFFF" onmouseout="this.style.backgroundColor='#ffffff'" onmouseover="this.style.backgroundColor='#C3EFFF'">
  191. <td height="25"> <div align="center">
  192. <?=$r[payid]?>
  193. </div></td>
  194. <td height="25"> <div align="center">
  195. <?=$r[payname]?>
  196. </div></td>
  197. <td><div align="center"><?=$r[isdefault]==1?'是':'--'?></div></td>
  198. <td><div align="center"><?=$r[isclose]==1?'关闭':'开启'?></div></td>
  199. <td height="25"> <div align="center">[<a href="AddPayfs.php?enews=EditPayfs&payid=<?=$r[payid]?><?=$ecms_hashur['ehref']?>">修改</a>] [<a href="ListPayfs.php?enews=DefPayfs&payid=<?=$r[payid]?><?=$ecms_hashur['href']?>">设为默认</a>] [<a href="ListPayfs.php?enews=DelPayfs&payid=<?=$r[payid]?><?=$ecms_hashur['href']?>" onclick="return confirm('确认要删除?');">删除</a>]</div></td>
  200. </tr>
  201. <?
  202. }
  203. ?>
  204. <tr bgcolor="#FFFFFF">
  205. <td height="25" colspan="5">&nbsp;&nbsp;&nbsp;
  206. <?=$returnpage?> </td>
  207. </tr>
  208. </table>
  209. </body>
  210. </html>
  211. <?
  212. db_close();
  213. $empire=null;
  214. ?>