So very nearly there. I have managed to get the online users on a non VB page thing working well,
heres what it looks like
However the code doesn't show the total online users figure
$totalonline Can anyone help me with that code?
Heres the code sofar
PHP Code:
<?
{
require("/home/admin/www/forums/admin/config.php");
$db=mysql_connect($servername,$dbusername,$dbpassword) or die("Can't open connection to MySQL");
mysql_select_db($dbname) or die("Can't select database");
$cookievalue = mysql_query("SELECT value
FROM setting
WHERE varname = 'cookietimeout'");
$cookietimeout = mysql_result($cookievalue, 0, 0);
$datecut = time()-$cookietimeout;
$invisibleregmember = "0";
$regmembers = mysql_query("SELECT DISTINCT username,invisible
FROM user,session
WHERE session.userid=user.userid AND session.lastactivity>$datecut AND invisible='0'
ORDER BY username ASC");
while($regmember = mysql_fetch_array($regmembers)):
++$regmemberbr;
if ($regmember[invisible] == 0) {
$regmemberson .= "$regmember[username]";
} else {
++$regmemberbr;
}
if ($regmemberbr < mysql_num_rows($regmembers)):
$regmemberson .= ", ";
endif;
endwhile;
$guests = mysql_query("SELECT COUNT(userid) AS guestsonline FROM session WHERE userid=0 AND session.lastactivity>$datecut") or die("oops3");
while($guest = mysql_fetch_array($guests)):
$guestson = number_format($guest[guestsonline]);
endwhile;
if ($regmemberson == "") {
$onlinemembers = "<p>No Registered Members</p>";
} else {
$onlinemembers = "Members Online: $regmemberson";
}
if ($guestson == "0") {
$onlineguests = "No Guests";
} else {
$onlineguests = " and $guestson guests: ";
}
print "<font size=\"1\">$onlinemembers $onlineguests</font>";
}
?>