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

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索

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

[复制链接]
野天 发表于 2005-9-30 10:48:22 | 显示全部楼层

文件在这里

顺便看看为何法帖不能加金钱吧

  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*3;#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->unbuffered_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. ?>
复制代码
回复

使用道具 举报

 楼主| oytktk 发表于 2005-9-30 10:54:08 | 显示全部楼层

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

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



  7. //参数设置=====================

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

  12. $thison=$set['thison'];
  13. $reftime=$set['reftime'];
  14. $whatis=$set['whatis'];
  15. $usertime=$set['usertime'];
  16. $psottime=$set['psottime'];
  17. $postmachother=$set['other'];
  18. $fids=$thison?$set['fids']:NULL;
  19. $tids=$thison?$set['posttid']:NULL;
  20. $reftime=$reftime+rand(-3,3);
  21. $moneys=$set['moneys'];
  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->unbuffered_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. ?>
复制代码
回复

使用道具 举报

amoshuang 发表于 2005-9-30 10:58:38 | 显示全部楼层
郁闷
在没有安装“今日到访”的情况下,先装了这个,不能用
然后装“今日到访”,一片空白!
oytktk (靖飒) 大哥,给个“今日到访”的链接
偶用的是整理区的这个:
https://discuz.dismall.com/viewth ... 1%C8%D5%B5%BD%B7%C3
回复

使用道具 举报

 楼主| oytktk 发表于 2005-9-30 11:03:51 | 显示全部楼层
我用的也是这个~~~没有问题啊~?~
回复

使用道具 举报

 楼主| oytktk 发表于 2005-9-30 11:04:16 | 显示全部楼层
早面不能用是什么原因呢~?
回复

使用道具 举报

-龙- 发表于 2005-9-30 11:16:46 | 显示全部楼层
好东东
回复

使用道具 举报

 楼主| oytktk 发表于 2005-9-30 12:02:37 | 显示全部楼层
原帖由 -龙- 于 2005-9-30 11:16 发表
好东东


呵呵...................................................
回复

使用道具 举报

ygm007 发表于 2005-9-30 12:55:59 | 显示全部楼层
这个帖子很火呀,早点突破20000浏览
回复

使用道具 举报

fhg007 发表于 2005-9-30 13:18:35 | 显示全部楼层
再来瞧瞧
回复

使用道具 举报

rega0511 发表于 2005-9-30 13:24:20 | 显示全部楼层
对了,默认文件名是postmach.php、macher.php和macherlist.php,能不能将其改其他名字,如postmach.php改为phpstmach111.php,如果要这样改的话,是不是在升级数据库创建表的时候将postmach改为postmach111,另外2个文件还需要改吗?
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-10-6 08:39 , Processed in 0.115779 second(s), 15 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

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