Discuz!官方免费开源建站系统

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索

[求助] 请教,自动顶贴之回复最新的几个主题?

[复制链接]
kiscuz 发表于 2010-3-31 22:21:15 | 显示全部楼层 |阅读模式
自动顶贴插件如何设置只回复最新的几个主题

代码如下:

  1. 回复最新主题
  2. $x_t_num=50;
  3. 改成最新的主题数,也是回复数再将这行
  4. $x_query=$db->query("SELECT tid,fid FROM {$tablepre}threads where closed=0 order by rand() limit ".$x_t_num);
  5. 改成
  6. $x_query=$db->query("SELECT tid,fid FROM {$tablepre}threads where closed=0 order by tid desc limit ".$x_t_num);
  7. 即可,即回复最新的前50条主题
复制代码



这些代码我不知道要放在那里





整个文件代码:


  1. <?php
  2. /*
  3. [selfad.com.cn] (C)2008 selfad.com.cn
  4. This is a freeware, Code by Xmas
  5. $Id: reply_hourly.inc.php $
  6. Charset: gb2312

  7. Edit by www.365ago.com
  8. Update: 2009-02-12



  9. 随机uid回复人将这行
  10. $x_query=$db->query("SELECT uid,username FROM {$tablepre}members where uid<".$x_u_num);
  11. 改成
  12. $x_query=$db->query("SELECT uid,username FROM {$tablepre}members order by rand() limit ".$x_u_num);
  13. 随机回复人
  14. 指定uid回复人将这行
  15. $x_query=$db->query("SELECT uid,username FROM {$tablepre}members where uid<".$x_u_num);
  16. 改成
  17. $x_query=$db->query("SELECT uid,username FROM {$tablepre}members where uid IN (1,2,3,4,5,6,7)");
  18. 1,2,3,4,5,6,7改成对应的uid
  19. 指定uid回复范围将这行
  20. $x_query=$db->query("SELECT uid,username FROM {$tablepre}members where uid<".$x_u_num);
  21. 改成
  22. $x_query=$db->query("SELECT uid,username FROM {$tablepre}members where uid BETWEEN 1506 AND 1943 limit ".$x_u_num);
  23. uid为10-100这个范围
  24. 回复指定版块
  25. 将这行
  26. $x_query=$db->query("SELECT tid,fid FROM {$tablepre}threads where closed=0 order by rand() limit ".$x_t_num);
  27. 改为
  28. $x_query=$db->query("SELECT tid,fid FROM {$tablepre}threads where closed=0 and fid in (22,63,64,65,66) order by tid desc limit ".$x_t_num);
  29. 22,63,64,65,66 为你的版块fid号

  30. 回复最新主题
  31. $x_t_num=50;
  32. 改成最新的主题数,也是回复数再将这行
  33. $x_query=$db->query("SELECT tid,fid FROM {$tablepre}threads where closed=0 order by rand() limit ".$x_t_num);
  34. 改成
  35. $x_query=$db->query("SELECT tid,fid FROM {$tablepre}threads where closed=0 order by tid desc limit ".$x_t_num);
  36. 即可,即回复最新的前50条主题



  37. */
  38. if(!defined('IN_DISCUZ')) {
  39. exit('Access Denied');
  40. }
  41. $x_u_num=400; //参与随机发贴的人数
  42. $x_t_num=20; //随机回复数量10-50之间任意数字,可以任意修改
  43. $x_t_time=1800; //设置回复时间随机变动范围,单位:秒,表示随机发回时间为当前时间至 秒前,设为0表示不启用随机回复时间
  44. $x_r_sign=0;  //是否启用签名,1为启用,0为禁用.
  45. $x_r_ubboff=0; //是否启用UBB代码,0为启用,1为禁用.

  46. $x_k_num=1;
  47. $x_k_act=0;
  48. $x_member=array();
  49. $x_query=$db->query("SELECT uid,username FROM {$tablepre}members order by rand() limit ".$x_u_num);
  50. while($x_mem=$db->fetch_array($x_query)){
  51. $x_member[$x_mem['uid']]=addslashes($x_mem['username']);
  52. }
  53. $x_thread=array();
  54. $x_query=$db->query("SELECT tid,fid FROM {$tablepre}threads where closed=0 order by tid desc limit ".$x_t_num);
  55. while($x_thr=$db->fetch_array($x_query)){
  56. $x_thread[$x_thr['tid']]=$x_thr['fid'];
  57. }

  58. $x_message=array();
  59. if($x_k_act) $x_keywords=@file("http://www.my3glife.com.cn/keywords.php?charset=".$charset);
  60. if($x_keywords){
  61. $x_message=$x_keywords;
  62. }else{
  63. //自设回复内容在这里添加,支持UBB代码
  64. $x_message[]="[size=5]不错,感谢楼主[/size]";
  65. $x_message[]="[size=5]好帖子,谢楼主[/size]";
  66. $x_message[]="[size=5]说的真有道理啊![/size]";
  67. $x_message[]="[size=5]严重支持![/size]";
  68. $x_message[]="[size=5]回个帖子支持一下![/size]";
  69. $x_message[]="[size=5]谢谢楼主啊![/size]";
  70. $x_message[]="[size=5]拿分走人呵呵,楼下继续![/size]";
  71. $x_message[]="支持你加分  ";
  72. $x_message[]="不错不错.,..我喜欢  ";
  73. $x_message[]="先看看怎么样!  ";
  74. $x_message[]="谢谢分享  ";
  75. $x_message[]="原来还有这么多内幕啊,长见识了,呵呵  ";
  76. $x_message[]="应该加分  ";
  77. $x_message[]="写得好啊 估计有马甲  ";
  78. $x_message[]="说的不错  ";
  79. $x_message[]="晕死也不加点分  ";
  80. $x_message[]="感謝樓主  ";
  81. $x_message[]="支持一下吧  ";
  82. $x_message[]="爱不了  ";
  83. $x_message[]="不错,看看。  ";
  84. $x_message[]="哈哈,顶你了哦.  ";
  85. $x_message[]="支持你一下下。。  ";
  86. $x_message[]="顶你一下,好贴要顶!  ";
  87. $x_message[]="谢谢分享了!  ";
  88. $x_message[]="好困啊  ";
  89. $x_message[]="真是汗啊  我的帖子好少啊  加油  ";
  90. $x_message[]="楼上的稍等啦  ";
  91. $x_message[]="长时间没来看了 ~~  ";
  92. $x_message[]="呵呵,明白了  ";
  93. $x_message[]="这个贴不错!!!!!  ";
  94. $x_message[]="不错,支持下  ";
  95. $x_message[]="天啊.  ";
  96. $x_message[]="偶啥时才能熬出头啊.  ";
  97. $x_message[]="我的啦嘿嘿  ";
  98. $x_message[]="慢慢来,呵呵  ";
  99. $x_message[]="(*^__^*) 嘻嘻……   ";
  100. $x_message[]="加油啊!!!!顶哦!!!!!  ";
  101. $x_message[]="回复一下  ";
  102. $x_message[]="我帮你 喝喝  ";
  103. $x_message[]="ding   支持  ";
  104. $x_message[]="自己知道了  ";
  105. $x_message[]="努力,努力,再努力!!!!!!!!!!!  ";
  106. $x_message[]="初来乍到,请多多关照。。。  ";
  107. $x_message[]="一楼的位置好啊..  ";
  108. $x_message[]="我也来顶一下..  ";
  109. $x_message[]="回答了那么多,没有加分了,郁闷。。  ";
  110. $x_message[]="哦...............  ";
  111. $x_message[]="我顶啊。接着顶  ";
  112. $x_message[]="支持~~  ";
  113. $x_message[]="知道了 不错~~~  ";
  114. $x_message[]="呵呵,找个机会...  ";
  115. $x_message[]="支持~~顶顶~~~  ";
  116. $x_message[]="HOHO~~~~~~  ";
  117. $x_message[]="努力~~各位。。。  ";
  118. $x_message[]="不是吧  ";
  119. $x_message[]="真的有么  ";
  120. $x_message[]="你加油吧  ";
  121. $x_message[]="越办越好~~~~~~~~~`  ";
  122. $x_message[]="真好。。。。。。。。。  ";
  123. $x_message[]="我在努力中  ";
  124. $x_message[]="我来看看!谢谢  ";
  125. $x_message[]="帮你项项吧  ";
  126. $x_message[]="好人一个  ";
  127. $x_message[]="晕  不信啊  ";
  128. $x_message[]="#无语  ";
  129. $x_message[]="顶一个先  ";
  130. $x_message[]="顶也~  ";
  131. $x_message[]="看看..  ";
  132. $x_message[]="楼主,支持!  ";
  133. $x_message[]="我想要`~  ";
  134. $x_message[]="我等你哟!  ";
  135. $x_message[]="我的妈呀,爱死你了  ";
  136. $x_message[]="帮顶  ";
  137. $x_message[]="先顶后看  ";
  138. $x_message[]="谢谢哦  ";
  139. $x_message[]="顶你一下.  ";
  140. $x_message[]="不错!  ";
  141. $x_message[]="呵呵,支持一下哈  ";
  142. $x_message[]="帮你顶,人还是厚道点好  ";
  143. $x_message[]="挺好啊  ";
  144. $x_message[]="顶下再看  ";
  145. $x_message[]="支持一下  ";
  146. $x_message[]="嘿嘿  ";
  147. $x_message[]="有空一起交流一下  ";
  148. $x_message[]="好啊,,不错、、、、  ";
  149. $x_message[]="不错啊! 一个字牛啊!  ";
  150. $x_message[]="oh!magat!!!  ";
  151. $x_message[]="牛牛牛牛  ";
  152. $x_message[]="厉害!强~~~~没的说了!  ";
  153. $x_message[]="[size=5][url=http://www.365ago.com]人间佛教网真不错,收藏了[/size]";
  154. $x_message[]="非常感谢楼主,楼主万岁万岁万万岁!  ";
  155. $x_message[]="楼主福如东海,万寿无疆!  ";
  156. $x_message[]="鉴定完毕.!  ";
  157. $x_message[]="必须顶  ";
  158. $x_message[]="观看中  ";
  159. $x_message[]="哈哈,看的人少,回一下  ";
  160. $x_message[]="好帖子,要顶!";
  161. //在这行之前添加自设回复内容


  162. $x_message=array_map("toCharset",$x_message);
  163. }
  164. foreach($x_thread as $x_tid=>$x_fid){

  165. $message=NULL;
  166. if($x_k_num>1){
  167.   foreach(array_rand($x_message,$x_k_num) as $num){
  168.    $message.=addslashes($x_message[$num]);
  169.   }
  170. }else{
  171.   $message=addslashes($x_message[array_rand($x_message)]);
  172. }
  173. $timestamp=time()-rand(0,$x_t_time);
  174. $x_uid=array_rand($x_member);
  175. $x_user=$x_member[$x_uid];
  176. $subject=NULL;
  177. $x_useip="203.".rand(96,184).".".rand(124,127).".".rand(9,200);
  178. $db->query("INSERT INTO {$tablepre}posts (fid, tid, first, author, authorid, subject, dateline, message, useip, invisible, anonymous, usesig, htmlon, bbcodeoff, smileyoff, parseurloff, attachment)VALUES ('$x_fid', '$x_tid', '0', '$x_user', '$x_uid', '$subject', '$timestamp', '$message', '$x_useip', 0, 0, '$x_r_sign', 0, '$x_r_ubboff', 0, 0, 0)");
  179. $pid = $db->insert_id();

  180. $x_query=$db->query("SELECT tid,subject FROM {$tablepre}threads where tid='$x_tid'");
  181. $thread=$db->fetch_array($x_query);
  182. $lastpost = "$thread[tid]\t".addslashes($thread['subject'])."\t$timestamp\t$x_user";

  183. $db->query("UPDATE {$tablepre}members SET posts=posts+1,lastip='$x_useip',lastvisit='$timestamp',lastactivity='$timestamp',lastpost='$timestamp',pageviews=pageviews+1,oltime=oltime+2 WHERE uid='$x_uid'", 'UNBUFFERED');

  184. $db->query("REPLACE INTO {$tablepre}onlinetime (uid,thismonth,total,lastupdate) SELECT '$x_uid',thismonth+10,total+10,'$timestamp' FROM {$tablepre}onlinetime WHERE uid='$x_uid'", 'UNBUFFERED');

  185. $db->query("UPDATE {$tablepre}forums SET posts=posts+1,todayposts=todayposts+1,lastpost='$lastpost' WHERE fid='$x_fid'", 'UNBUFFERED');

  186. $db->query("UPDATE {$tablepre}threads SET replies=replies+1,views=views+1,lastposter='$x_user', lastpost='$timestamp' WHERE tid='$x_tid'", 'UNBUFFERED');
  187. }
  188. function toCharset($str=''){
  189. global $charset;
  190. $x_charset="gb2312";//插件文件本身所使用的字符编码,一般不需要修改,可选 'gbk', 'big5', 'utf-8','gb2312'
  191. if(function_exists("mb_convert_encoding")){
  192.   return mb_convert_encoding($str,$charset,$x_charset);
  193. }elseif(function_exists("iconv")){
  194.   return iconv($x_charset,$charset,$str);
  195. }else{
  196.   return $str;
  197. }
  198. }
  199. ?>

复制代码
 楼主| kiscuz 发表于 2010-3-31 22:49:53 | 显示全部楼层
回复

使用道具 举报

 楼主| kiscuz 发表于 2010-4-2 01:07:33 | 显示全部楼层
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|Discuz! 官方站 ( 皖ICP备16010102号 )star

GMT+8, 2024-11-16 12:39 , Processed in 0.024534 second(s), 3 queries , Gzip On, Redis On.

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

快速回复 返回顶部 返回列表