Previous Thread
Next Thread
Print Thread
Rate Thread
Joined: May 1999
Posts: 3,039
Guru
Guru
Offline
Joined: May 1999
Posts: 3,039
Mod Name / Version: MaxOnline 1.2

Description: This limits the maximum number of users that can be on your forum at any given time.

Working Under: UBB.Threads 6.2-6.3-6.4

Mod Status: Beta

Any pre-requisites:

Author(s): Scream

Date: 03/23/04

Credits:

Files Altered: ubbt.inc.php

New Files:

Database Altered:

Info/Instructions: Just add this bit of code into the authenticate function in the ubbt.inc.php file. Change the $maxonline variable to the maximum number of users that can be online for your site.

Change $adminuser to your admin user number to bypass this check for that user so they can always login. In order for this bypass to work, when logging in you must choose the "Remember me" box.

Change $goodscripts to include any scripts that you want to bypass this check, seperate them with a |.

Once the maximum threshold has been reached users will get an error stating that there are too many users online at that time, and to please try back later. Once a user is logged in they are excluded from this check, so the error message will only be given to guests that haven't logged in yet.

Note, that this does add one extra query per page for any users that aren't currently logged in.

Disclaimer: Please backup every file that you intend to modify.
If the modification modifies the database, it's a good idea to backup your database before doing so.

Note: If you modify your UBB.Threads code, you may be giving up your right for "official" support from Infopop.If you need official support, you'll need to restore unmodified files.
Attachments
110647-maxonline.txt (0 Bytes, 86 downloads)

Last edited by Scream; 03/23/2004 10:50 PM.
Sponsored Links
Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369


Thanks!

Joined: Jan 2000
Posts: 313
Member
Member
Offline
Joined: Jan 2000
Posts: 313
Awesome thanks Scream!

Joined: Jun 2003
Posts: 1,025
Junior Member
Junior Member
Offline
Joined: Jun 2003
Posts: 1,025
Now there's something you don't see everyday. A hack from Scream.

BTW, Your new avatar is cool. If you stare at it long enough the dragons seem to move...Well, maybe that's just me.

Joined: May 2003
Posts: 1,068
Junior Member
Junior Member
Offline
Joined: May 2003
Posts: 1,068
Man Scream, did you just whip that up over a cup of coffee or what? It took you like ten minutes to come up with that. Very slick mod

Sponsored Links
Joined: May 1999
Posts: 3,039
Guru
Guru
Offline
Joined: May 1999
Posts: 3,039
Two small changes to this. the reference to my_id needs to get changed to my_sess otherwise users that have the remember me key set will get logged in even if the max is exceeded. Also, the check would allow for one more than your maxonline variable. I just updated the attachment with both of these changes.

Last edited by Scream; 03/23/2004 5:15 PM.

UBB.threads Developer
Joined: May 1999
Posts: 3,039
Guru
Guru
Offline
Joined: May 1999
Posts: 3,039
Well, I do have a bit of an advantage in that I pretty much know every nook and cranny of the code


UBB.threads Developer
Joined: May 1999
Posts: 3,039
Guru
Guru
Offline
Joined: May 1999
Posts: 3,039
Well, since it's something that probably won't get into the standard release I figured it couldn't hurt to help out a bit

And my avatar does emit a hallucenagentic drug when you stare at it. That could be what's happening


UBB.threads Developer
Joined: May 2003
Posts: 1,068
Junior Member
Junior Member
Offline
Joined: May 2003
Posts: 1,068
I've stashed this away for use when my server gets overloaded. Judging from what you mentioned above I can see why you wouldn't want it to be in a standard release, however this is extremely handy for those of us that don't necessarily want to upgrade (or can't afford to) servers to keep up with increasing traffic, especially on sites that aren't making money.

Joined: Jun 2003
Posts: 1,025
Junior Member
Junior Member
Offline
Joined: Jun 2003
Posts: 1,025
Would it be possible for this allow Admins to log in regardless of how many users are online?

And, the halucenagenic drug emission must be it.

Sponsored Links
Joined: May 1999
Posts: 3,039
Guru
Guru
Offline
Joined: May 1999
Posts: 3,039
Sure, instructions and attachments updated for adding an admin user that can login no matter what.


UBB.threads Developer
Joined: Jan 2000
Posts: 313
Member
Member
Offline
Joined: Jan 2000
Posts: 313
Hmm that admin thing didn't work for me on 6.2.2. It seems it can't get the user number until you actually log in. And you can't get the login screen if the online count is over the set number.

Joined: May 1999
Posts: 3,039
Guru
Guru
Offline
Joined: May 1999
Posts: 3,039
Hmm, it should work even in that version, same cookie was used.

What you can try to do is right above the $maxusers definition, add this:

echo ${$config['cookieprefix']."w3t_myid"};
exit;

See if it prints any number out for you at all when it fails.


UBB.threads Developer
Joined: May 1999
Posts: 3,039
Guru
Guru
Offline
Joined: May 1999
Posts: 3,039
Ok, I get it now. In order to bypass the check when logging in you need to use the "remember me" bit. If you log out completely or you don't choose the "remember me" box then it won't work properly since there is no identification of who you are and this hack needs to come before any of that identification can take place.


UBB.threads Developer
Joined: Jan 2000
Posts: 313
Member
Member
Offline
Joined: Jan 2000
Posts: 313
Yep that's what I figured, makes total sense now. Thanks!

Anyway easily you know of to allow the "new user" link to work with this. I wouldn't mind people registering new usernames even if they can't access board.

Joined: May 1999
Posts: 3,039
Guru
Guru
Offline
Joined: May 1999
Posts: 3,039
Modified the attachment. Added a new variable called $goodscripts that can contain any scripts you want to bypass the check, seperating them with a |. By default it will allow them to run the newuser and adduser scripts.


UBB.threads Developer
Joined: Jan 2000
Posts: 313
Member
Member
Offline
Joined: Jan 2000
Posts: 313
That is perfect, thanks for doing this today Scream. Mucho appreciated. Really saved me.


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
Gizmo
Gizmo
Portland, OR, USA
Posts: 5,833
Joined: January 2000
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)