//===========================================================================================
//虚拟线上游客
$virtualhack = '1'; // 1=开 0=关
if($virtualhack=='1')
{
$onlinecheck = $DB->query("SELECT sessionhash, userid, username, invisible, lastactivity, usergroupid FROM ".TABLE_PREFIX."session WHERE lastactivity > $time ORDER BY lastactivity DESC");
while ($usercheck = $DB->fetch_array($onlinecheck) ) {
if($usercheck == '' || $usercheck == 'NULL'){
$guestonline++;
} else {
$useronline++;
}
}
if($useronline <= 30 && $guestonline <= 30) //如果在线用户少于30,在线游客少于30,运行以下代码
{
$randguest = mt_rand(10, 30); //随机生成10-30个虚拟游客数
$mythreads = $DB->query("SELECT * FROM ".TABLE_PREFIX."thread");
$coutthread = $DB->num_rows($mythreads);
$myforums = $DB->query("SELECT * FROM ".TABLE_PREFIX."forum");
$coutforum = $DB->num_rows($myforums);
for($i=1;$i<=$randguest;$i++)
{
$f = mt_rand(1,$coutforum);
$t = mt_rand(1,$coutthread);
$randnum = mt_rand(1,1000);
$location = str_replace($bboptions['homeurl'],'',$bboptions['bburl']);
if($randnum%11 == 0 || $randnum%11 == 1 || $randnum%11 == 2){
$myforum = $DB->query_first("SELECT * FROM ".TABLE_PREFIX."forum where id=".$f);
if($myforum['parentid'] == '-1' || $myforum['id'] == ''){
$randthread = 0;
$randforums = 0;
$randlocation = $location."/index.php?";
} else {
$randthread = 0;
$randforums = $myforum['id'];
$randlocation = $location."/forumdisplay.php?f=".$randforums;
}
}
if($randnum%11 == 3 || $randnum%11 == 4 || $randnum%11 == 5){
$mythread = $DB->query_first("SELECT * FROM ".TABLE_PREFIX."thread where tid=".$t);
$randthread = $mythread['tid'];
$randforums = $mythread['forumid'];
$randlocation = $location."/showthread.php?t=".$randthread;
}
if($randnum%11 == 6){
$mythread = $DB->query_first("SELECT * FROM ".TABLE_PREFIX."thread where tid=".$t);
$randthread = 0;
$randforums = 0;
$randlocation = $location."/search.php?";
}
if($randnum%11 == 7){
$mythread = $DB->query_first("SELECT * FROM ".TABLE_PREFIX."thread where tid=".$t);
$randthread = 0;
$randforums = 0;
$randlocation = $location."/memberlist.php?";
}
if($randnum%11 == 8){
$mythread = $DB->query_first("SELECT * FROM ".TABLE_PREFIX."thread where tid=".$t);
$randthread = 0;
$randforums = 0;
$randlocation = $location."/attachment.php?";
}
if($randnum%11 == 9){
$mythread = $DB->query_first("SELECT * FROM ".TABLE_PREFIX."thread where tid=".$t);
$randthread = 0;
$randforums = 0;
$randlocation = $location."/faq.php?";
}
if($randnum%11 == 10){
$mythread = $DB->query_first("SELECT * FROM ".TABLE_PREFIX."thread where tid=".$t);
$randthread = 0;
$randforums = 0;
$randlocation = $location."/register.php?";
}
$randip = mt_rand(1,255).".".mt_rand(1,255).".".mt_rand(1,255).".".mt_rand(1,255);
$onlinetime = time() - mt_rand(60, 900); //设定最后活动时间为1-15分钟前
$onlinesid = md5(time()+mt_rand(0,1000000));
$DB->query("INSERT INTO ".TABLE_PREFIX."session (sessionhash, host, useragent, lastactivity, invisible, location, usergroupid,inforum,inthread,inblog) VALUES ('$onlinesid', '$randip', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN; rv:1.7.6) Gecko/20050226 Firefox/1.0.1', '$onlinetime','0','$randlocation','2','$randforums','$randthread','0')");
}
}
}
//===========================================================================================
请问是否2.5不可以用?我用了之后显示数据库错误。
此帖由 一郎 在 2005-12-19 11:39 进行编辑...
****************
此帖由 一郎 在 2005-12-19 12:08 进行编辑...
不是很喜欢这样的插件。。。。不过终于有了魔力的插件。。。鼓掌
哪位大大能修改一下啊?LZ想办法啊?怎么现在都不来魔力啦?是不是跳槽啦?