///////////// CHANGE LOG /////////////
//
// New in version 0.0.2
// -- Option to display either usernames or just a number of registered members online
//
// New in version 0.0.1
// -- Released!
//
/////////// END CHANGE LOG ///////////
//////// CONFIG EXPLANATION //////////
//
// There are only two config options in this script.
// First is whether or not you want usernames displayed for registered members who are on the board. If you opt to not display
// usernames, it will simply display the number of members. Guests are unaffected by this. If you want usernames displayed, set
// $usernames to "on" in the CONFIG section below. If you want a simple number, set it to "off".
// The second is the path to config.php (in the /admin directory of your forums). It MUST NOT include a leading *or* trailing slash.
// So, for example: Your config.php is in
// /home/mysite/public_html/board/admin/
// and you are putting this file into
// /home/mysite/public_html/directory/
// So your path is
// /home/mysite/public_html/board/admin
// Make sure you set this correctly. You can refer to the General Options in your Admin Control Panel if you need a refresher on
// your path.
//
////// END CONFIG EXPLANATION ////////
/////////////// CONFIG ///////////////
//
$usernames = "on"; // if you would like it to display the names of registered members who are on, leave this set to "on".
// if you want just a number of members, change it to "off".
$path = "/home/dadymac/public_html/forums/forum/admin"; // set the path to your admin directory. see above for info about this.
//
///////////// END CONFIG /////////////
$cookievalue = mysql_query("SELECT value FROM setting WHERE varname = 'cookietimeout'") or die("oops1");
$cookietimeout = mysql_result($cookievalue, 0, 0);
$datecut = time()-$cookietimeout;
$invisibleregmember = "0";
if ($usernames == "on") {
$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") or die("oops2");
while($regmember = mysql_fetch_array($regmembers)):
++$regmembercomma;
if ($regmember[invisible] == 0) {
$regmemberson .= $regmember[username];
} else {
++$regmembercomma;
}
if ($regmembercomma < mysql_num_rows($regmembers)):
$regmemberson .= ", ";
endif;
endwhile;
} else {
$regmembers = mysql_query("SELECT DISTINCT COUNT(userid) AS membersonline FROM session WHERE userid>0 AND session.lastactivity>$datecut") or die("oops2");
while($members = mysql_fetch_array($regmembers)) {
$regmemberson = number_format($members[membersonline]);
}
}
$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;
echo("<B>Member(s) currently in the forums:</B><br><br><font color=\"#CCCCFF\">$regmemberson</font><br><br><B>Number of Guest(s) in the forums:</B> $guestson.");
?>
is there a conflict somewhere? in the left colum, it will mess up the center.
in the right, it works, but i cant have it above certain blocks.
i guess its ok, i have it i the right bottom, at least it is there
VOILLA! just save that as block-whatever.php in your blocks folder, then include it as a phpnuke block. The 20000 is a number I picked - it has to do with how far php reads the file (how many bytes). If the number is too low it'll cut off the output.