The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#11
|
|||
|
|||
![]()
yeah, this script "works" but it doesnt really work.
for example when i have 60 users online it says there are 120, and it keeps going up, and then every now and then it will drop down to the actual number.. any ideas..? |
#12
|
|||
|
|||
![]()
I think the online vbulletin script works with cookies and with a timeout option. The onlinescript by Slip counts all userid's in "session". So the results are different.
Compare in index.php from vbulletin: Code:
if ($displayloggedin) { $datecut=time()-$cookietimeout; //$loggedins=$DB_site->query_first("SELECT COUNT(*) AS sessions FROM session WHERE lastactivity>$datecut"); //$totalonline=$loggedins['sessions']; $loggedins=$DB_site->query_first("SELECT COUNT(*) AS sessions FROM session WHERE userid=0 AND lastactivity>$datecut"); $numberguest=$loggedins['sessions']; //$numberregistered=$totalonline-$numberguest; |
#13
|
|||
|
|||
![]()
would anyone mind telling me how to implement that?
sorry, i'm incredibly stupid when it comes to PHP stuff.. |
#14
|
|||
|
|||
![]()
Well, you could require() the global.php file and then you could use the $cookietimeout variable. Or you could pull it from the database yourself, either way (it's in the settings table, I believe).
![]() Code:
<? require("forum/admin/config.php"); $datecut = time()-$cookietimeout; $db=mysql_connect($servername,$dbusername,$dbpassword); mysql_select_db($dbname); $loggedins=mysql_query("SELECT COUNT(userid) AS users FROM session WHERE lastactivity>$datecut AND userid=0",$db) or die ("oops"); while($loggedin = mysql_fetch_array($loggedins)) $totalonline=number_format($loggedin[users]); // rest deleted to save space, but leave it in there! ?> |
#15
|
|||
|
|||
![]()
That's what I thought, and it got rid of the cumulative effect of the previous code.
But now it insists there are 0 people online ![]() |
#16
|
|||
|
|||
![]()
Is it possible to add the number of "guests" currently online as well?
Thanks ![]() -Hideki |
#17
|
|||
|
|||
![]()
anyone want to help with fixing this?
|
#18
|
|||
|
|||
![]()
I have been looking at it...give me some time..
|
#19
|
|||
|
|||
![]()
It would be coool if it actually showed the members (who)that are online like index.php
|
#20
|
|||
|
|||
![]()
OK I think I goofed. I looked at the sessions table, so here goes.
For registered members, you need it where userid>0. For guests, it's where userid=0. So let's revisit the code: Code:
<? require("forum/admin/config.php"); $db=mysql_connect($servername,$dbusername,$dbpassword); mysql_select_db($dbname); $cookietimeout = mysql_query("SELECT value FROM setting WHERE varname = cookietimeout"); $datecut = time()-$cookietimeout; $loggedins=mysql_query("SELECT COUNT(userid) AS users FROM session WHERE lastactivity>$datecut AND userid>0",$db) or die ("oops"); while($loggedin = mysql_fetch_array($loggedins)) $membersonline=number_format($loggedin[users]); $guestsloggedins=mysql_query("SELECT COUNT(userid) AS users FROM session WHERE lastactivity>$datecut AND userid=0",$db) or die ("oops"); while($guestsloggedin = mysql_fetch_array($guestsloggedins)) $guestsonline=number_format($guestsloggedin[users]); // rest of code to display numbers ?> I also added a couple lines to set the date cut without involving global.php. Use $membersonline to display the members online, and use $guestsonline to display the guests. |
![]() |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|