自动顶贴插件如何设置只回复最新的几个主题
代码如下:
- 回复最新主题
- $x_t_num=50;
- 改成最新的主题数,也是回复数再将这行
- $x_query=$db->query("SELECT tid,fid FROM {$tablepre}threads where closed=0 order by rand() limit ".$x_t_num);
- 改成
- $x_query=$db->query("SELECT tid,fid FROM {$tablepre}threads where closed=0 order by tid desc limit ".$x_t_num);
- 即可,即回复最新的前50条主题
复制代码
这些代码我不知道要放在那里
整个文件代码:
-
- <?php
- /*
- [selfad.com.cn] (C)2008 selfad.com.cn
- This is a freeware, Code by Xmas
- $Id: reply_hourly.inc.php $
- Charset: gb2312
-
- Edit by www.365ago.com
- Update: 2009-02-12
-
-
-
- 随机uid回复人将这行
- $x_query=$db->query("SELECT uid,username FROM {$tablepre}members where uid<".$x_u_num);
- 改成
- $x_query=$db->query("SELECT uid,username FROM {$tablepre}members order by rand() limit ".$x_u_num);
- 随机回复人
- 指定uid回复人将这行
- $x_query=$db->query("SELECT uid,username FROM {$tablepre}members where uid<".$x_u_num);
- 改成
- $x_query=$db->query("SELECT uid,username FROM {$tablepre}members where uid IN (1,2,3,4,5,6,7)");
- 1,2,3,4,5,6,7改成对应的uid
- 指定uid回复范围将这行
- $x_query=$db->query("SELECT uid,username FROM {$tablepre}members where uid<".$x_u_num);
- 改成
- $x_query=$db->query("SELECT uid,username FROM {$tablepre}members where uid BETWEEN 1506 AND 1943 limit ".$x_u_num);
- uid为10-100这个范围
- 回复指定版块
- 将这行
- $x_query=$db->query("SELECT tid,fid FROM {$tablepre}threads where closed=0 order by rand() limit ".$x_t_num);
- 改为
- $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);
- 22,63,64,65,66 为你的版块fid号
-
- 回复最新主题
- $x_t_num=50;
- 改成最新的主题数,也是回复数再将这行
- $x_query=$db->query("SELECT tid,fid FROM {$tablepre}threads where closed=0 order by rand() limit ".$x_t_num);
- 改成
- $x_query=$db->query("SELECT tid,fid FROM {$tablepre}threads where closed=0 order by tid desc limit ".$x_t_num);
- 即可,即回复最新的前50条主题
-
-
-
- */
- if(!defined('IN_DISCUZ')) {
- exit('Access Denied');
- }
- $x_u_num=400; //参与随机发贴的人数
- $x_t_num=20; //随机回复数量10-50之间任意数字,可以任意修改
- $x_t_time=1800; //设置回复时间随机变动范围,单位:秒,表示随机发回时间为当前时间至 秒前,设为0表示不启用随机回复时间
- $x_r_sign=0; //是否启用签名,1为启用,0为禁用.
- $x_r_ubboff=0; //是否启用UBB代码,0为启用,1为禁用.
-
- $x_k_num=1;
- $x_k_act=0;
- $x_member=array();
- $x_query=$db->query("SELECT uid,username FROM {$tablepre}members order by rand() limit ".$x_u_num);
- while($x_mem=$db->fetch_array($x_query)){
- $x_member[$x_mem['uid']]=addslashes($x_mem['username']);
- }
- $x_thread=array();
- $x_query=$db->query("SELECT tid,fid FROM {$tablepre}threads where closed=0 order by tid desc limit ".$x_t_num);
- while($x_thr=$db->fetch_array($x_query)){
- $x_thread[$x_thr['tid']]=$x_thr['fid'];
- }
-
- $x_message=array();
- if($x_k_act) $x_keywords=@file("http://www.my3glife.com.cn/keywords.php?charset=".$charset);
- if($x_keywords){
- $x_message=$x_keywords;
- }else{
- //自设回复内容在这里添加,支持UBB代码
- $x_message[]="[size=5]不错,感谢楼主[/size]";
- $x_message[]="[size=5]好帖子,谢楼主[/size]";
- $x_message[]="[size=5]说的真有道理啊![/size]";
- $x_message[]="[size=5]严重支持![/size]";
- $x_message[]="[size=5]回个帖子支持一下![/size]";
- $x_message[]="[size=5]谢谢楼主啊![/size]";
- $x_message[]="[size=5]拿分走人呵呵,楼下继续![/size]";
- $x_message[]="支持你加分 ";
- $x_message[]="不错不错.,..我喜欢 ";
- $x_message[]="先看看怎么样! ";
- $x_message[]="谢谢分享 ";
- $x_message[]="原来还有这么多内幕啊,长见识了,呵呵 ";
- $x_message[]="应该加分 ";
- $x_message[]="写得好啊 估计有马甲 ";
- $x_message[]="说的不错 ";
- $x_message[]="晕死也不加点分 ";
- $x_message[]="感謝樓主 ";
- $x_message[]="支持一下吧 ";
- $x_message[]="爱不了 ";
- $x_message[]="不错,看看。 ";
- $x_message[]="哈哈,顶你了哦. ";
- $x_message[]="支持你一下下。。 ";
- $x_message[]="顶你一下,好贴要顶! ";
- $x_message[]="谢谢分享了! ";
- $x_message[]="好困啊 ";
- $x_message[]="真是汗啊 我的帖子好少啊 加油 ";
- $x_message[]="楼上的稍等啦 ";
- $x_message[]="长时间没来看了 ~~ ";
- $x_message[]="呵呵,明白了 ";
- $x_message[]="这个贴不错!!!!! ";
- $x_message[]="不错,支持下 ";
- $x_message[]="天啊. ";
- $x_message[]="偶啥时才能熬出头啊. ";
- $x_message[]="我的啦嘿嘿 ";
- $x_message[]="慢慢来,呵呵 ";
- $x_message[]="(*^__^*) 嘻嘻…… ";
- $x_message[]="加油啊!!!!顶哦!!!!! ";
- $x_message[]="回复一下 ";
- $x_message[]="我帮你 喝喝 ";
- $x_message[]="ding 支持 ";
- $x_message[]="自己知道了 ";
- $x_message[]="努力,努力,再努力!!!!!!!!!!! ";
- $x_message[]="初来乍到,请多多关照。。。 ";
- $x_message[]="一楼的位置好啊.. ";
- $x_message[]="我也来顶一下.. ";
- $x_message[]="回答了那么多,没有加分了,郁闷。。 ";
- $x_message[]="哦............... ";
- $x_message[]="我顶啊。接着顶 ";
- $x_message[]="支持~~ ";
- $x_message[]="知道了 不错~~~ ";
- $x_message[]="呵呵,找个机会... ";
- $x_message[]="支持~~顶顶~~~ ";
- $x_message[]="HOHO~~~~~~ ";
- $x_message[]="努力~~各位。。。 ";
- $x_message[]="不是吧 ";
- $x_message[]="真的有么 ";
- $x_message[]="你加油吧 ";
- $x_message[]="越办越好~~~~~~~~~` ";
- $x_message[]="真好。。。。。。。。。 ";
- $x_message[]="我在努力中 ";
- $x_message[]="我来看看!谢谢 ";
- $x_message[]="帮你项项吧 ";
- $x_message[]="好人一个 ";
- $x_message[]="晕 不信啊 ";
- $x_message[]="#无语 ";
- $x_message[]="顶一个先 ";
- $x_message[]="顶也~ ";
- $x_message[]="看看.. ";
- $x_message[]="楼主,支持! ";
- $x_message[]="我想要`~ ";
- $x_message[]="我等你哟! ";
- $x_message[]="我的妈呀,爱死你了 ";
- $x_message[]="帮顶 ";
- $x_message[]="先顶后看 ";
- $x_message[]="谢谢哦 ";
- $x_message[]="顶你一下. ";
- $x_message[]="不错! ";
- $x_message[]="呵呵,支持一下哈 ";
- $x_message[]="帮你顶,人还是厚道点好 ";
- $x_message[]="挺好啊 ";
- $x_message[]="顶下再看 ";
- $x_message[]="支持一下 ";
- $x_message[]="嘿嘿 ";
- $x_message[]="有空一起交流一下 ";
- $x_message[]="好啊,,不错、、、、 ";
- $x_message[]="不错啊! 一个字牛啊! ";
- $x_message[]="oh!magat!!! ";
- $x_message[]="牛牛牛牛 ";
- $x_message[]="厉害!强~~~~没的说了! ";
- $x_message[]="[size=5][url=http://www.365ago.com]人间佛教网真不错,收藏了[/size]";
- $x_message[]="非常感谢楼主,楼主万岁万岁万万岁! ";
- $x_message[]="楼主福如东海,万寿无疆! ";
- $x_message[]="鉴定完毕.! ";
- $x_message[]="必须顶 ";
- $x_message[]="观看中 ";
- $x_message[]="哈哈,看的人少,回一下 ";
- $x_message[]="好帖子,要顶!";
- //在这行之前添加自设回复内容
-
-
- $x_message=array_map("toCharset",$x_message);
- }
- foreach($x_thread as $x_tid=>$x_fid){
- $message=NULL;
- if($x_k_num>1){
- foreach(array_rand($x_message,$x_k_num) as $num){
- $message.=addslashes($x_message[$num]);
- }
- }else{
- $message=addslashes($x_message[array_rand($x_message)]);
- }
- $timestamp=time()-rand(0,$x_t_time);
- $x_uid=array_rand($x_member);
- $x_user=$x_member[$x_uid];
- $subject=NULL;
- $x_useip="203.".rand(96,184).".".rand(124,127).".".rand(9,200);
- $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)");
- $pid = $db->insert_id();
-
- $x_query=$db->query("SELECT tid,subject FROM {$tablepre}threads where tid='$x_tid'");
- $thread=$db->fetch_array($x_query);
- $lastpost = "$thread[tid]\t".addslashes($thread['subject'])."\t$timestamp\t$x_user";
-
- $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');
-
- $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');
-
- $db->query("UPDATE {$tablepre}forums SET posts=posts+1,todayposts=todayposts+1,lastpost='$lastpost' WHERE fid='$x_fid'", 'UNBUFFERED');
-
- $db->query("UPDATE {$tablepre}threads SET replies=replies+1,views=views+1,lastposter='$x_user', lastpost='$timestamp' WHERE tid='$x_tid'", 'UNBUFFERED');
- }
- function toCharset($str=''){
- global $charset;
- $x_charset="gb2312";//插件文件本身所使用的字符编码,一般不需要修改,可选 'gbk', 'big5', 'utf-8','gb2312'
- if(function_exists("mb_convert_encoding")){
- return mb_convert_encoding($str,$charset,$x_charset);
- }elseif(function_exists("iconv")){
- return iconv($x_charset,$charset,$str);
- }else{
- return $str;
- }
- }
- ?>
-
复制代码 |