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)

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 ;)


All times are GMT. The time now is 05:23 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.01212 seconds
  • Memory Usage 1,749KB
  • 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
  • (1)bbcode_code_printable
  • (2)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (3)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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