The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
![]()
I am looking for someone to help me with a few lines of code to pull the number of members and number of guest currently online from the database (seperate of each other) and place them into two different variables to use on a non vb site. I have played with the code and mods that others have posted but most of them I am having trouble with. Any help here would be great.
|
#2
|
||||
|
||||
![]()
They are not kept in any database, they are worked out "on the fly" in index.php.
|
#3
|
|||
|
|||
![]()
make a .php file "call it whatever" drop it in your /forum/ dir and
run it see what happens. Code:
<?php error_reporting(E_ALL & ~E_NOTICE); $specialtemplates = array( 'maxloggedin', ); require_once("global.php"); require_once("includes/functions_forumlist.php"); $getnewestusers=$DB_site->query_first("SELECT userid,username FROM user ORDER BY joindate DESC LIMIT 1"); $newusername=$getnewestusers['username']; $newuserid=$getnewestusers['userid']; $datecut = time()-$vboptions['cookietimeout']; $regmembername = $DB_site->query("SELECT DISTINCT username,options FROM ".$tableprefix."user,".$tableprefix."session WHERE ".$tableprefix."session.userid=".$tableprefix."user.userid AND ".$tableprefix."session.lastactivity>$datecut ORDER BY username ASC") or exit("oops2"); while($regmember = $DB_site->fetch_array($regmembername)) { $regmember['options'] = intval($regmember['options']); foreach($_USEROPTIONS as $optionname => $optionval) { $regmember["$optionname"] = iif($regmember['options'] & $optionval, 1, 0); } if ((($regmember['invisible'] == 0)) and $regmemberson or ($bbuserinfo['usergroupid'] == 6 and $regmember['invisible'] == 1)) { $regmemberson .= ", "; } $regmembercomma++; if ($regmember['invisible'] == 0 or $bbuserinfo['usergroupid'] == 6) { if ($regmember['invisible'] == 1) { $userinvisible = "*"; } $regmemberson .= $regmember['username'].$userinvisible; } else { $regmembercomma++; } } if (!$regmemberson) { $regmemberson = "(none)"; } $regmembers = $DB_site->query_first("SELECT COUNT(DISTINCT userid) AS membersonline FROM ".$tableprefix."session WHERE userid>0 AND ".$tableprefix."session.lastactivity>$datecut") or exit("oops3"); $regmembersno = number_format($regmembers['membersonline']); $username=$bbuserinfo['username'];$guests = $DB_site->query_first("SELECT COUNT(userid) AS guestsonline FROM ".$tableprefix."session WHERE userid=0 AND ".$tableprefix."session.lastactivity>$datecut") or exit("oops4"); $guestson = number_format($guests['guestsonline']); $totalonline = $regmembersno + $guestson; // ### MAX LOGGEDIN USERS ################################ $maxusers = unserialize($datastore['maxloggedin']); $recordusers = $maxusers['maxonline']; $recorddate = vbdate($vboptions['dateformat'], $maxusers['maxonlinedate'], true); $recordtime = vbdate($vboptions['timeformat'], $maxusers['maxonlinedate']); echo "<div style=\"font-family:Verdana; font-size:11;\"> Active users online: $totalonline ($regmembersno users and $guestson guests online.)</div> <div style=\"font-family:Verdana; font-size:10;\"><a href=\"forum/member.php?s=&action=getinfo&userid=$userid\">$regmemberson</a></div> <div style=\"font-family:Verdana; font-size:11;\">Most users ever online was $recordusers, $recorddate at $recordtime<br> Welcome to our newest member: <a href=\"member.php?s=&action=getinfo&userid=$newuserid\">$newusername</a><div><br>"; ?> |
![]() |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|