Version: 1.00, by Gary King
Developer Last Online: Jun 2020
Version: 3.0.0
Rating:
Released: 01-09-2004
Last Update: Never
Installs: 64
No support by the author.
PLEASE CLICK ON THE INSTALL BUTTON IF YOU INSTALLED THIS! THANKS!
What does this hack do?
Using this hack, you can show who is currently on your forums from anywhere else on your website! The page, though, must be a PHP page.
If you want to display this information on another webpage by integrating it (which you'll probably want to ), just put
PHP Code:
<?php require_once("online.php"); ?>
or
PHP Code:
<?php
require_once("online_external.php");
?>
depending on the location of the online.php file
THE BELOW IS ONLY IF YOU ARE USING ONLINE.PHP
If you are using online.php, then this line of code MUST be at the top of the page!
If you don't want to show the total users online at the top of the page, though, then remove
PHP Code:
print $show;
and copy that to wherever you want to show the info instead (remember to surround this with PHP tags, such as:
PHP Code:
<?php
print $show;
?>
THE ABOVE IS ONLY IF YOU ARE USING ONLINE.PHP
Features
supports phrases!
option to display either usernames or a total number of registered members instead
only administrators can see users who choose to be invisible
Instructions
Download the attached online.php if you want to show invisible users to administrators, etc., or download online_external.php if you don't want to worry as much about things , and follow these instructions:
Find
PHP Code:
$path = "./vb3/"; // path to your forums folder, normally /forum/
, change the ./vb3/ to whatever the path is to your forums directory
Find
PHP Code:
$showusernames = 0; // 1 to show usernames online, 0 to only show the number of users online
and change $showusernames to 1 if you want to display usernames, instead of the total number of registered members browsing
That's it!
Show Your Support
This modification may not be copied, reproduced or published elsewhere without author's permission.
I had a similar problem when i made some external site stats for my board. I think it's counting the total number of sessions in the table for members rather than for each unique id
replace:
PHP Code:
SELECT DISTINCT COUNT(userid)
with:
PHP Code:
SELECT COUNT(DISTINCT userid)
And it should solve the incorrect count of members.
I had a similar problem when i made some external site stats for my board. I think it's counting the total number of sessions in the table for members rather than for each unique id
replace:
PHP Code:
SELECT DISTINCT COUNT(userid)
with:
PHP Code:
SELECT COUNT(DISTINCT userid)
And it should solve the incorrect count of members.
Okay could someone please confirm and if it is the correct query then let me know, I'll change in the instructions
What directory should online.php be located? I want all the names of the users online to be listed, so, I think I eed to use online.php. I tried putting it in the same directory as my files I want it to be displayed on, but it couldn't find the files it needed such as global.php. So, I tried to put it in the /forum directory, but it overwrote the online.php that vB needs, so I didn't want to do that.
Warning: chdir(): No such file or directory (errno 2) in /home/dp/public_html/beta/online.php on line 9
Warning: main(./includes/init.php): failed to open stream: No such file or directory in /home/dp/public_html/forum/global.php on line 18
Fatal error: main(): Failed opening required './includes/init.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/dp/public_html/forum/global.php on line 18
Online.php:
Quote:
<?php
error_reporting(E_ALL & ~E_NOTICE);
$path = "./forum/"; // path to your forums folder, normally /forum/
$showusernames = 1; // 1 to show usernames online, 0 to only show the number of users online
$datecut = time()-$vboptions['cookietimeout'];
if ($showusernames == 1)
{
$regmembers = $DB_site->query("SELECT DISTINCT username,options FROM ".$tableprefix."user,".$tableprefix."session
WHERE ".$tableprefix."session.userid=".$tableprefix."use r.userid AND ".$tableprefix."session.lastactivity>$datecut
ORDER BY username ASC") or exit("oops2");
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 = "*";
}
} else {
$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");