![]() |
Okay.. I want to be able to show on an external page (outside of vbulletin) the number of total regged users, and the number of online users..
This code was workign PERFECTLY with vB114 but it produces an error with vb2.. heres the code.. Code:
<? "Warning: 0 is not a MySQL result index in /home/redg/htdocs/online2.php on line 7 We have a total of 3130 registered users. There are currently users online at the moment. " any ideas are greatly appreciated.. slip |
Code:
<? [edited to correct invalid query] |
i did that, and i only get "oops" now when i go to that file.. any ideas?
|
Yeah... I just checked the session table and there is no such field as 'sessionid'.
Replace your first query with this: Code:
"SELECT COUNT(userid) AS users FROM session" |
woo hoo!
you seriously rule!!! :D :D :D thanks! |
is there a way to put this into a html page?
|
Quote:
|
ahh, but there is ;)
SSI from the .php file |
Quote:
|
The results in VBulletin 2.0 are different to the results in your script. It counts correctly the sessions, but why shows the vbulletin other results? Any suggestions?
|
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..? |
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) { |
would anyone mind telling me how to implement that?
sorry, i'm incredibly stupid when it comes to PHP stuff.. |
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). :) But then, you would adjust the code:
Code:
<? |
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 :( |
Is it possible to add the number of "guests" currently online as well?
Thanks :) -Hideki |
anyone want to help with fixing this?
|
I have been looking at it...give me some time..
|
It would be coool if it actually showed the members (who)that are online like index.php
|
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:
<? 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. |
Thanks For Your Help
But can you post the whole code? I didnt understand your directions! Thanks |
Sorry, I changed the code but it shows me 0members and 0 visitors!
;) You are on the right way, but there should be one mistake... |
Couldnt get it to work either
|
Hmm. I noticed the 0 people yesterday, with different settings.
Just tried out: I just changed "$datecut = time()-$cookietimeout;" into "$datecut = time()-300;" And that worked. It just means it shows who's online in the last 5 minutes... Can it be that the $cookietimeout query doesn't return a number but plain text? |
This works. I have the timeout settings on 500 seconds in the vbulletin board, so the working skript looks now like that: (remember the right path to the admin/config file!)
Code:
<? |
Hey Peter, I tried your exact code,
and it listed 3 members online, But the thing is.... it'sa test board and I only have 2 members total! I don't think it works. Can anyone make this actually list the members name like in the index.php file? |
hmm, thats right, something is more wrong, i have nearly the right results like in the vbulletib forum, but only nearly, so i thought at the beginning, the code is right. Sorry, I was to fast ;)
|
Quote:
Quote:
OK after a bit of scratching my head, I think I have this thing figured out. Code:
<? |
Now it lists 0 members and 0 guests online
|
1 Attachment(s)
OK I figured it out, finally. Change the code as follows. Replace this:
Code:
$cookietimeout = mysql_query("SELECT value FROM setting WHERE varname = 'cookietimeout'"); Code:
$cookievalue = mysql_query("SELECT value FROM setting WHERE varname = 'cookietimeout'"); Code:
<? include("/path/to/online.php"); ?> Code:
<!--#include virtual="/path/to/online.php"--> Problems? Let me know. It should work now. :) |
Works Like A Charm!
Thanks! |
I'll work on getting to show the user names. Give me a few hours, and I'll release it in a new thread. :)
|
AWESOME!
Can't Wait Bro! |
You rock, it worked great!
I couldn't get all of the code from the attachment though. |
Jyaki: What do you mean? I just tried downloading it and it worked fine...?
|
When I click on it, This is everything I get:
Code:
$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]); $users=mysql_query("SELECT COUNT(userid) AS registeredusers FROM user",$db) or die ("double oops"); while($user = mysql_fetch_array($users)) $totalusers=number_format($user[registeredusers]); echo "We have a total of $totalusers registered users. There are currently $membersonline members and $guestsonline guests online."; ?> |
I've changed it to a zip file. Let me know if you're still having problems.
|
I just copied your earlier code and made the changes you specified manually.
I've been wanting this one for a long time. Thanks |
As promised, I released the online users with user names. There's a link in my sig. Enjoy! :D
|
All times are GMT. The time now is 02:33 AM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|