Previous Thread
Next Thread
Print Thread
Rate Thread
Joined: Aug 2000
Posts: 262
Enthusiast
Enthusiast
Offline
Joined: Aug 2000
Posts: 262
Description: This hack allows you to know what the most amount of users on your forums is at one time. it could be configured to show most guests and most users, but for now it just counts all. remember to backup all changed files before adding this hack. I am not responsible for anything bad that happens, apply this hack at your own risk. for updating purposes i am going to put this up on my server. Instructions please post questions/problems here. you can see an example of what it looks like at my forums Here

Sponsored Links
Joined: Jun 2000
Posts: 190
Enthusiast
Enthusiast
Joined: Jun 2000
Posts: 190
Poil,

[:blue]now you are going to create a table:
w3t_Total with one column Total (int) default 0.

CREATE TABLE w3t_Total(Total INT(4) DEFAULT '0');

Does that go in the "online.php" file just below what precedes it in the "Instructions"?

Jeff


Artificial Intelligence is no match for natural stupidity!
Joined: Aug 2000
Posts: 262
Enthusiast
Enthusiast
Offline
Joined: Aug 2000
Posts: 262
uhm....create that table in mysql. i knew that line would mess people up. go into you admin screen in your forums and click on the database manager and then click on the SQL command link. in that form type in CREATE TABLE w3t_Total(Total INT(4) DEFAULT '0') and click on submit, then press the back button and type in INSERT INTO w3t_dTotal(Total) VALUES (0) and that should do it for ya. updating instructions.

Joined: Aug 2000
Posts: 1,290
Addict
Addict
Offline
Joined: Aug 2000
Posts: 1,290
shouldn't the main.inc.php be ubbt.inc.php? (version 5.46)


- Custom Web Development
http://www.JCSWebDev.com
Joined: Aug 2000
Posts: 262
Enthusiast
Enthusiast
Offline
Joined: Aug 2000
Posts: 262
shoot, i havn't downloaded the new version.....so, yes. updated installation instructions.

Sponsored Links
Joined: Jun 2000
Posts: 190
Enthusiast
Enthusiast
Joined: Jun 2000
Posts: 190
What a guy! []https://www.ubbdev.com/threads/php/images/icons/smile.gif[/] Your new instructions worked fine with one slight adjustment! hehe

The second MySQL entry is: INSERT INTO w3t_[:red]dTotal(Total) VALUES (0)

Remove the "d" and it works great! []https://www.ubbdev.com/threads/php/images/icons/wink.gif[/]

Jeff


Artificial Intelligence is no match for natural stupidity!
Joined: Aug 2000
Posts: 1,290
Addict
Addict
Offline
Joined: Aug 2000
Posts: 1,290
Yup, works fine smile


- Custom Web Development
http://www.JCSWebDev.com
Joined: Aug 2000
Posts: 262
Enthusiast
Enthusiast
Offline
Joined: Aug 2000
Posts: 262
ehh gad. Instructions Updated. Stupid running tests to see if it works and forget about changing it back. Now, if you want to display that number elsewhere. like on the main page or something you can just do this query
<?
$query = "SELECT Total FROM w3t_Total";
$sth = $dbh -> do_query($query);
list($TNumber) = $dbh -> fetch_array($sth);
echo "The most users online ever is $TNumber";
$dbh -> finish_sth($sth);
?>

I am the worst at instructions. i think i need to find someone to write them up for me or something.

Joined: May 1999
Posts: 241
Coder
Coder
Offline
Joined: May 1999
Posts: 241
Just installed this, and I'd say the new Install doc works wonderfully! []https://www.ubbdev.com/threads/php/images/icons/cool.gif[/]

Thanks for the cool hack!


--------------------
Matt Reinfeldt
http://www.mattreinfeldt.com/
Joined: May 1999
Posts: 241
Coder
Coder
Offline
Joined: May 1999
Posts: 241
Hey Poil,

I really like this hack, however, I think one thing needs to be added... a date/time field... looking at my site, it's wonderful to know that I had 21 people on at once... my big question is, 'when did it happen?' []https://www.ubbdev.com/threads/php/images/icons/smile.gif[/]

Not a big thing to add in... I'll see if I can get to it today.

edit:

done! Here's the modified code:

[:blue]If you've already installed this hack, run this from the Admin Database Manager -> SQL Commands window:

[:green]ALTER TABLE w3t_Total ADD T_Time INT (9) UNSIGNED not null

[:blue]then modify the code in ubbt.inc.php/main.inc.php thusly:
[:green]

// boom get everyone logged in right now and post into
// w3t_Total
// Total

$query = "SELECT COUNT(*) FROM w3t_Online";
$sth = $dbh -> do_query($query);
list($Number) = $dbh -> fetch_array($sth);
// insert this number into the DB if it is larger than it ?
// so first query db
$query = "SELECT Total FROM w3t_Total";
$sth = $dbh -> do_query($query);
list($TNumber) = $dbh -> fetch_array($sth);
if ($Number > $TNumber) {
[:red]$date = $this -> get_date();
$query = "UPDATE w3t_Total
SET Total = '$Number'[:red],
T_Time = '$date'
WHERE Total = '$TNumber'
";
$dbh -> do_query($query);
}
$dbh -> finish_sth($sth);
$dbh -> finish_sth($query);
}


[:blue]And, make the following code changes in online.php:
[:green]

echo "<tr class="darktable"><td>$lang[ONLINE_BODY]";
$html -> close_table();

echo "<p>";

$query = "SELECT Total[:red],T_Time FROM w3t_Total";
$sth = $dbh -> do_query($query);
list($TNumber[:red],$TTime) = $dbh -> fetch_array($sth);

$html -> table_header("Most Users Online");
$html -> open_table();
[:red]$TTime = $html -> convert_time($TTime,$user['U_TimeOffset']);
echo "<tr class="darktable"><td>The Most Users online at one time is: $TNumber [:red]at $TTime";

$html -> close_table();
$dbh -> finish_sth($sth);
echo "<p>";


if you haven't already installed the hack, then modify poil's instructions with the code above...

That should do it!

Enjoy!

Last edited by MattyJ; 11/19/2001 7:24 AM.

--------------------
Matt Reinfeldt
http://www.mattreinfeldt.com/
Sponsored Links

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:
Stable Host
bluehost
InterServer
Visit us on Facebook
Member Spotlight
hatter
hatter
USA
Posts: 69
Joined: January 2001
Forum Statistics
Forums63
Topics37,573
Posts293,925
Members13,849
Most Online5,166
Sep 15th, 2019
Today's Statistics
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
Top Posters
AllenAyres 21,079
JoshPet 10,369
LK 7,394
Lord Dexter 6,708
Gizmo 5,833
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-2024 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 8.0.0
(Preview build 20221218)