SetDigg.php 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  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,"public");
  20. //设置DIGG参数
  21. function eSetDigg($add,$userid,$username){
  22. global $empire,$dbtbpre;
  23. CheckLevel($userid,$username,$classid,"public");//验证权限
  24. $add['digglevel']=(int)$add['digglevel'];
  25. $diggcmids=eReturnSetGroups($add['cmid']);
  26. $diggcmids=hRepPostStr($diggcmids,1);
  27. $sql=$empire->query("update {$dbtbpre}enewspublicadd set digglevel='$add[digglevel]',diggcmids='$diggcmids' limit 1");
  28. if($sql)
  29. {
  30. GetConfig();
  31. //操作日志
  32. insert_dolog("");
  33. printerror("SetDiggSuccess","SetDigg.php".hReturnEcmsHashStrHref2(1));
  34. }
  35. else
  36. {printerror("DbError","history.go(-1)");}
  37. }
  38. //清空DIGG记录
  39. function eClearDiggRecord($add,$userid,$username){
  40. global $empire,$dbtbpre,$ecms_config,$public_r;
  41. //DIGG记录表
  42. $empire->query("TRUNCATE `{$dbtbpre}enewsdiggips`;");
  43. //操作日志
  44. insert_dolog("");
  45. printerror("ClearDiggRecordSuccess",EcmsGetReturnUrl());
  46. }
  47. $enews=$_POST['enews'];
  48. if(empty($enews))
  49. {$enews=$_GET['enews'];}
  50. if($enews)
  51. {
  52. hCheckEcmsRHash();
  53. }
  54. if($enews=="SetDigg")//设置参数
  55. {
  56. eSetDigg($_POST,$logininid,$loginin);
  57. }
  58. elseif($enews=="ClearDiggRecord")//清空记录
  59. {
  60. @set_time_limit(1000);
  61. eClearDiggRecord($_GET,$logininid,$loginin);
  62. }
  63. else
  64. {}
  65. $r=$empire->fetch1("select * from {$dbtbpre}enewspublicadd limit 1");
  66. //系统模型
  67. $mids='';
  68. $i=0;
  69. $modsql=$empire->query("select mid,mname from {$dbtbpre}enewsmod order by myorder,mid");
  70. while($modr=$empire->fetch($modsql))
  71. {
  72. $i++;
  73. if($i%4==0)
  74. {
  75. $br="<br>";
  76. }
  77. else
  78. {
  79. $br="";
  80. }
  81. $select='';
  82. if(strstr($r['diggcmids'],','.$modr['mid'].','))
  83. {
  84. $select=' checked';
  85. }
  86. $mids.="<input type=checkbox name=cmid[] value='$modr[mid]'".$select.">$modr[mname]&nbsp;&nbsp;".$br;
  87. }
  88. db_close();
  89. $empire=null;
  90. ?>
  91. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  92. <html>
  93. <head>
  94. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  95. <title>DIGG顶参数设置</title>
  96. <link href="../adminstyle/<?=$loginadminstyleid?>/adminstyle.css" rel="stylesheet" type="text/css">
  97. <script type="text/javascript" src="../ecmseditor/js/jstime/WdatePicker.js"></script>
  98. </head>
  99. <body>
  100. <table width="100%" border="0" align="center" cellpadding="3" cellspacing="1">
  101. <tr>
  102. <td><p>位置:<a href="SetDigg.php<?=$ecms_hashur['whehref']?>">DIGG顶参数设置</a></p>
  103. </td>
  104. </tr>
  105. </table>
  106. <form name="setpublic" method="post" action="SetDigg.php" onsubmit="return confirm('确认设置?');">
  107. <table width="100%" border="0" align="center" cellpadding="3" cellspacing="1" class="tableborder">
  108. <?=$ecms_hashur['form']?>
  109. <tr class="header">
  110. <td height="25" colspan="2">DIGG顶参数设置
  111. <input name="enews" type="hidden" value="SetDigg"></td>
  112. </tr>
  113. <tr bgcolor="#FFFFFF">
  114. <td width="18%" height="25">重复顶限制</td>
  115. <td width="82%"><select name="digglevel" id="digglevel">
  116. <option value="0"<?=$r['digglevel']==0?' selected':''?>>不限制 (可一直重复顶)</option>
  117. <option value="1"<?=$r['digglevel']==1?' selected':''?>>COOKIE验证 (同一浏览器COOKIE进行只能顶一次)</option>
  118. <option value="2"<?=$r['digglevel']==2?' selected':''?>>IP验证 (同一IP只能顶一次)</option>
  119. <option value="3"<?=$r['digglevel']==3?' selected':''?>>会员验证 (每个会员只能顶一次)</option>
  120. </select>
  121. &nbsp;(<strong><a href="SetDigg.php?enews=ClearDiggRecord<?=$ecms_hashur['href']?>" onclick="return confirm('确认要清空验证记录?');"><u>点击这里</u></a></strong>清空验证记录,可以让重新顶)</td>
  122. </tr>
  123. <tr bgcolor="#FFFFFF">
  124. <td height="25">关闭顶的系统模型</td>
  125. <td><?=$mids?></td>
  126. </tr>
  127. <tr bgcolor="#FFFFFF">
  128. <td height="25">&nbsp;</td>
  129. <td height="25"><input type="submit" name="Submit" value="提交"> <input type="reset" name="Submit2" value="重置"></td>
  130. </tr>
  131. <tr bgcolor="#FFFFFF">
  132. <td height="25" colspan="2"><font color="#666666">说明:<br>
  133. 要让系统模型支持顶功能,需要往模型表增加字段名为“diggtop”、类型为INT的字段;<br>
  134. 要让系统模型支持踩功能,需要往模型表增加字段名为“diggdown”、类型为INT的字段。</font> </td>
  135. </tr>
  136. </table>
  137. </form>
  138. </body>
  139. </html>