Previous Thread
Next Thread
Print Thread
Rate Thread
Joined: Jun 2001
Posts: 3,273
That 70's Guy
That 70's Guy
Offline
Joined: Jun 2001
Posts: 3,273
I figured I should post this here also so that it's more evident.

In your ubbthreads.php script find this:

code:

// -----------------------
// Grab the total # online
$query = "
SELECT O_Type,COUNT(*)
FROM w3t_Online
GROUP BY O_Type
";
$sth = $dbh -> do_query($query);
while(list ($type,$count) = $dbh -> fetch_array($sth)) {
${$type} = $count;
}

if (!$a) { $a = "0"; }
if (!$r) { $r = "0"; }



and change it to this:

code:

// -----------------------
// Grab the total # online

$LastOn = $html -> get_date() - 600;// back 10 minutes

$query = "
SELECT O_Type,COUNT(*)
FROM w3t_Online
WHERE O_Last > '$LastOn'
GROUP BY O_Type
";
$sth = $dbh -> do_query($query);
while(list ($type,$count) = $dbh -> fetch_array($sth)) {
${$type} = $count;
}

$onNow = $a + $r;// part of "Maximum Users Online" hack

if (!$a) { $a = "0"; }
if (!$r) { $r = "0"; }


// --------------------------------
// Get and Set Maximum Users Online
$query = "
SELECT U_PostsPer,U_Registered
FROM w3t_Users
WHERE U_Number = '1'
";
$sth = $dbh -> do_query($query);
list ($maxOn,$When) = $dbh -> fetch_array($sth);
if ($onNow > $maxOn) {
$date = $html -> get_date();
$date_q = addslashes($date);
$onNow_q = addslashes($onNow);
$query = "
UPDATE w3t_Users
SET U_Registered = '$date_q', U_PostsPer = '$onNow_q'
WHERE U_Number = '1'
";
$dbh -> do_query($query);
$maxOn = $onNow;
$When = $date;
}
$When = $html -> convert_time($When,$user['U_TimeOffset']);




Now in your ubbthreads.tmpl template file find this:

code:

{$ubbt_lang['C_ONLINE']} $r {$ubbt_lang['C_ONLINE2']} $a {$ubbt_lang['C_ONLINE3']}
<br />



and change it to this:

code:

{$ubbt_lang['C_ONLINE']} $r {$ubbt_lang['C_ONLINE2']} $a {$ubbt_lang['C_ONLINE3']}
<br />
Maximum Users Online was <strong>$maxOn</strong> on $When
<br />



That should do it.

Example Here.


Note: This hack will only count those that have been online in the last 10 minutes. This is the same amount of time the "Who's Online" page uses so the information matches. I think that this will also make .threads extra information match my "Who's Online" box.

Sponsored Links
Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
Very cool!

Is there anything you can't do?

You're the man JustDave!

Joined: Jun 2002
Posts: 375
Enthusiast
Enthusiast
Offline
Joined: Jun 2002
Posts: 375
This one works good for me

Thanks!

Joined: Mar 2000
Posts: 21,080
Likes: 3
I type like Navaho
I type like Navaho
Joined: Mar 2000
Posts: 21,080
Likes: 3
thank you


- Allen wavey
- What Drives You?
Joined: Jun 2002
Posts: 375
Enthusiast
Enthusiast
Offline
Joined: Jun 2002
Posts: 375
I just hacked into the shortstatpal.php file that comes with the IIP 4.3 and added this to the bottom of the short stats. I basically just added the above code in and adjusted the spacing to match and moved the end of the table. It seems to work fine for me

The shortstatpal.php file ends with:

code:


$statsString .= "Totals:<BR><B>$palShowregs</B> Members<BR><B>$numReplies</B> Posts</TD></TR></TABLE>";
}

$html -> open_table(1);
echo "$statsString";
$html -> close_table();
echo "<BR>";
?>




Replace the above code with:

code:

$statsString .= "Totals:<BR><B>$palShowregs</B> Members<BR><B>$numReplies</B> Posts<BR><BR>";
}

// -----------------------
// Grab the total # online

$LastOn = $html -> get_date() - 600;// back 10 minutes

$query = "
SELECT O_Type,COUNT(*)
FROM w3t_Online
WHERE O_Last > '$LastOn'
GROUP BY O_Type
";
$sth = $dbh -> do_query($query);
while(list ($type,$count) = $dbh -> fetch_array($sth)) {
${$type} = $count;
}

$onNow = $a + $r;// part of "Maximum Users Online" hack

if (!$a) { $a = "0"; }
if (!$r) { $r = "0"; }


// --------------------------------
// Get and Set Maximum Users Online
$query = "
SELECT U_PostsPer,U_Registered
FROM w3t_Users
WHERE U_Number = '1'
";
$sth = $dbh -> do_query($query);
list ($maxOn,$When) = $dbh -> fetch_array($sth);
if ($onNow > $maxOn) {
$date = $html -> get_date();
$date_q = addslashes($date);
$onNow_q = addslashes($onNow);
$query = "
UPDATE w3t_Users
SET U_Registered = '$date_q', U_PostsPer = '$onNow_q'
WHERE U_Number = '1'
";
$dbh -> do_query($query);
$maxOn = $onNow;
$When = $date;
}
$When = $html -> convert_time($When,$user['U_TimeOffset']);

$statsString .= "Maximum Users Online:<BR><strong>$maxOn</strong> on $When</TD></TR></TABLE>";

$html -> open_table(1);
echo "$statsString";
$html -> close_table();
echo "<BR>";
?>



I tried to attach a copy of the shortstatpal.php file, but MySQL is freaking out and won't let me! LOL

Sponsored Links
Joined: Feb 2002
Posts: 1,759
Addict
Addict
Offline
Joined: Feb 2002
Posts: 1,759
When this hack is installed how long does it take for the stat to display a number/date? I've had the hack installed for about 5-10 minutes and it isn't listing a number yet.

Joined: Jun 2002
Posts: 375
Enthusiast
Enthusiast
Offline
Joined: Jun 2002
Posts: 375
It worked right away for me. It started the count at 1 (me on page) when installed, not from old data.

msula, I just looked at your forum, it looks like you are missing some of the code. I had mine look like that when I didn't have it all in there. The number and date are not being inserted into the page.

Joined: Feb 2002
Posts: 1,759
Addict
Addict
Offline
Joined: Feb 2002
Posts: 1,759
hrmm.. I thought the pot of coffee I just finished would help eliminate errors such as that.. I will double check my code. Thanks

Joined: Feb 2002
Posts: 1,759
Addict
Addict
Offline
Joined: Feb 2002
Posts: 1,759
ahhh... stupid

usually I'm copying and pasting from txt files, not from posts in the forum. For some reason when I pasted the code it just threw the code into one continuous line, which started out with a comment. So the whole hack was commented out. lol... anyway it is fixed. Thanks

Joined: Oct 2001
Posts: 157
Member
Member
Offline
Joined: Oct 2001
Posts: 157
Worked beautifully, thanks Dave!!


Yors Truly

Who? Me? Worry?
Sponsored Links
Joined: Aug 2002
Posts: 100
Journeyman
Journeyman
Offline
Joined: Aug 2002
Posts: 100
This is AWESOME... I have been looking for this feature for a LONG time in ubbthreads...

Does anyone know a way to throw this into the main index page of ubbthreads? Near the top of the page?

What a great hack...

Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
You can edit your ubbthreads.tmpl file (inside the /templates/default directory)

Just place this line:
code:
Maximum Users Online was <strong>$maxOn</strong> on $When



Between these two lines at the top:

code:
echo <<<UBBTPRINT
<!-- CATEGORY LOOP START -->


Joined: Jun 2002
Posts: 375
Enthusiast
Enthusiast
Offline
Joined: Jun 2002
Posts: 375
Here are updated directions for 6.1

Looks to be running fine for me so far...
Attachments
56553-Most_At_Once6.1.txt (0 Bytes, 42 downloads)


Link Copied to Clipboard
Donate Today!
Donate via PayPal

Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.

Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
Recommended Hosts
We have personally worked with and recommend the following Web Hosts:
Shock Hosting
Stable Host
bluehost
InterServer
Visit us on Facebook
Member Spotlight
Gizmo
Gizmo
Portland, OR, USA
Posts: 5,834
Joined: January 2000
Forum Statistics
Forums63
Topics37,583
Posts293,955
Members13,824
Most Online151,614
Nov 14th, 2025
Today's Statistics
Currently Online 722
Topics Created 0
Posts Made 0
Users Online 0
Birthdays 11
Top Posters
AllenAyres 21,080
JoshPet 10,369
LK 7,394
Lord Dexter 6,708
Gizmo 5,834
Greg Hard 4,625
Top Posters(30 Days)
Top Likes Received
isaac 82
Gizmo 20
Brett 7
WebGuy 2
Morgan 2
Top Likes Received (30 Days)
None yet
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2026 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 8.1.0
(Snapshot build 20260108)