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.
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.
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.
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.
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.
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.
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.
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.