Overgrow
03-12-2001, 10:00 PM
Object: display the highest number of user sessions your board has ever had.
Disclaimer: for snyx.. I don't use 2.0 so I have no idea if anything has changed. This is for 1.x and I have NOT tested this. I wrote it at work and decided to post it since you needed it ASAP. It's something I will use as well, but I can't install and test until later tonight. There is a good chance this will work on 2.0 if it hasn't changed in this area.
1) Create table
CREATE TABLE highsessions (
high int(10) unsigned DEFAULT '0' NOT NULL,
timestamp int(11) unsigned DEFAULT '0' NOT NULL,
PRIMARY KEY (high)
);
2) Modify your index.php. Find:
if ($displayloggedin==1) {
$datecut=time()-$cookietimeout;
$loggedins=$DB_site->query_first("SELECT COUNT(sessionid) AS sessions FROM session");
$totalonline=$loggedins[sessions];
and under it, ADD:
// record high sessions hack
$oldhighsessions=$DB_site->query_first("SELECT high,timestamp FROM highsessions");
$numberoldhigh=$oldhighsessions[high];
$timeoldhigh=date("M j, Y G:i",$oldhighsessions[timestamp]);
if ($totalonline > $numberoldhigh) {
$DB_site->query("UPDATE highsessions SET high='$totalonline',timestamp='".time()."'");
$numberoldhigh = $totalonline;
$timeoldhigh="right now!";
}
// end high sessions hack
3) Open your forumhome template and use the variable $numberoldhigh wherever you want to display your "record" number of sessions. Use $timeoldhigh to display the date of that record.
enjoy
Disclaimer: for snyx.. I don't use 2.0 so I have no idea if anything has changed. This is for 1.x and I have NOT tested this. I wrote it at work and decided to post it since you needed it ASAP. It's something I will use as well, but I can't install and test until later tonight. There is a good chance this will work on 2.0 if it hasn't changed in this area.
1) Create table
CREATE TABLE highsessions (
high int(10) unsigned DEFAULT '0' NOT NULL,
timestamp int(11) unsigned DEFAULT '0' NOT NULL,
PRIMARY KEY (high)
);
2) Modify your index.php. Find:
if ($displayloggedin==1) {
$datecut=time()-$cookietimeout;
$loggedins=$DB_site->query_first("SELECT COUNT(sessionid) AS sessions FROM session");
$totalonline=$loggedins[sessions];
and under it, ADD:
// record high sessions hack
$oldhighsessions=$DB_site->query_first("SELECT high,timestamp FROM highsessions");
$numberoldhigh=$oldhighsessions[high];
$timeoldhigh=date("M j, Y G:i",$oldhighsessions[timestamp]);
if ($totalonline > $numberoldhigh) {
$DB_site->query("UPDATE highsessions SET high='$totalonline',timestamp='".time()."'");
$numberoldhigh = $totalonline;
$timeoldhigh="right now!";
}
// end high sessions hack
3) Open your forumhome template and use the variable $numberoldhigh wherever you want to display your "record" number of sessions. Use $timeoldhigh to display the date of that record.
enjoy