The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
Comments |
#12
|
|||
|
|||
we need testwho as a .txt file or it just opens.
|
#13
|
|||
|
|||
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> |
#14
|
|||
|
|||
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; Code:
eval("\$loggedinusers = \"".gettemplate("loggedinusers")."\";"); Ben |
#15
|
|||
|
|||
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 |
#16
|
|||
|
|||
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. |
#17
|
|||
|
|||
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 |
#18
|
|||
|
|||
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] |
#19
|
|||
|
|||
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 |
#20
|
|||
|
|||
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 ???? |
#21
|
|||
|
|||
I tested Wajones plan and it worked!
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|