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

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索

[原创] · 嘘~~~论坛发贴机器(人) by oytktk (10/1)更新

[复制链接]
 楼主| oytktk 发表于 2005-10-14 21:56:56 | 显示全部楼层
原帖由 tenndy 于 2005-10-14 21:54 发表
怎么控制同时在线的机器人数量?


机器人的多少...和刷新的速度来决定~~
回复

使用道具 举报

tenndy 发表于 2005-10-14 22:35:35 | 显示全部楼层
具体一点呢?刷新速度越快机器人越多?
回复

使用道具 举报

hanvip 发表于 2005-10-15 03:28:46 | 显示全部楼层
原帖由 oytktk 于 2005-10-14 21:56 发表



说说你的情况吧..我最近比较没时间呢..请体谅~


以前的正常/!安装了455楼的就提示这个!

“对不起, 没有找到符合条件的记录!

如果您的浏览器没有自动跳转,请点击这里 ”

点开启机器人后就提示这样,是那里没设置好呢。
参数,发言内容,机器人名都设置好了

刚才看了你的一个帖子~难道还要安装在线时间插件?

是不是要安装在线时间插件才能生效?望解答!

附:




  1. <script language="JavaScript">
  2. if(top.location==window.location) top.location = "postmach.php";
  3. </script>
  4. <?

  5. require './include/common.php';
  6. require './include/post.php';
  7. if($adminid!=1)exit;



  8. //参数设置=====================

  9. $query = $db->query("SELECT * FROM cdb_postmach WHERE style='set'");
  10. while($dataset = $db->fetch_array($query)){
  11. $set[$dataset['value']]=$dataset['sside'];
  12. }

  13. $thison=$set['thison'];
  14. $reftime=$set['reftime'];
  15. $whatis=$set['whatis'];
  16. $usertime=$set['usertime'];
  17. $psottime=$set['psottime'];
  18. $postmachother=$set['other'];
  19. $fids=$thison?$set['fids']:NULL;
  20. $tids=$thison?$set['posttid']:NULL;
  21. $reftime=$reftime+rand(-3,3);
  22. $moneys=$moneys?"money=money+".$moneys.", ":NULL;

  23. $whatis=$whatis?"replies<=".$whatis." and ":NULL;
  24. //参数结束=====================

  25. $cccc="creditsrequire=0 and";

  26. //取出FID,TID值

  27. if (!$fids){
  28. $fidis=NULL;
  29. }else{
  30. $fidis=NULL;
  31. $fidis = "fid IN (".$fids.") and";
  32. }

  33. if (!$tids){
  34. $tidis=NULL;
  35. }else{
  36. $fidis=NULL;
  37. $tidis=NULL;
  38. $whatis=NULL;
  39. $cccc=NULL;
  40. $tidis = "tid IN (".$tids.") and";
  41. }


  42. if($thison){
  43. $stime=time();
  44. $dtime=3600*20;#3600=1天, *10表示10天, 意思是机器人只顶10天内的新贴.
  45. $ltime=$stime-$dtime;
  46. $timecc="and dateline>$ltime";
  47. }else{$timecc=NULL;}
  48. $query = $db->query("SELECT fid, tid, subject, author, replies FROM $table_threads WHERE $fidis $tidis $whatis $cccc closed=0 $timecc ORDER BY rand() DESC LIMIT 1");
  49. if(!$thread = $db->fetch_array($query))showmessage("对不起, 没有找到符合条件的记录!", "javascript:history.go(-1);");



  50. //取出发言机器人的名字
  51. $uptime=$usertime;
  52. $usertime=time()-$usertime;
  53. $query = $db->query("SELECT d.* FROM cdb_postmach d LEFT JOIN $table_members a ON a.uid=d.sside WHERE d.style='user' and d.cdate<'$usertime' ORDER BY rand() DESC LIMIT 1");
  54. if(!$userplay = $db->fetch_array($query))showmessage("对不起, 没有找到可用的参数, 请设置好所有参数后使用!", "javascript:history.go(-1);");

  55. $upalltime=$uptime*rand(5,20);
  56. $upmonth=date(n);
  57. if($lastmonth<$upmonth){
  58.         $upmonthtime=0;
  59. }else{
  60.         $upmonthtime="onlinemonth+".$upalltime;
  61. }
  62. $db->query("UPDATE $table_members SET onlinetime=onlinetime+$upalltime, onlinemonth=$upmonthtime, lastmonth=$upmonth WHERE username='$userplay[value]'");



  63. if($thison){



  64. //沙发,板凳,地板的特殊效果
  65. if($postmachother){
  66. if($thread['replies']==0){
  67.         $seles="style='onep'";
  68. }elseif($thread['replies']==1){
  69.         $seles="style='twop'";
  70. }elseif($thread['replies']==3){
  71.         $seles="style='thrp'";
  72. }else{
  73.         $seles="style='post' and ( sside='$thread[fid]' or sside='0' )";
  74. }
  75. }else{
  76.         $seles="style='post' and ( sside='$thread[fid]' or sside='0' )";
  77. }


  78. //取出发言信息
  79. $posttime=time()-$posttime;
  80. $query = $db->query("SELECT * FROM cdb_postmach WHERE $seles and cdate<'$posttime' ORDER BY rand() DESC LIMIT 1");
  81. if(!$postplay = $db->fetch_array($query))showmessage("对不起, 没有找到可用的参数, 请设置好所有参数后使用!", "javascript:history.go(-1);");


  82. $aslong = "主题:<b>".$thread['subject']."</b><hr>(<font color=red>".$userplay['value']."</font>)回复: ".$postplay['value'];


  83. //增加机器人发言


  84. $timeer=time();
  85. $db->query("INSERT INTO $table_posts (fid, tid, author, authorid, dateline, message, bbcodeoff)
  86.                                 VALUES ('$thread[fid]', '$thread[tid]', '$userplay[value]', '$userplay[sside]', '$timeer', '$postplay[value]', '0')");
  87. $db->query("UPDATE $table_threads SET lastpost='$timeer', lastposter='$userplay[value]', views=views+1, replies=replies+1 WHERE tid='$thread[tid]'");


  88. $db->query("UPDATE $table_forums SET lastpost='".addslashes($thread['subject'])."\t$timestamp\t$userplay[value]', posts=posts+1 WHERE fid='$thread[fid]'", 'UNBUFFERED');
  89. if ($forum['fup'] && $forum['type'] == 'sub' && !$forum['viewperm']) {
  90.                 $db->query("UPDATE $table_forums SET lastpost='".addslashes($thread['subject'])."\t$timestamp\t$userplay[value]'  WHERE fid='$forum[fup]'", 'UNBUFFERED');
  91.         }

  92. machermember($userplay['sside'], $replycredits);


  93. machersession($userplay['sside'], $userplay['value'], $thread['fid'], $thread['tid']);

  94. }

  95. else{

  96. $aslong = "发言功能为关闭状态, 目前只启动机器人在线功能!刷新速度:".$reftime;

  97. machersession($userplay['sside'], $userplay['value'], $thread['fid'], $thread['tid']);

  98. }


  99. include template('macher');




  100. //定义机器人在线函数
  101. function machersession($uids, $userss, $fid, $tid) {
  102.         global $db, $sid, $sessionexists, $timestamp, $onlinehold, $table_sessions, $table_members, $onlineip;
  103.                         $ips = explode('.', $onlineip);
  104.                         $acti = rand(0,3)<2 ? 3 : 12;
  105.                         $query = $db->query("SELECT groupid, styleid, invisible FROM $table_members WHERE uid='$uids'");
  106.                         $usergid = $db->fetch_array($query);
  107.                         $db->query("DELETE FROM $table_sessions WHERE sid='$uids'");
  108.                         $db->query("INSERT INTO $table_sessions (sid, ip1, ip2, ip3, ip4, uid, username, groupid, styleid, invisible, action, lastactivity, fid, tid)
  109.                                 VALUES ('$uids', '$ips[0]', '$ips[1]', '$ips[2]', '$ips[3]', '$uids', '$userss', '$usergid[groupid]', '$usergid[styleid]', '$usergid[invisible]', '$acti', '$timestamp', '$fid', '$tid')");
  110.                         if($discuz_uid) {
  111.                                 $db->query("UPDATE $table_members SET sinew=sinew+1, credit=credit+".intval($logincredits).", lastip='$onlineip', lastvisit=lastactivity, lastactivity=$timestamp WHERE uid='$uids'", 'UNBUFFERED');
  112.                 }
  113.                 $sessionupdated = 1;
  114. }




  115. //机器人发贴加积分,金钱,及升级函数
  116. function machermember($uidss, $credits) {
  117.         global $db, $table_members, $table_usergroups, $timestamp;
  118.        
  119.         $addcredit = $addpost = $newcredit = $newpost =0;
  120.         if(!$uidss ) return;
  121.         $query = $db->query("SELECT credit FROM $table_members WHERE uid='$uidss'");
  122.         $usercr = $db->fetch_array($query);
  123.         $groupidadd = NULL;
  124.         $newcredit = $usercr['credit'] + intval("$credits");
  125.         if($credits <> 0 && !($newcredit % 10)) {
  126.                 $query = $db->query("SELECT groupid FROM $table_usergroups WHERE type='member' AND '$newcredit'>=creditshigher AND '$newcredit'<creditslower");
  127.                 $groupidadd = ", groupid='".$db->result($query, 0)."'";
  128.         }
  129.         $db->query("UPDATE $table_members SET $moneys postnum=postnum+1, credit=$newcredit, lastpost='$timestamp' $groupidadd WHERE uid='$uidss'");
  130. }

  131. ?>
复制代码

[ 本帖最后由 hanvip 于 2005-10-15 03:30 编辑 ]
回复

使用道具 举报

 楼主| oytktk 发表于 2005-10-15 09:19:41 | 显示全部楼层
现在我要外出了.回来给你弄~
回复

使用道具 举报

tenndy 发表于 2005-10-15 10:11:24 | 显示全部楼层
发现机器人在线时间很短,很快就没了。。。怎么弄?
回复

使用道具 举报

 楼主| oytktk 发表于 2005-10-15 13:41:42 | 显示全部楼层
原帖由 tenndy 于 2005-10-15 10:11 发表
发现机器人在线时间很短,很快就没了。。。怎么弄?



在线时间很短?~?
回复

使用道具 举报

hanvip 发表于 2005-10-15 15:30:56 | 显示全部楼层
是不是455楼哪个要安装在线时间插件》》》??????
回复

使用道具 举报

 楼主| oytktk 发表于 2005-10-15 15:31:31 | 显示全部楼层
原帖由 hanvip 于 2005-10-15 15:30 发表
是不是455楼哪个要安装在线时间插件》》》??????


如果你没有安装在线时间插件的话就不要改455楼的啊~
回复

使用道具 举报

hanvip 发表于 2005-10-15 15:35:15 | 显示全部楼层
原帖由 oytktk 于 2005-10-15 15:31 发表


如果你没有安装在线时间插件的话就不要改455楼的啊~


回复

使用道具 举报

tenndy 发表于 2005-10-15 17:01:46 | 显示全部楼层
对,时间很短。。不知道出了什么问题,一般在线10分钟左右就没了。。。
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-5-18 09:42 , Processed in 0.113465 second(s), 15 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

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