View Full Version : X online Users (full site)
JAB Creations
05-26-2004, 05:21 AM
Hello...
I recently converted my site to PHP. I want to link my php pages to VB and have VB be able to count the total number of active users and guests around my entire site. Then I want to be able to php print how many active users are online.
Not just people on the forums of course.
danrak
08-02-2004, 03:44 AM
Have you found out how to do this yet? I'm trying to figure out how to do this also.
JAB Creations
08-02-2004, 07:45 PM
Yes I have...
Plus I will tell you how to do something extra that you'll be interested in! :D
<?php chdir("/home/youruser/www/forum"); require_once('global.php'); ?>
Just put that anywhere on the PHP files. I use frames so I only put this on pages with content, not frame borders.
Now once you do this you're going to see ...
Unknown Location
/fiction/fiction-artwork.php
Unfortunitly there is only one slow but sure way to fix this if you care to of course...
This is a VB Hack, so be sure to...
1.) Back up the original VB file; I do save oringal files in a BAK folder.
2.) Back up your hacked file once you have it working!
3.) Make sure you can upload the original file in case it screws anything up!
Ok, you will want to edit includes/functions_online.php. Also an important note DONT edit pages online, always edit them locally on your computer. This idea has led to many great disasters in the past, thankfully not to me!
There are two parts you will have to edit...I will just copy and paste two pages I have modded, and the code before it. So you just have to look for the code and mod it for your own page....
/////Mod 1 (of 2)//////////
case 'index':
$userinfo['action'] = $vbphrase['viewing_index'];
$userinfo['where'] = "<a href=\"$vboptions[forumhome].php?$session[sessionurl]\">$vboptions[bbtitle]</a>";
break;
case 'home-about':
$userinfo['action'] = 'Home Section';
$userinfo['where'] = "<a href=\"http://www.jabcreations.com/home/home-about.php\">About</a>";
break;
case 'home-articles':
$userinfo['action'] = 'Home Section';
$userinfo['where'] = "<a href=\"http://www.jabcreations.com/home/home-articles.php\">Articles</a>";
break;
\\end mod part 1\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
Now you will have to scroll down a bit...
/////mod part 2/////////////
case 'forumdisplay.php':
$userinfo['activity'] = 'forumdisplay';
break;
case 'attachment.php':
$userinfo['activity'] = 'attachment';
break;
case '/':
case '':
case 'home-about.php':
$userinfo['activity'] = 'home-about';
break;
case 'home-articles.php':
$userinfo['activity'] = 'home-articles';
break;
\\\\\\\\end mod part 2\\\\\\\\\\
My home section is in a different folder that is on the same level as my VB folder. I don't think you have to worry as it will use that file wherever it is on your page.
Your result will be like this....
Guest
03:42 PM
Home Section
Latest News
Guest
03:41 PM
Home Section
Downloads
Enjoy ! :classic:
danrak
08-02-2004, 09:12 PM
Thank you. I will have to try this out.
AN-net
08-02-2004, 09:38 PM
yes for vb to track your other files just require_once('./global.php'); and it should track the file. Also to show locations correctly in whos online just edit /includes/functions_online.php
jfreyholtz
08-19-2004, 06:02 PM
yes for vb to track your other files just require_once('./global.php'); and it should track the file. Also to show locations correctly in whos online just edit /includes/functions_online.php
Any idea why this wouldn't work? I have global included on every page in my site (and have login avail. on them), but users don't show up on the Whos Online bit until they actually go into the forums.
JAB Creations
08-19-2004, 08:01 PM
Make sure you are defining your server path in absolute...
instead of....
../../file.php
use...
/home/shared_server_username/www/vbfolder/thefileyouwant.php
Full example....
<?php chdir("/home/jabsite/www/community"); require_once('global.php'); ?>
jfreyholtz
08-20-2004, 12:29 PM
Make sure you are defining your server path in absolute...
instead of....
../../file.php
use...
/home/shared_server_username/www/vbfolder/thefileyouwant.php
Full example....
<?php chdir("/home/jabsite/www/community"); require_once('global.php'); ?>
Yeah, that's what I'm doing. This, to be precise:
chdir("/home/virtual/site1/fst/var/www/html/forums");
require_once("./global.php");
Login works on all pages using this, but the users aren't showing up on Who's Online (nor in the sessions table in the db), unless they actually go into the forums.
AN-net
08-20-2004, 02:04 PM
are you actually running any queries in that file?
ChessMess
08-20-2004, 02:16 PM
Would something like this cause a slowdown on the forums for high traffic sites?
JAB Creations
08-20-2004, 02:33 PM
I wouldn't think it would slow down much if at all really. All it's doing is asking the server whose been at these linked files in the past 15 minutes. Plus it wont do anything anyway until someone looks at your whose online page in addition. So my assumption but *NOT* the solid truth as far as I'll say is that no or not really.
jfreyholtz
08-20-2004, 05:04 PM
are you actually running any queries in that file?
What file? The one I have the global included in?
If so, yeah...
At the top of that file (my site's global.php) is the forum's global include and I check to see if $bbuserinfo[userid] is available, and then grab their username/etc.
Further down, I do some non-related db queries and such. So my global.php looks like this...
chdir("/home/virtual/site1/fst/var/www/html/forums");
require_once("./global.php");
if ($bbuserinfo[userid] != 0) {
$userid = $bbuserinfo[userid];
$username = $bbuserinfo[username];
}
And below this I open a db connection and run some non-related queries.
But that shouldn't affect anything right? Once the forum global is called, then that user should show up in WOL?
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.