I just finished getting this script up and running on our site. I ran into the same problems many of you did with the script reporting far more members than the forums did. I've got a fix that's working for me and my version of the hack reports the same number of members and guests as the forums do. I replaced lines 69-74 of the script that read like this:
Quote:
} else {
$regmembers = mysql_query("SELECT DISTINCT COUNT(userid) AS membersonline FROM session WHERE userid>0 AND lastactivity>$datecut") or die("oops2");
while($members = mysql_fetch_array($regmembers)) {
$regmemberson = number_format($members[membersonline]);
}
}
|
and I replaced them with these lines:
Quote:
} else {
// Added by SS
$regmemberson=0;
$loggedins=mysql_query("SELECT DISTINCT session.userid,username,invisible,usergroupid
FROM session
LEFT JOIN user ON (user.userid=session.userid)
WHERE session.userid>0 AND session.lastactivity>$datecut
ORDER BY invisible ASC, username ASC");
while ($loggedin=mysql_fetch_array($loggedins)) {
$regmemberson++;}
// $regmembers = mysql_query("SELECT DISTINCT COUNT(*) AS membersonline FROM session WHERE userid>0 AND lastactivity>$datecut") or die("oops2");
// while($members = mysql_fetch_array($regmembers)) {
// $regmemberson = number_format($members[membersonline]);
// }
}
|
I'm also attaching a copy of the full script as I'm running it (except with the admin directory name changed at the top. My version is in a vertical table approximately 95 pixels wide that I put on the side of the site. I've only done that for the list of statistics only - I didn't mess with the username list part.
Basically all I did was take the code out of the index.php file that was used for counting up the users and modified the variables and plugged it in there. Hopefully this will help you guys get it up and running and useful. I suppose there's a possibility that more errors will show up but I've been watching mine for 45 minutes now and it's been consistent that entire time.
-Steve St.Laurent
Webmaster of
http://www.turbodieselregister.com