KeyClass.php 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. <?php
  2. define('EmpireCMSAdmin','1');
  3. require("../../class/connect.php");
  4. require("../../class/db_sql.php");
  5. require("../../class/functions.php");
  6. $link=db_connect();
  7. $empire=new mysqlquery();
  8. $editor=1;
  9. //验证用户
  10. $lur=is_login();
  11. $logininid=$lur['userid'];
  12. $loginin=$lur['username'];
  13. $loginrnd=$lur['rnd'];
  14. $loginlevel=$lur['groupid'];
  15. $loginadminstyleid=$lur['adminstyleid'];
  16. //ehash
  17. $ecms_hashur=hReturnEcmsHashStrAll();
  18. //验证权限
  19. CheckLevel($logininid,$loginin,$classid,"key");
  20. //增加内容关键字分类
  21. function AddKeyClass($classname,$userid,$username){
  22. global $empire,$dbtbpre;
  23. if(!$classname)
  24. {
  25. printerror("EmptyKeyClass","history.go(-1)");
  26. }
  27. //验证权限
  28. CheckLevel($userid,$username,$classid,"key");
  29. $classname=hRepPostStr($classname,1);
  30. $sql=$empire->query("insert into {$dbtbpre}enewskeyclass(classname) values('$classname');");
  31. $classid=$empire->lastid();
  32. if($sql)
  33. {
  34. //操作日志
  35. insert_dolog("classid=".$classid."<br>classname=".$classname);
  36. printerror("AddKeyClassSuccess","KeyClass.php".hReturnEcmsHashStrHref2(1));
  37. }
  38. else
  39. {printerror("DbError","history.go(-1)");}
  40. }
  41. //修改内容关键字分类
  42. function EditKeyClass($classid,$classname,$userid,$username){
  43. global $empire,$dbtbpre;
  44. $classid=(int)$classid;
  45. if(!$classname||!$classid)
  46. {
  47. printerror("EmptyKeyClass","history.go(-1)");
  48. }
  49. //验证权限
  50. CheckLevel($userid,$username,$classid,"key");
  51. $classname=hRepPostStr($classname,1);
  52. $sql=$empire->query("update {$dbtbpre}enewskeyclass set classname='$classname' where classid='$classid'");
  53. if($sql)
  54. {
  55. //操作日志
  56. insert_dolog("classid=".$classid."<br>classname=".$classname);
  57. printerror("EditKeyClassSuccess","KeyClass.php".hReturnEcmsHashStrHref2(1));
  58. }
  59. else
  60. {printerror("DbError","history.go(-1)");}
  61. }
  62. //删除内容关键字分类
  63. function DelKeyClass($classid,$userid,$username){
  64. global $empire,$dbtbpre;
  65. $classid=(int)$classid;
  66. if(!$classid)
  67. {
  68. printerror("NotKeyClassid","history.go(-1)");
  69. }
  70. //验证权限
  71. CheckLevel($userid,$username,$classid,"key");
  72. $r=$empire->fetch1("select classname from {$dbtbpre}enewskeyclass where classid='$classid'");
  73. $sql=$empire->query("delete from {$dbtbpre}enewskeyclass where classid='$classid'");
  74. $sql1=$empire->query("update {$dbtbpre}enewskey set cid=0 where cid='$classid'");
  75. if($sql)
  76. {
  77. //操作日志
  78. insert_dolog("classid=".$classid."<br>classname=".$r[classname]);
  79. printerror("DelKeyClassSuccess","KeyClass.php".hReturnEcmsHashStrHref2(1));
  80. }
  81. else
  82. {printerror("DbError","history.go(-1)");}
  83. }
  84. $enews=$_POST['enews'];
  85. if(empty($enews))
  86. {$enews=$_GET['enews'];}
  87. if($enews)
  88. {
  89. hCheckEcmsRHash();
  90. }
  91. //增加内容关键字分类
  92. if($enews=="AddKeyClass")
  93. {
  94. $classname=$_POST['classname'];
  95. AddKeyClass($classname,$logininid,$loginin);
  96. }
  97. //修改内容关键字分类
  98. elseif($enews=="EditKeyClass")
  99. {
  100. $classname=$_POST['classname'];
  101. $classid=$_POST['classid'];
  102. EditKeyClass($classid,$classname,$logininid,$loginin);
  103. }
  104. //删除内容关键字分类
  105. elseif($enews=="DelKeyClass")
  106. {
  107. $classid=$_GET['classid'];
  108. DelKeyClass($classid,$logininid,$loginin);
  109. }
  110. $sql=$empire->query("select classid,classname from {$dbtbpre}enewskeyclass order by classid desc");
  111. ?>
  112. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  113. <html>
  114. <head>
  115. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  116. <title>管理内容关键字分类</title>
  117. <link href="../adminstyle/<?=$loginadminstyleid?>/adminstyle.css" rel="stylesheet" type="text/css">
  118. </head>
  119. <body>
  120. <table width="100%" border="0" align="center" cellpadding="3" cellspacing="1">
  121. <tr>
  122. <td>位置:<a href=key.php<?=$ecms_hashur['whehref']?>>管理内容关键字</a>&nbsp;&gt;&nbsp;<a href="KeyClass.php<?=$ecms_hashur['whehref']?>">管理内容关键字分类</a></td>
  123. </tr>
  124. </table>
  125. <form name="form1" method="post" action="KeyClass.php">
  126. <input type=hidden name=enews value=AddKeyClass>
  127. <table width="100%" border="0" align="center" cellpadding="3" cellspacing="1" class="tableborder">
  128. <?=$ecms_hashur['form']?>
  129. <tr class="header">
  130. <td height="25">增加内容关键字分类:</td>
  131. </tr>
  132. <tr>
  133. <td height="25" bgcolor="#FFFFFF"> 分类名称:
  134. <input name="classname" type="text" id="classname">
  135. <input type="submit" name="Submit" value="增加">
  136. <input type="reset" name="Submit2" value="重置"></td>
  137. </tr>
  138. </table>
  139. </form>
  140. <table width="100%" border="0" align="center" cellpadding="3" cellspacing="1" class="tableborder">
  141. <tr class="header">
  142. <td width="10%"><div align="center">ID</div></td>
  143. <td width="59%" height="25"><div align="center">分类名称</div></td>
  144. <td width="31%" height="25"><div align="center">操作</div></td>
  145. </tr>
  146. <?
  147. while($r=$empire->fetch($sql))
  148. {
  149. ?>
  150. <form name=form2 method=post action=KeyClass.php>
  151. <?=$ecms_hashur['form']?>
  152. <input type=hidden name=enews value=EditKeyClass>
  153. <input type=hidden name=classid value=<?=$r[classid]?>>
  154. <tr bgcolor="#FFFFFF" onmouseout="this.style.backgroundColor='#ffffff'" onmouseover="this.style.backgroundColor='#C3EFFF'">
  155. <td><div align="center"><?=$r[classid]?></div></td>
  156. <td height="25"> <div align="center">
  157. <input name="classname" type="text" id="classname" value="<?=$r[classname]?>">
  158. </div></td>
  159. <td height="25"><div align="center">
  160. <input type="submit" name="Submit3" value="修改">
  161. &nbsp;
  162. <input type="button" name="Submit4" value="删除" onclick="if(confirm('确认要删除?')){self.location.href='KeyClass.php?enews=DelKeyClass&classid=<?=$r[classid]?><?=$ecms_hashur['href']?>';}">
  163. </div></td>
  164. </tr>
  165. </form>
  166. <?
  167. }
  168. db_close();
  169. $empire=null;
  170. ?>
  171. </table>
  172. </body>
  173. </html>