ListYh.php 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  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,"yh");
  21. //返回变量处理
  22. function ReturnYhVar($add){
  23. $add['hlist']=(int)$add['hlist'];
  24. $add['qlist']=(int)$add['qlist'];
  25. $add['bqnew']=(int)$add['bqnew'];
  26. $add['bqhot']=(int)$add['bqhot'];
  27. $add['bqpl']=(int)$add['bqpl'];
  28. $add['bqgood']=(int)$add['bqgood'];
  29. $add['bqfirst']=(int)$add['bqfirst'];
  30. $add['bqdown']=(int)$add['bqdown'];
  31. $add['otherlink']=(int)$add['otherlink'];
  32. $add['qmlist']=(int)$add['qmlist'];
  33. $add['dobq']=(int)$add['dobq'];
  34. $add['dojs']=(int)$add['dojs'];
  35. $add['dosbq']=(int)$add['dosbq'];
  36. $add['rehtml']=(int)$add['rehtml'];
  37. $add['yhname']=hRepPostStr($add['yhname'],1);
  38. $add['yhtext']=hRepPostStr($add['yhtext'],1);
  39. return $add;
  40. }
  41. //增加优化方案
  42. function AddYh($add,$userid,$username){
  43. global $empire,$dbtbpre;
  44. $add=ReturnYhVar($add);
  45. if(!$add[yhname])
  46. {
  47. printerror("EmptyYhname","history.go(-1)");
  48. }
  49. //验证权限
  50. CheckLevel($userid,$username,$classid,"yh");
  51. $sql=$empire->query("insert into {$dbtbpre}enewsyh(yhname,yhtext,hlist,qlist,bqnew,bqhot,bqpl,bqgood,bqfirst,bqdown,otherlink,qmlist,dobq,dojs,dosbq,rehtml) values('$add[yhname]','$add[yhtext]','$add[hlist]','$add[qlist]','$add[bqnew]','$add[bqhot]','$add[bqpl]','$add[bqgood]','$add[bqfirst]','$add[bqdown]','$add[otherlink]','$add[qmlist]','$add[dobq]','$add[dojs]','$add[dosbq]','$add[rehtml]');");
  52. GetClass();//更新缓存
  53. if($sql)
  54. {
  55. $id=$empire->lastid();
  56. //操作日志
  57. insert_dolog("id=$id&yhname=$add[yhname]");
  58. printerror("AddYhSuccess","AddYh.php?enews=AddYh".hReturnEcmsHashStrHref2(0));
  59. }
  60. else
  61. {
  62. printerror("DbError","history.go(-1)");
  63. }
  64. }
  65. //修改优化方案
  66. function EditYh($add,$userid,$username){
  67. global $empire,$dbtbpre;
  68. $add=ReturnYhVar($add);
  69. $id=(int)$add['id'];
  70. if(!$id||!$add[yhname])
  71. {
  72. printerror("EmptyYhname","history.go(-1)");
  73. }
  74. //验证权限
  75. CheckLevel($userid,$username,$classid,"yh");
  76. $sql=$empire->query("update {$dbtbpre}enewsyh set yhname='$add[yhname]',yhtext='$add[yhtext]',hlist='$add[hlist]',qlist='$add[qlist]',bqnew='$add[bqnew]',bqhot='$add[bqhot]',bqpl='$add[bqpl]',bqgood='$add[bqgood]',bqfirst='$add[bqfirst]',bqdown='$add[bqdown]',otherlink='$add[otherlink]',qmlist='$add[qmlist]',dobq='$add[dobq]',dojs='$add[dojs]',dosbq='$add[dosbq]',rehtml='$add[rehtml]' where id='$id'");
  77. GetClass();//更新缓存
  78. if($sql)
  79. {
  80. //操作日志
  81. insert_dolog("id=$id&yhname=$add[yhname]");
  82. printerror("EditYhSuccess","ListYh.php".hReturnEcmsHashStrHref2(1));
  83. }
  84. else
  85. {
  86. printerror("DbError","history.go(-1)");
  87. }
  88. }
  89. //删除优化方案
  90. function DelYh($id,$userid,$username){
  91. global $empire,$dbtbpre;
  92. $id=(int)$id;
  93. if(!$id)
  94. {
  95. printerror("NotChangeYhid","history.go(-1)");
  96. }
  97. //验证权限
  98. CheckLevel($userid,$username,$classid,"yh");
  99. $r=$empire->fetch1("select yhname from {$dbtbpre}enewsyh where id='$id'");
  100. $sql=$empire->query("delete from {$dbtbpre}enewsyh where id='$id'");
  101. GetClass();//更新缓存
  102. if($sql)
  103. {
  104. //操作日志
  105. insert_dolog("id=$id&yhname=$r[yhname]");
  106. printerror("DelYhSuccess","ListYh.php".hReturnEcmsHashStrHref2(1));
  107. }
  108. else
  109. {
  110. printerror("DbError","history.go(-1)");
  111. }
  112. }
  113. $enews=$_POST['enews'];
  114. if(empty($enews))
  115. {$enews=$_GET['enews'];}
  116. if($enews)
  117. {
  118. hCheckEcmsRHash();
  119. }
  120. if($enews=="AddYh")
  121. {
  122. AddYh($_POST,$logininid,$loginin);
  123. }
  124. elseif($enews=="EditYh")
  125. {
  126. EditYh($_POST,$logininid,$loginin);
  127. }
  128. elseif($enews=="DelYh")
  129. {
  130. $id=$_GET['id'];
  131. DelYh($id,$logininid,$loginin);
  132. }
  133. else
  134. {}
  135. $search=$ecms_hashur['ehref'];
  136. $page=(int)$_GET['page'];
  137. $page=RepPIntvar($page);
  138. $start=0;
  139. $line=20;//每页显示条数
  140. $page_line=20;//每页显示链接数
  141. $offset=$page*$line;//总偏移量
  142. $query="select id,yhname from {$dbtbpre}enewsyh";
  143. $totalquery="select count(*) as total from {$dbtbpre}enewsyh";
  144. $num=$empire->gettotal($totalquery);//取得总条数
  145. $query=$query." order by id desc limit $offset,$line";
  146. $sql=$empire->query($query);
  147. $returnpage=page2($num,$line,$page_line,$start,$page,$search);
  148. ?>
  149. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  150. <html>
  151. <head>
  152. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  153. <link href="../adminstyle/<?=$loginadminstyleid?>/adminstyle.css" rel="stylesheet" type="text/css">
  154. <title>优化方案</title>
  155. </head>
  156. <body>
  157. <table width="100%" border="0" align="center" cellpadding="3" cellspacing="1">
  158. <tr>
  159. <td width="50%" height="25">位置:<a href=ListYh.php<?=$ecms_hashur['whehref']?>>管理优化方案</a></td>
  160. <td><div align="right" class="emenubutton">
  161. <input type="button" name="Submit" value="增加优化方案" onclick="self.location.href='AddYh.php?enews=AddYh<?=$ecms_hashur['ehref']?>';">
  162. </div></td>
  163. </tr>
  164. </table>
  165. <br>
  166. <table width="100%" border="0" align="center" cellpadding="3" cellspacing="1" class="tableborder">
  167. <tr class="header">
  168. <td width="16%" height="25"> <div align="center">ID</div></td>
  169. <td width="51%" height="25"> <div align="center">方案名称</div></td>
  170. <td width="33%" height="25"> <div align="center">操作</div></td>
  171. </tr>
  172. <?
  173. while($r=$empire->fetch($sql))
  174. {
  175. ?>
  176. <tr bgcolor="#FFFFFF" onmouseout="this.style.backgroundColor='#ffffff'" onmouseover="this.style.backgroundColor='#C3EFFF'">
  177. <td height="25"> <div align="center">
  178. <?=$r[id]?>
  179. </div></td>
  180. <td height="25"> <div align="center">
  181. <?=$r[yhname]?>
  182. </div></td>
  183. <td height="25"> <div align="center">[<a href="AddYh.php?enews=EditYh&id=<?=$r[id]?><?=$ecms_hashur['ehref']?>">修改</a>]&nbsp;[<a href="AddYh.php?enews=AddYh&docopy=1&id=<?=$r[id]?><?=$ecms_hashur['ehref']?>">复制</a>]&nbsp;[<a href="ListYh.php?enews=DelYh&id=<?=$r[id]?><?=$ecms_hashur['href']?>" onclick="return confirm('确认要删除?');">删除</a>]</div></td>
  184. </tr>
  185. <?
  186. }
  187. ?>
  188. <tr bgcolor="#FFFFFF">
  189. <td height="25" colspan="3">&nbsp;&nbsp;&nbsp;
  190. <?=$returnpage?>
  191. </td>
  192. </tr>
  193. </table>
  194. </body>
  195. </html>
  196. <?
  197. db_close();
  198. $empire=null;
  199. ?>