![]() |
Putting the NUMBER of users online on forum on a non-vB page?
I just want to have something on a webpage which is not in my forum's directory, which will say: XX Users online in forum!
How do I grab that number? |
Stick this code somewhere on the page maybe?
PHP Code:
Regards - miSt |
You need global.php too though...
Would using phpinclude to include global.php then use that code work? |
Of course you have to include global.php :)
But do it in the file and not the phpinclude template - miSt |
obviously not the php include template :p
|
You could:
1) include() config.php 2) connect to the database 3) SELECT count(*) as count FROM session |
Quote:
|
PHP Code:
|
Is the 3600 in there the timeout? Say if I have timeout set at 900 seconds on my forums, would I change it to 900 in that code?
|
Yup.
|
If that is so, then it's showing the incorrect number. 21 on my forum (guests + members) but on my other page I put that code on it says 26. I'm not sure why. There's 3 invisible users online.
What could be the cause of this? |
Time zone differences. The code I posted is based on GMT time.
|
How can I make it so both pages show the same figure?
ie. Guests will see the default I have set from the adminCP. Members will see what they have set in their userCP. Is it possible to synchronize this into the page? Or is there something simpler? Or is it servertimezone? |
Strange... look at the code from index.php that Mist posted. It's using the $cookietimeout variable which is loaded from the Admin CP. It's doing nearly the same thing as what I did for guests, but the code to generate the who's online member list and the # of registered members online is very confusing.
|
All times are GMT. The time now is 01:51 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:
|