vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Member Archives (https://vborg.vbsupport.ru/forumdisplay.php?f=202)
-   -   how to include active user info in non-vb page ? (https://vborg.vbsupport.ru/showthread.php?t=2710)

08-25-2000 07:50 PM

how do i include active user info on this page http://www.animeboards.net

something like

Currently xx members and xx guests viewing this forum

and to have the words member and guest hyperlinked to forums/index.php#active

[Edited by eva2000 on 08-25-2000 at 05:12 PM]

08-26-2000 10:34 AM

pretty please.... :D

08-26-2000 12:53 PM

I'll help you - contact me via ICQ:73902680 or AIM: phpBulletin

08-26-2000 01:15 PM

thanks i sent you an email cause my ICQ doesn't connect properly anymore :(

08-26-2000 05:38 PM

well i still need a bit of help... thanks to shri who sent me this code which works at
http://animeboards.net/activeusers.shri.php3
Code:

<?
 require("/home/usr1/www.animeboards.net/htdocs/forums/admin/config.php");
 chdir("/home/usr1/www.animeboards.net/htdocs/forums");
 require("/home/usr1/www.animeboards.net/htdocs/forums/global.php");

  if ($displayloggedin==1) {
    $datecut=time()-$cookietimeout;
    $loggedins=$DB_site->query_first("SELECT COUNT(sessionid) AS sessions FROM session");
    $totalonline=$loggedins[sessions];
    $loggedins=$DB_site->query_first("SELECT COUNT(sessionid) AS sessions FROM session WHERE userid=0");
    $numberguest=$loggedins[sessions];
    $loggedins=$DB_site->query_first("SELECT COUNT(sessionid) AS sessions FROM session WHERE userid<>0");
    $numberregistered=$loggedins[sessions];

    $numbervisible=0;
    $loggedins=$DB_site->query("SELECT DISTINCT user.userid,username,location FROM user,session WHERE session.userid=user.userid AND session.userid<>0 AND invisible=0 AND usergroupid<>3 ORDER BY username");
    if ($loggedin=$DB_site->fetch_array($loggedins)) {
      $numbervisible++;
      $userid=$loggedin[userid];
      $username=$loggedin[username];
      $location=$loggedin[location];

      eval("\$activeusers .= \"".gettemplate("loggedinuser")."\";");

      while ($loggedin=$DB_site->fetch_array($loggedins)) {
        $numbervisible++;
        $userid=$loggedin[userid];
        $username=$loggedin[username];
        $location=$loggedin[location];
        eval("\$activeusers .= \", ".gettemplate("loggedinuser")."\";");
      }
    }
    $numberinvisible=$numberregistered-$numbervisible;
    eval("\$loggedinusers = \"".gettemplate("loggedinusers")."\";");
  }

echo $loggedinusers;
?>

i hazardly guessed and modified the echo part leaving intact the rest since i haven't a clue what it is
(don't know php just comparing other code from other stuff) and it works like how i want to at http://animeboards.net/activeusers.root.php3
Code:

<?
 require("/home/usr1/www.animeboards.net/htdocs/forums/admin/config.php");
 chdir("/home/usr1/www.animeboards.net/htdocs/forums");
 require("/home/usr1/www.animeboards.net/htdocs/forums/global.php");

  if ($displayloggedin==1) {
    $datecut=time()-$cookietimeout;
    $loggedins=$DB_site->query_first("SELECT COUNT(sessionid) AS sessions FROM session");
    $totalonline=$loggedins[sessions];
    $loggedins=$DB_site->query_first("SELECT COUNT(sessionid) AS sessions FROM session WHERE userid=0");
    $numberguest=$loggedins[sessions];
    $loggedins=$DB_site->query_first("SELECT COUNT(sessionid) AS sessions FROM session WHERE userid<>0");
    $numberregistered=$loggedins[sessions];

    $numbervisible=0;
    $loggedins=$DB_site->query("SELECT DISTINCT user.userid,username,location FROM user,session WHERE session.userid=user.userid AND session.userid<>0 AND invisible=0 AND usergroupid<>3 ORDER BY username");
    if ($loggedin=$DB_site->fetch_array($loggedins)) {
      $numbervisible++;
      $userid=$loggedin[userid];
      $username=$loggedin[username];
      $location=$loggedin[location];

      eval("\$activeusers .= \"".gettemplate("loggedinuser")."\";");

      while ($loggedin=$DB_site->fetch_array($loggedins)) {
        $numbervisible++;
        $userid=$loggedin[userid];
        $username=$loggedin[username];
        $location=$loggedin[location];
        eval("\$activeusers .= \", ".gettemplate("loggedinuser")."\";");
      }
    }
    $numberinvisible=$numberregistered-$numbervisible;
    eval("\$loggedinusers = \"".gettemplate("loggedinusers")."\";");
  }

echo "<FONT FACE=\"Verdana, Arial, Helvetica, sans-serif\" SIZE=\"1\">Currently $numberregistered <A HREF=\"http://animeboards.net/forums/index.php#active\">member(s)</A> and $numberguest <A HREF=\"http://animeboards.net/forums/index.php#active\">guest(s)</A> are on the forums.</font>";
?>

Problem is when i try to include it doesn't work and gives me 2 errors on http://animeboards.net/index4a.php3
(i removed the include for now)

i get this displayed

Fatal error: DB_Sql_vb is already a function or class in admin/db_mysql.php on line 6

and this sent to me via email

Database error in vBulletin: Invalid SQL: SELECT COUNT(sessionid) AS sessions FROM session WHERE userid=0
mysql error: Unknown column 'userid' in 'where clause'
mysql error number: 1054
Date: Saturday 26th of August 2000 01:21:46 PM
Script: /index4a.php3
Referer

08-27-2000 07:20 AM

anyone ?

08-27-2000 09:16 AM

This is just off the top of my head but it could be that you're including global.php in twice. Since DB_Sql_vb is already defined (possibly through config.php) including it again will bring up that error.

If you delete that file see what happens... or if it's not that, try to look for a file that is referenced twice by require -- that's probably you're answer :)

I do not know if the mysql error is related to the first one, but could be!

--red

08-27-2000 09:54 AM

thanks.. this is what i have in the index4a.php3 before the html tags

Code:

<?
 require("/home/usr1/www.animeboards.net/htdocs/forums/admin/config.php");
 require("/home/usr1/www.animeboards.net/htdocs/phpads/config.inc.php3");
 require("/home/usr1/www.animeboards.net/htdocs/phpads/view.inc.php3");
 require("/home/usr1/www.animeboards.net/htdocs/phpads/acl.inc.php3");
 chdir("/home/usr1/www.animeboards.net/htdocs/forums");
 require("/home/usr1/www.animeboards.net/htdocs/forums/global.php"); 
?>

and this is what i have in the activeusers.root.php3 file
Code:

chdir("/home/usr1/www.animeboards.net/htdocs/forums");
 require("/home/usr1/www.animeboards.net/htdocs/forums/global.php");
 require("/home/usr1/www.animeboards.net/htdocs/forums/admin/config.php");


08-27-2000 01:30 PM

change index4a.php's requires to this:
Code:

<?
 require("/home/usr1/www.animeboards.net/htdocs/phpads/config.inc.php3");
 require("/home/usr1/www.animeboards.net/htdocs/phpads/view.inc.php3");
 require("/home/usr1/www.animeboards.net/htdocs/phpads/acl.inc.php3");
 chdir("/home/usr1/www.animeboards.net/htdocs/forums");
 require("/home/usr1/www.animeboards.net/htdocs/forums/admin/config.php");
 require("/home/usr1/www.animeboards.net/htdocs/forums/global.php"); 
?>

And drop all the requires from activeusers.root.php3

08-27-2000 04:01 PM

thanks i did that i it came up with this error

Fatal error: DB_Sql_vb is already a function or class in admin/db_mysql.php on line 6

i did an exact copy of index4a.php3 named index4b.php3 except, removed all other php includes and the activeusers.root.php3 works

at http://www.animeboards.net/index4b.php3

but when i add back all the php includes to index4b.php3 i get the say error

Fatal error: DB_Sql_vb is already a function or class in admin/db_mysql.php on line 6


All times are GMT. The time now is 07:12 PM.

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.01095 seconds
  • Memory Usage 1,751KB
  • 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
  • (5)bbcode_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)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