vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.0 Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=33)
-   -   Who's online on non-vB page (with usernames, same rules as Who's Online on forumhome) (https://vborg.vbsupport.ru/showthread.php?t=60019)

lifesourcerec 04-30-2004 09:22 PM

It works, but everything is crammed in. How can I fix this?

boiboi 05-10-2004 03:31 AM

works great but i already have a require for my image upload script.

require_once("show_image.php");
require_once("online.php");

doesn't work together. is there any work around to this?

Gary King 05-10-2004 11:19 AM

Quote:

Originally Posted by boiboi
works great but i already have a require for my image upload script.

require_once("show_image.php");
require_once("online.php");

doesn't work together. is there any work around to this?

Just remove the 'print' line from the online.php file and then put that wherever you want this list of online users to show up :)

JAB Creations 05-26-2004 06:40 AM

I want the code to tell me how many people are on my entire site, not just VB.

What code would I put in my PHP files to tell VB that people are not signed on (or are) and that they are looking at those pages?

That way my entire site will have this script tell me how many people are on my site in absolute total!

Gary King 05-26-2004 11:09 AM

Use
PHP Code:

<?php require_once('./forum/global.php'); ?>

in every file (for the vB global.php file)

JAB Creations 05-26-2004 01:00 PM

Well now I've figured out what is wrong...

There are two things I want to do at once and I can at the moment only do either or.

This one will show me where users are when I goto the whose online? page.
<?php chdir("/home/jabcreat/public_html/community");
require_once('global.php'); ?>

This will display how many users are online, but NOT others on no-VB pages.
<?php chdir("/home/jabcreat/public_html/community");
require_once("online_external.php");?>

The problem is, you're either on VB and CANT see how many are on....
OR
You're NOT on VB but you CAN see how many people are on....

When I attempt to use both I recieve the following error...

Fatal error: Cannot redeclare iif() (previously declared in /home/jabcreat/public_html/community/includes/functions.php:318) in /home/jabcreat/public_html/community/online_external.php on line 10

So how do I get over my current comprimise?

skinvb 06-02-2004 02:25 PM

i want it show on sidebar how can i do that?
i add
Code:

<table cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" style="width:100%">
        <tr align="center">
                <td class="thead"><span class="smallfont"><b>Online</b></span></td>
        </tr>
        <tr>
                <td class="alt1">
<?php

print $show;

?>
<?php

require_once("online_external.php");

?>
</td>
        </tr>
</table>

but it doesn't work

Baptizer 07-08-2004 02:36 AM

I am hoping Gary King is still around *crosses fingers*
Gary, any idea why I am getting the following results?
Members online: 00, 0, 0, 0, 0, 0, 0, 0, 0. Guests online: 26.

I tried to play with a few of the options, but I cant figure it out :(

Baptizer 07-09-2004 12:38 AM

Anyone else have a wild guess as to why this is occurring?

jugo 07-15-2004 06:09 PM

SKINVB

You have to
require the script first
then print show

I hope you understand that.

Baptizer....

I got the same thing...my solution...don't use online_external.php.

Instead use online.php

It took me a little bit but it worked...

ceck it out in my footer.

http://www.s3squad.com

misterfade 08-10-2004 10:08 PM

This hack is very good, but does anyone know how to show just the total number of registered members? I would really like this.

Thanks.

Toneboy 08-11-2004 07:17 PM

misterfade, if you know how to connect to your MySql database this query gets the registered number of users on your site:
PHP Code:

$result mysql_query("SELECT * FROM user"); 
if(!(
$result)) { 
 print 
"Useronline Select Error > "

$totalusers mysql_num_rows($result);
echo 
"<p class=\"feed\"><b>Total members:</b> $totalusers<br />"

Very basic, seen in action here.

TYorke 09-14-2004 05:37 AM

Quote:

Originally Posted by juanph
SKINVB

You have to
require the script first
then print show

I hope you understand that.

Baptizer....

I got the same thing...my solution...don't use online_external.php.

Instead use online.php

It took me a little bit but it worked...

ceck it out in my footer.

http://www.s3squad.com

Yup, I concur :D

It worked on my site as well...I added the require_once bit at the very top of my HTML page (even before the <html> tag) then, wherever I wanted to display the online info I just added the print command. Basically the code on your page 'should' look like:

<?php require_once('/path/to/script'); ?>
<html>
<head>
</head>
<body>
....

(somewhere on your page you may now add:) <?php print $show ?>

Of course you have to name your page something like index.php (the extension is what matters here)

Hope that made it clear to everyone. Oh and yes, I am using online.php :)

TYorke 09-24-2004 06:03 AM

BTW is there any way of adding links to user profiles?

JAB Creations 09-24-2004 08:00 AM

Members names are linked on my vb and its slightly hacked. Are you asking ahead of time or do you not see your members linked?

TYorke 09-24-2004 01:12 PM

Quote:

Originally Posted by JAB Creations
Members names are linked on my vb and its slightly hacked. Are you asking ahead of time or do you not see your members linked?

What vB? and no I don't see them linked.

Wordplay 10-18-2004 07:28 PM

is there a way to add the direct link to where the user is? because it just says on all the pages i added, that the member is viewing the startpage. no matter where they are.

Jag 11-08-2004 06:34 PM

I had to make a number of modifications to get this hack to work on my site (it's not very friendly with other scripts, changing dir, without changing back, not closing the mysql connection, etc... not good coding practices for something that's meant to work with meant other code).

However, after fixing it up, it works fine, and I've installed it :)

TMXS 12-21-2004 12:50 PM

I've installed the script and it works perfectly. Great job.

nicedreams 01-06-2005 11:08 PM

I'm able to get the online_external version working somewhat, but when it try to show usernames online, it always says (none). When i switch it to not show the user name, it shows the correct number of members online. What's wrong?

Jim

ryancooper 01-27-2005 01:49 PM

Love it. . Installed It. . . Have One Question,


I am using online.php. The members usernames and guests all show up. . . is it a possability to link each members usernames to there profile?

ThankS!1

MentaL 04-15-2005 11:27 PM

Anyway of having it show total users online rather than say members and guests.. so it appears

Users online: 302

CrimsonGT 04-22-2005 10:40 PM

It worked fine, but it threw off my alignment on the whole page. I have it all centered and when I included the file it made everything left aligned.

Also, is there anyway I can change the way it formats it? I want it to say like...

-Members Online: 23
-Visitors Online: 2

Basically is it possible just to pull the numbers out? Also, would it be possible to find the total number of members?

JohnBee 05-23-2005 01:16 PM

This works as advertised.

I am hoping to replicate my forum who's online style.
What would it take to get it looking like this:

Quote:

Active users online: 2 (2 members and 0 guests)
JohnBee, testuser

Most users ever online was 20, 05-02-2005 at 02:50 PM.
Any help would be greatly appreciated.

JohnBee 05-23-2005 04:56 PM

Okay I modded the script somewhat to create the above mentioned look but
I'm stuck on the Most users online bit.

heres my code thus far:

Code:

<?php

error_reporting(E_ALL & ~E_NOTICE);
require_once("./global.php");
$datecut = time()-$vboptions['cookietimeout'];

        $regmembername = $DB_site->query("SELECT DISTINCT username,options FROM ".$tableprefix."user,".$tableprefix."session
                WHERE ".$tableprefix."session.userid=".$tableprefix."user.userid AND ".$tableprefix."session.lastactivity>$datecut
                ORDER BY username ASC") or exit("oops2");
               
        while($regmember = $DB_site->fetch_array($regmembername))
        {
                $regmember['options'] = intval($regmember['options']);
               
                foreach($_USEROPTIONS as $optionname => $optionval)
                {
                        $regmember["$optionname"] = iif($regmember['options'] & $optionval, 1, 0);
                }
               
                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 = "*";
                        }
                                               
                        $regmemberson .= $regmember['username'].$userinvisible;
                       
                } else {
                        $regmembercomma++;
                }
        }
       
        if (!$regmemberson)
        {
                $regmemberson = "(none)";
        }
       
        $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");
        $regmembersno = number_format($regmembers['membersonline']);

$guests = $DB_site->query_first("SELECT COUNT(userid) AS guestsonline FROM ".$tableprefix."session WHERE userid=0 AND ".$tableprefix."session.lastactivity>$datecut") or exit("oops4");
$guestson = number_format($guests['guestsonline']);
$totalonline = $regmembersno + $guestson;

print 'Active users online: '.$totalonline.' ('.$regmembersno.' users and '.$guestson.' guests online.)';
echo "<br>$regmemberson";

?>

I removed all the extra's to help clear up things while manipulating the code.
I was thinking of pulling the data from the original /forum/online.php file
but I am uncertain of the approach to use, the code seems fairly long to
me and I'm pretty sure it can be reduced :)

any help would be greatly appreciated. thx

hypnoticpimp 06-16-2006 02:31 PM

i get MYSQL errors
Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'nobody'@'localhost' (using password: NO) in /home/wshh/public_html/online_external.php on line 14

Warning: mysql_select_db() [function.mysql-select-db]: Access denied for user 'nobody'@'localhost' (using password: NO) in /home/wshh/public_html/online_external.php on line 15

I use vbulletin 3.5.4

Zidane007nl 06-20-2006 09:55 PM

The version doesn't work with vB 3.5.x I think then. You're posting in a topic from more than 1 year old and vB 3.5.x wasn't released back then.

hypnoticpimp 06-20-2006 10:24 PM

do u know any mods for 3.5.4 that can show whos online stats on a non vb page

napy8gen 07-11-2006 01:02 PM

Hi Gary King ..any plan to update this hack to 3.5.4 or next 3.6 ?

dstjohn 08-12-2006 03:41 AM

Not sure what happend to Gary since he hasnt posted on this hack
in quite some time, but fixing it to work with 3.5.4 was easy,
below are my changes to online_external.php

search for
PHP Code:

mysql_connect($servername,$dbusername,$dbpassword);
mysql_select_db($dbname); 

and either comment that out or completely replace it with this.

PHP Code:

mysql_connect($config['MasterServer']['servername'],$config['MasterServer']['username'],$config['MasterServer']['password']);
mysql_select_db($config['Database']['dbname']); 

Which will then produce the following output
Member online: X. Guest online: X.

Place the script outside your forums directory obviously ;)

dstjohn 08-12-2006 03:52 AM

Forgot to mention you need to run through the entire script
and do a search and replace.

search for all instances of $tableprefix

and replace with
$config['Database']['tableprefix']

dstjohn 08-12-2006 03:57 AM

PHP Code:

<?php

//VARS, edit to your vb environment
$path "./forums/";             // path to your forums folder, normally /forum/
$showusernames 0;         // valid settings TRUE = yes show usernames FALSE = dont show usernames
//stop vars

chdir($path);
require_once(
"./includes/config.php");

function 
iif($expression$returntrue$returnfalse '') {
    return (
$expression $returntrue $returnfalse);
}

mysql_connect($config['MasterServer']['servername'],$config['MasterServer']['username'],$config['MasterServer']['password']);
mysql_select_db($config['Database']['dbname']);



$settings mysql_query("SELECT * FROM ".$config['Database']['tableprefix']."setting WHERE varname = 'cookietimeout'");
$settings mysql_fetch_array($settings);

$datecut time()-$settings['value'];

if (
$showusernames == 1)
{
    
$regmembers mysql_query("SELECT DISTINCT username,options FROM ".$config['Database']['tableprefix']."user,".$config['Database']['tableprefix']."session 
        WHERE "
.$config['Database']['tableprefix']."session.userid=".$config['Database']['tableprefix']."user.userid AND ".$config['Database']['tableprefix']."session.lastactivity>$datecut 
        ORDER BY username ASC"
) or exit("oops2");
        
    while(
$regmember mysql_fetch_array($regmembers))
    {
        
$regmember['options'] = intval($regmember['options']);
        
        foreach(
$regmember as $optionname => $optionval)
        {
            
$regmember["$optionname"] = iif($regmember['options'] & $optionval10);
        }
        
        if (((
$regmember['invisible'] == 0)) and $regmemberson or ($bbuserinfo['usergroupid'] == and $regmember['invisible'] == 1))
        {
            
$regmemberson .= ", ";
        }
    
        
$regmembercomma++;
        if (
$regmember['invisible'] == or $bbuserinfo['usergroupid'] == 6) {
            if (
$regmember['invisible'] == 1) {
                
$userinvisible "*";
            }
                        
            
$regmemberson .= $regmember['username'].$userinvisible;
        } else {
            
$regmembercomma++;
        }
    }
    
    if (!
$regmemberson)
    {
        
$regmemberson "(none)";
    }
        
} else {
    
$regmembers mysql_query("SELECT COUNT(DISTINCT userid) AS membersonline FROM ".$config['Database']['tableprefix']."session WHERE userid>0 AND ".$config['Database']['tableprefix']."session.lastactivity>$datecut") or exit("oops3");
    
$regmembers mysql_fetch_array($regmembers);
    
    
$regmemberson number_format($regmembers['membersonline']);
}

$howmany substr_count($regmemberson,",");

if ((
$showusernames == and $howmany >= 1) or ($showusernames == and $regmemberson 1))
{
    
$memberstext 'Members';
}
else
{
    
$memberstext 'Member';
}

$guests mysql_query("SELECT COUNT(userid) AS guestsonline FROM ".$config['Database']['tableprefix']."session WHERE userid=0 AND ".$config['Database']['tableprefix']."session.lastactivity>$datecut") or exit("oops4");
$guests mysql_fetch_array($guests);

if (
$guests['guestsonline'] > 1)
{
    
$gueststext 'Guests';
}
else
{
    
$gueststext 'Guest';
}
$guestson number_format($guests['guestsonline']);

$show $memberstext.' online: '.$regmemberson.'. '.$gueststext.' online: '.$guestson.'.';

print 
$show;

?>


vol_freak 08-21-2006 02:02 PM

Quote:

Originally Posted by dstjohn
PHP Code:

<?php

//VARS, edit to your vb environment
$path "./forums/";             // path to your forums folder, normally /forum/
$showusernames 0;         // valid settings TRUE = yes show usernames FALSE = dont show usernames
//stop vars

chdir($path);
require_once(
"./includes/config.php");

function 
iif($expression$returntrue$returnfalse '') {
    return (
$expression $returntrue $returnfalse);
}

mysql_connect($config['MasterServer']['servername'],$config['MasterServer']['username'],$config['MasterServer']['password']);
mysql_select_db($config['Database']['dbname']);



$settings mysql_query("SELECT * FROM ".$config['Database']['tableprefix']."setting WHERE varname = 'cookietimeout'");
$settings mysql_fetch_array($settings);

$datecut time()-$settings['value'];

if (
$showusernames == 1)
{
    
$regmembers mysql_query("SELECT DISTINCT username,options FROM ".$config['Database']['tableprefix']."user,".$config['Database']['tableprefix']."session 
        WHERE "
.$config['Database']['tableprefix']."session.userid=".$config['Database']['tableprefix']."user.userid AND ".$config['Database']['tableprefix']."session.lastactivity>$datecut 
        ORDER BY username ASC"
) or exit("oops2");
        
    while(
$regmember mysql_fetch_array($regmembers))
    {
        
$regmember['options'] = intval($regmember['options']);
        
        foreach(
$regmember as $optionname => $optionval)
        {
            
$regmember["$optionname"] = iif($regmember['options'] & $optionval10);
        }
        
        if (((
$regmember['invisible'] == 0)) and $regmemberson or ($bbuserinfo['usergroupid'] == and $regmember['invisible'] == 1))
        {
            
$regmemberson .= ", ";
        }
    
        
$regmembercomma++;
        if (
$regmember['invisible'] == or $bbuserinfo['usergroupid'] == 6) {
            if (
$regmember['invisible'] == 1) {
                
$userinvisible "*";
            }
                        
            
$regmemberson .= $regmember['username'].$userinvisible;
        } else {
            
$regmembercomma++;
        }
    }
    
    if (!
$regmemberson)
    {
        
$regmemberson "(none)";
    }
        
} else {
    
$regmembers mysql_query("SELECT COUNT(DISTINCT userid) AS membersonline FROM ".$config['Database']['tableprefix']."session WHERE userid>0 AND ".$config['Database']['tableprefix']."session.lastactivity>$datecut") or exit("oops3");
    
$regmembers mysql_fetch_array($regmembers);
    
    
$regmemberson number_format($regmembers['membersonline']);
}

$howmany substr_count($regmemberson,",");

if ((
$showusernames == and $howmany >= 1) or ($showusernames == and $regmemberson 1))
{
    
$memberstext 'Members';
}
else
{
    
$memberstext 'Member';
}

$guests mysql_query("SELECT COUNT(userid) AS guestsonline FROM ".$config['Database']['tableprefix']."session WHERE userid=0 AND ".$config['Database']['tableprefix']."session.lastactivity>$datecut") or exit("oops4");
$guests mysql_fetch_array($guests);

if (
$guests['guestsonline'] > 1)
{
    
$gueststext 'Guests';
}
else
{
    
$gueststext 'Guest';
}
$guestson number_format($guests['guestsonline']);

$show $memberstext.' online: '.$regmemberson.'. '.$gueststext.' online: '.$guestson.'.';

print 
$show;

?>



Anyone know how to get this to work with 3.6? It will display the number of members and guests online but I cannot get it to list the member names.

Any help would be greatly appreciated.

shortbus1662 08-25-2006 03:09 AM

is there any way to get this to work on a non .php page, like asp for instance?

If anyone can do this I'd love to speak with you.

danward 02-20-2007 02:18 PM

Great update dstjohn!! Would be great to get the usernames to work on 3.6 aswell!!

davidallsop 04-25-2007 11:04 AM

Is there anyway of getting the members online to display in the latest version of vBulletin? as Im looking for something a bit more than just the members online count.

zaraz 11-14-2007 08:31 PM

Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /home/c/..................../forum/online_external.php on line 19

:confused:

Andy92 01-08-2008 06:30 PM

This wont work in 3.7.

??

Paul M 01-08-2008 06:47 PM

Not a chance, this was written for vb 3.0.

Andy92 01-13-2008 07:01 PM

Can anyone help me work out how i can display this on a non vbulletin page, with vbulletin 3.7 ??


All times are GMT. The time now is 01:07 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
  • Page Generation 0.01640 seconds
  • Memory Usage 1,949KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_code_printable
  • (6)bbcode_php_printable
  • (5)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete