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