UBB.Dev
Posted By: Rick Beta-[6.2-6.3-6.4] MaxOnline 1.2 - 03/23/2004 11:43 PM
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.


Attached File
110647-maxonline.txt  (86 downloads)
Posted By: JoshPet Re: Beta-[6.2-6.3-6.4] MaxOnline 1.0 - 03/23/2004 11:49 PM


Thanks!
Posted By: Slurpee Re: Beta-[6.2-6.3-6.4] MaxOnline 1.0 - 03/23/2004 11:52 PM
Awesome thanks Scream!
Posted By: slayer60 Re: Beta-[6.2-6.3-6.4] MaxOnline 1.0 - 03/24/2004 12:02 AM
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.
Posted By: ericgtr Re: Beta-[6.2-6.3-6.4] MaxOnline 1.0 - 03/24/2004 12:03 AM
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
Posted By: Rick Re: Beta-[6.2-6.3-6.4] MaxOnline 1.0 - 03/24/2004 12:08 AM
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.
Posted By: Rick Re: Beta-[6.2-6.3-6.4] MaxOnline 1.0 - 03/24/2004 12:09 AM
Well, I do have a bit of an advantage in that I pretty much know every nook and cranny of the code
Posted By: Rick Re: Beta-[6.2-6.3-6.4] MaxOnline 1.0 - 03/24/2004 12:10 AM
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
Posted By: ericgtr Re: Beta-[6.2-6.3-6.4] MaxOnline 1.0 - 03/24/2004 12:16 AM
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.
Posted By: slayer60 Re: Beta-[6.2-6.3-6.4] MaxOnline 1.0 - 03/24/2004 12:35 AM
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.
Posted By: Rick Re: Beta-[6.2-6.3-6.4] MaxOnline 1.0 - 03/24/2004 12:47 AM
Sure, instructions and attachments updated for adding an admin user that can login no matter what.
Posted By: Slurpee Re: Beta-[6.2-6.3-6.4] MaxOnline 1.0 - 03/24/2004 2:03 AM
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.
Posted By: Rick Re: Beta-[6.2-6.3-6.4] MaxOnline 1.0 - 03/24/2004 2:25 AM
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.
Posted By: Rick Re: Beta-[6.2-6.3-6.4] MaxOnline 1.0 - 03/24/2004 2:44 AM
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.
Posted By: Slurpee Re: Beta-[6.2-6.3-6.4] MaxOnline 1.0 - 03/24/2004 3:27 AM
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.
Posted By: Rick Re: Beta-[6.2-6.3-6.4] MaxOnline 1.0 - 03/24/2004 3:44 AM
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.
Posted By: Slurpee Re: Beta-[6.2-6.3-6.4] MaxOnline 1.0 - 03/24/2004 6:34 AM
That is perfect, thanks for doing this today Scream. Mucho appreciated. Really saved me.
© UBB.Developers