Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > General > Member Archives
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Details »»

Version: , by (Guest)
Developer Last Online: Jan 1970 Show Printable Version Email this Page

Version: Unknown Rating:
Released: 01-01-2001 Last Update: Never Installs: 0
 
No support by the author.

I would like to include the $loggedinusers on a non VB page.

I assume that writing this data to a TXT file (and inserting it via SSI) everytime this data is modified would be a PAIN for the server as it may change several times per second when traffic is high... SO... what do you suggest?

Any of you guys could help?

I think that several peopel are trying to integrate vBulletin to sites as much as possible... I think that designwise it is the BEST board (onlineDJ.com looks great with the board, perfect integration) but it would be great to have an easy step by step help to show data to non VB pages, and to easily use the login of the board to other parts of the site.

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #12  
Old 01-02-2001, 08:55 PM
Guest
 
Posts: n/a
Default

we need testwho as a .txt file or it just opens.
Reply With Quote
  #13  
Old 01-02-2001, 09:01 PM
Guest
 
Posts: n/a
Default

Hi Chrispadfield.. I dident know if it was ok to post my code here...but this is what it looks like:


<html>

<HEAD>
<!-- Start Who's Online -->
Who's online Now:<br>


<?php

require("forum/global.php");

$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,session.location FROM user,session WHERE session.userid=user.userid AND session.userid<>0 AND invisible=0 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")."\";");

?>
<!-- End Who's onlone -->
</HTML>
Reply With Quote
  #14  
Old 01-02-2001, 09:19 PM
Guest
 
Posts: n/a
Default

It is retrieving the information just fine, but you do not have anything telling it to output the values of the variables.

Add:

Code:
echo $loggedinusers;
after

Code:
eval("\$loggedinusers = \"".gettemplate("loggedinusers")."\";");

Ben
Reply With Quote
  #15  
Old 01-02-2001, 09:24 PM
Guest
 
Posts: n/a
Default

Hi Ben,

I just added that in...still nothing. I think it's not even grabbing the global.php for some reason.

This file is in my root, and global is in /forum/global.pgp

so i put that code in like this:

require("/forum/global.php");

but still nothing.. An error message would be nice :-)

Stumped.

JackG
ClubFreestyle.com
Reply With Quote
  #16  
Old 01-02-2001, 10:12 PM
Guest
 
Posts: n/a
Default

it would post an error if it was not finding the file.

i thought it must be the output thing and was about to try it out but my ftp program keeps crashing so going to have to restart.

i will try again tomorrow to see if i can get it to work.
Reply With Quote
  #17  
Old 01-02-2001, 10:26 PM
Guest
 
Posts: n/a
Default

I'm new to PHP so I could be incorrect, but my thoughts are is that the code in "global.php" is trying to run in your HTTP root, and cannot find files that it needs. (Which are located in forum/admin).

I would suggest doing the following in order to get the user login information on your main page:

Step 1:
Create a file in your HTTP root named something like index_test.php and put this code in it:

Code:
<HTML>
<HEAD>
</HEAD>
<BODY>

Who's online Now:<BR>

<?php
chdir ("forum/");
require("testwho.php");
chdir("../");
/>

</BODY>
</HTML>

Step 2:
Put the file "testwho.php" into your /forum directory. The file should be changed to look like this: (Same as before, just removed the normal HTML parts, and the require statement uses the current path)

Code:
<?php 

<!-- Begin Who's online --> 

require("global.php"); 
$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,session.location FROM user,session WHERE session.userid=user.userid AND session.userid<>0 AND invisible=0 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;
?> 
<!-- End Who's online -->

Basically what is happening is the index_test.php file changes to the forum directory and runs the testwho.php file. The testwho.php file can now correctly get global.php, and in turn the global.php file can correctly retrieve the files it needs from the forum/admin directory. After this is all done, index_test.php changes back to the root again where it started.

Try running index_test.php from your HTTP root directory and see what happens...let me know if that does not work. I'm pretty new to PHP, so my method of doing this is probably more of a rigged fix than the proper way, but it's all I can figure out at the moment.

Ben
Reply With Quote
  #18  
Old 01-03-2001, 01:49 AM
Guest
 
Posts: n/a
Default

Hrmm.. I get this error:

Fatal error: Cannot redeclare class db_sql_vb in /www/egamers/forum/admin/db_mysql.php on line 25

Any ideas?

[EDIT]
Nevermind! I'm an idiot again.. I had a require("global.php"); in 2 files.. the file1 calls for global.php & file2.. file2 calls for global.php also
[/EDIT]

[Edited by _ on 01-02-2001 at 10:55 PM]
Reply With Quote
  #19  
Old 01-03-2001, 01:57 AM
Guest
 
Posts: n/a
Default

Sounds like the global.php file is being included twice. For the last info I posted the "require("global.php"); should only occur once.

Ben
Reply With Quote
  #20  
Old 01-03-2001, 03:10 AM
Guest
 
Posts: n/a
Default

I think if you create a new template say called "activeusers" and put something like this into it...

############

<br>
<table width="100%" border="0" cellpadding="1" cellspacing="0" bgcolor="#FFFFFF">

<TR bgcolor="#6c6081" id=cat><TD colspan=6>
<FONT face="verdana, arial, helvetica" size="2" color="#f5d300"><B>Currently Active Users:</B></font><br><FONT face="verdana,arial,helvetica" size="1" >There are currently $numberregistered member(s) and $numberguest guest(s) on the boards.</font></td>
</tr>
<tr>
<td>
<table width="100%%" border="0" cellpadding="2" cellspacing="0" bgcolor="#DEDEDE">
<tr>
<td align="left" valign="middle"><FONT face="verdana,arial,helvetica" size="1" >$activeusers</font></td>
</b></font></td>
</tr>
</table>
</td>
</tr>
</table>

############

Then call it with....

###########
eval("echo dovars(\"".gettemplate("active users")."\");");
###########

It may work ????
Reply With Quote
  #21  
Old 01-03-2001, 11:37 AM
Guest
 
Posts: n/a
Default

I tested Wajones plan and it worked!
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 04:40 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.10323 seconds
  • Memory Usage 2,290KB
  • Queries Executed 25 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (4)bbcode_code
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (3)pagenav_pagelink
  • (11)post_thanks_box
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (11)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete