PDA

View Full Version : MySQL query limit - script users please read (Nuke, phpbb, etc)


Pig
11-2-03, 01:48 PM
If you have used technique in the "max_questions/SQL query limit (http://forum.powweb.com/showthread.php?s=&threadid=23735)" thread, please lend a hand to your fellow Powweb users. Please post here with the exact path/name to the file you had to edit, the variable scenario, and if you had to do anything special that wasn't included in the instructions.

satis
11-2-03, 11:51 PM
phpbb;

file is in [forum_root]\phpBB-2.0.4\phpBB2\includes

filename is db.php

altered code


// Make the database connection.

$ruser[]="user1";
$ruser[]="user2";
$ruser[]="user3";

$dbuser = $ruser[ rand(0,2) ];

$db = new sql_db($dbhost, $dbuser, $dbpasswd, $dbname, false);
if(!$db->db_connect_id)
{
message_die(CRITICAL_ERROR, "Could not connect to the database");
}

user00265
11-3-03, 12:14 AM
Invision Board (IPB) v1.2:

File location:
<forum root>/

Filename:
conf_global.php

Original code:
*Starting on line #49
$INFO['sql_host'] = 'localhost';
$INFO['sql_database'] = '';
$INFO['sql_pass'] = '';


Modified code:
*Starting on line #49
$ruser[]="user1";
$ruser[]="user2";
$ruser[]="user3";
$INFO['sql_host'] = $ruser[ rand(0,2) ];
$INFO['sql_database'] = '';
$INFO['sql_pass'] = '';

Save & Enjoy!

NOTE: Board MUST be installed and running properly before adding this code.

user00265
11-3-03, 12:24 AM
OpenBB (OBB) v1.0.5

File Location:
<forum root>/lib

Filename:
sqldata.php

Original Code:
*Entire file
<?php
$database_server['type'] = 'mysql';
$database_server['hostname'] = '';
$database_server['username'] = '';
$database_server['password'] = '';
$database_server['database'] = '';
$database_server['prefix'] = 'obb_';
$database_server['setup_$versionsion'] = 'OpenBB 1.0.5';
$database_server['setup_reopenpass'] = '';
$prefix = $database_server['prefix'];
?>

Modified Code:
*Entire File
<?php
$database_server['type'] = 'mysql';
$database_server['hostname'] = '';
$ruser[]="user1";
$ruser[]="user2";
$ruser[]="user3";
$database_server['username'] = $ruser[ rand(0,2) ];
$database_server['password'] = '';
$database_server['database'] = '';
$database_server['prefix'] = 'obb_';
$database_server['setup_$versionsion'] = 'OpenBB 1.0.5';
$database_server['setup_reopenpass'] = '';
$prefix = $database_server['prefix'];
?>

Save & Enjoy!

NOTE: Board MUST be installed and running properly before adding this code.

user00265
11-3-03, 12:36 AM
vBulletin (vB) v2.3.0

File Location:
<forum root>/admin

Filename:
config.php

Original Code:
*Starting on line #15
// username and password to log onto db server
$dbusername="";
$dbpassword="";

Modified Code:
*Starting on line #15
// username and password to log onto db server
$ruser[]="user1";
$ruser[]="user2";
$ruser[]="user3";
$dbusername=$ruser[ rand(0,2) ];
$dbpassword="";

Save & Enjoy!

NOTE: Board MUST be installed and running properly before adding this code.

aehare70
11-3-03, 11:15 AM
Anyone have any for PostNuke?

user00265
11-5-03, 12:09 AM
Hey HalfaBee and/or Pig,

Shouldn't this topic be pinned?


=O
user00265

HalfaBee
11-5-03, 12:16 AM
It's Pig's thread so he can decide.
I really don't like sticky threads too much.



HalfaBee

Pig
11-5-03, 12:26 AM
I suppose that's a good idea. I am planning on merging this with the other thread eventually, but it'll be sticky for now.

Olsen
11-16-03, 09:35 AM
PHP-Nuke

config.php in root directory.

$random = rand(1, 3);
if ($random == 1) $dbuname = "username1";
else if ($random == 2) $dbuname = "username2";
else $dbuname = "username3";

$dbhost = "andromeda.powweb.com";

$dbpass = "pass";
$dbname = "name";
$prefix = "nuke";
$user_prefix = "nuke";
$dbtype = "MySQL";
$sitekey = "sitekey";
$gfx_chk = 7;

ed19627
11-26-03, 04:18 AM
I was wondering if anyone uses a php based prgm called e107..

site here
http://e107.org/
I was wondering how to set that up to have random users... it looks easy but I am not to sure... the code is here....



function db_Connect($mySQLserver, $mySQLuser, $mySQLpassword, $mySQLdefaultdb){
/*
# Connect to mySQL server and select database
#
# - parameters #1: string $mySQLserver, mySQL server
# - parameters #2: string $mySQLuser, mySQL username
# - parameters #3: string $mySQLpassword, mySQL password
# - parameters #4: string mySQLdefaultdb, mySQL default database
# - return error if encountered
# - scope public
*/

$this->mySQLserver = $mySQLserver;
$this->mySQLuser = $mySQLuser;
$this->mySQLpassword = $mySQLpassword;
$this->mySQLdefaultdb = $mySQLdefaultdb;
$temp = $this->mySQLerror;
$this->mySQLerror = FALSE;
if(!$this->mySQL_access = @mysql_connect($this->mySQLserver, $this->mySQLuser, $this->mySQLpassword)){
return "e1";
}else{
if(!@mysql_select_db($this->mySQLdefaultdb)){
return "e2";
}else{
$this->dbError("dbConnect/SelectDB");
}
}
}


I was thinking it was this line to change here...

$this->mySQLuser = $mySQLuser;

but I dont want to mess this up.. cause this is a good spot and well I get enough complaints on trying to "fix" something... anyway any help is good help... thanx...

DeathGoth

user00265
11-26-03, 04:58 AM
Actually you need to edit the config file (where you input the sole user name) with the above method, not the function.

Paste the lines of the config file for the database connection (erasing your details of course).


=P
Samuel

ed19627
11-26-03, 03:18 PM
ok the conif is here


This file has been generated by the installation script.

*/

$mySQLserver = "server";
$mySQLuser = "username";
$mySQLpassword = "****";
$mySQLdefaultdb = "e107";
$mySQLprefix = "e107_";



define("e_HTTP", "/Forums/e10/");

?>


so I would set it up what like this...


This file has been generated by the installation script.

*/

$mySQLserver = "server";
$mySQLuser = "username";
$mySQLuser = "username";
$mySQLuser = "username";
$mySQLpassword = "****";
$mySQLdefaultdb = "e107";
$mySQLprefix = "e107_";



define("e_HTTP", "/Forums/e10/");

?>


or do I have to add a random user.... anyway let me know.. thanx..

DeathGoth

Pig
11-26-03, 03:51 PM
If you want to have it randomly rotate the users, then you must include the random code. All you have done there is change the variable 3 times. Whatever it was set to last is all it will ever be.



$mySQLserver = "server";

#$mySQLuser = "username";

$arrayuser[]="user1";
$arrayuser[]="user2";
$arrayuser[]="user3";

$mySQLuser = $arrayuser[ rand(0,2) ];

$mySQLpassword = "****";
$mySQLdefaultdb = "e107";
$mySQLprefix = "e107_";

ed19627
11-26-03, 04:20 PM
Thanx Pig...

I added it it seems to be going good.. its a cool idea you had here...

Pig
11-26-03, 04:33 PM
Thanks, but not my idea. Halfabee started it. I just create a sticky topic since it comes up all the time.

ed19627
11-26-03, 05:09 PM
Well thanx to Halfabee also.. he is a great guy... he has been alot of help... makes me almost wanna grow up and be just like him... haha but its cool.. thanx guys...

LVHK
11-27-03, 10:54 PM
Originally posted by satis
phpbb;

file is in [forum_root]\phpBB-2.0.4\phpBB2\includes

filename is db.php

altered code


// Make the database connection.

$ruser[]="user1";
$ruser[]="user2";
$ruser[]="user3";

$dbuser = $ruser[ rand(0,2) ];

$db = new sql_db($dbhost, $dbuser, $dbpasswd, $dbname, false);
if(!$db->db_connect_id)
{
message_die(CRITICAL_ERROR, "Could not connect to the database");
}


Hi,
I've already tried the above code but the server still prompts me that error?

Could you tell me about how to solve it?

My database file is created on the phpBB and I want to restore it now, file size as below:
non-compressed file: 835kB
compressed file: 8.2MB

Thanks a lot

TheZodiac
12-4-03, 04:44 PM
Hello there, I host with several diff servers including powweb and I love it - though, the other companies have an auto configuration tools for php-nuke and others. So I need a bit of help setting it up on my powweb ftp. I will be downloading the latest version of php-nuke.... Im just a bit confused with all the parameters. Thanks :-D

Syphor
12-6-03, 08:46 PM
I usually can download a script and install it with the install.php script, apparently PHP Nuke doesnt come with an install.php script or any install scripts, so that would mean that I would have to manually install it. I know I have to connect to my MySQL database and edit. Could someone please tell me how I am supposed to manually install .SQL scripts. Do you just install the .SQL script somehow? I got this database viewer and I found out how to open .SQL scripts, and PHP Nuke has a lot of different files. (90) i think. how can i install these manually?


Oh yah, I have the config.php script correct, and tried to download nukedb.php or whatever it was and it didnt install the .SQL files either.

thanks,

Pig
12-6-03, 08:50 PM
download a db utility like mysql control center or mysql front. Then connect to the database and run the .sql files from your utility.

Syphor
12-7-03, 12:01 AM
it actually had nothing to do with me going into the database. The file nukesql.php actually had the install on it, I just didnt realize it.

electro07
12-30-03, 07:39 PM
// Make the database connection.

$ruser[]="user1";
$ruser[]="user2";
$ruser[]="user3";

$dbuser = $ruser[ rand(0,2) ];

$db = new sql_db($dbhost, $dbuser, $dbpasswd, $dbname, false);
if(!$db->db_connect_id)
{
message_die(CRITICAL_ERROR, "Could not connect to the database");
}

Nothing in that coding needs to be edited, correct?

HalfaBee
12-30-03, 10:03 PM
You have to change user1-3 to your mysql usernames and make sure their passwords are the same.

ed19627
1-9-04, 11:30 AM
anyone got the code for IBF v1.3 Final I tryed the old version and it didnt work.. anyway help would be great...

Roy
1-31-04, 02:42 PM
Does anyone have direction for how I can accomplish this with my YaBB SE script ? It is an established forum and I would just as soon not have to change to another script at this stage.

Thank you!

user00265
1-31-04, 03:37 PM
Invision Board (IPB) v1.3 Final:

File location:
<forum root>/

Filename:
conf_global.php

Original code:
*Starting on line #73
$INFO['hb_sql_database'] = '';
$INFO['hb_sql_host'] = '';
$INFO['hb_sql_pass'] = '';
$INFO['hb_sql_tbl_prefix'] = '';
$INFO['hb_sql_user'] = '';

Modified code:
*Starting on line #73
$ruser[]="user1";
$ruser[]="user2";
$ruser[]="user3";
$INFO['hb_sql_database'] = '';
$INFO['hb_sql_host'] = '';
$INFO['hb_sql_pass'] = '';
$INFO['hb_sql_tbl_prefix'] = '';
$INFO['hb_sql_user'] = $ruser[ rand(0,2) ];

Save & Enjoy!

NOTE: Board MUST be installed and running properly before adding this code.

user00265
1-31-04, 03:49 PM
vBulletin (vB) v3.0.0 RC2

File Location:
<forum root>/includes

Filename:
config.php

Original Code:
*Starting on line #22
// ****** DATABASE SERVER NAME ******
// This is the hostname or IP address of the database server.
// It is in the format HOST:PORT. If no PORT is specified, 3306 is used.
// If you are unsure of what to put here, leave it at the default value.
$servername = '';

// ****** DATABASE USERNAME & PASSWORD ******
// This is the username and password you use to access MySQL.
// These must be obtained through your webhost.
$dbusername = '';
$dbpassword = '';

// ****** DATABASE NAME ******
// This is the name of the database where your vBulletin will be located.
// This must be created by your webhost.
$dbname = '';

Modified Code:
*Starting on line #22
// ****** DATABASE SERVER NAME ******
// This is the hostname or IP address of the database server.
// It is in the format HOST:PORT. If no PORT is specified, 3306 is used.
// If you are unsure of what to put here, leave it at the default value.
$servername = '';

// ****** DATABASE USERNAME & PASSWORD ******
// This is the username and password you use to access MySQL.
// These must be obtained through your webhost.
$ruser[] = "user1";
$ruser[] = "user2";
$ruser[] = "user3";
$dbusername = $ruser[ rand(0,2) ];
$dbpassword = '';

// ****** DATABASE NAME ******
// This is the name of the database where your vBulletin will be located.
// This must be created by your webhost.
$dbname = '';

Save & Enjoy!

NOTE: Board MUST be installed and running properly before adding this code.

Roy
1-31-04, 04:01 PM
..... I'm still using YaBB SE - in fact, it is v1.5.5 of YaBB SE.

I already reviewed the previous submissions for other scripts and found nothing that I could translate to YaBB SE. That's why I posted the request for assistance here.

user00265
1-31-04, 04:03 PM
Check your PM's :)

user00265
1-31-04, 04:06 PM
Mambo Open Source (MOS) v4.5:

File location:
<forum root>/

Filename:
configuration.php

Original code:
*Starting on line #4
$mosConfig_host = '';
$mosConfig_user = '';
$mosConfig_password = '';
$mosConfig_db = '';
$mosConfig_dbprefix = '';

Modified code:
*Starting on line #4
$ruser[]="user1";
$ruser[]="user2";
$ruser[]="user3";
$mosConfig_host = '';
$mosConfig_user = $ruser[ rand(0,2) ];
$mosConfig_password = '';
$mosConfig_db = '';
$mosConfig_dbprefix = '';

Save & Enjoy!

NOTE: Software MUST be installed and running properly before adding this code.

Roy
1-31-04, 04:21 PM
Originally posted by user00265
Check your PM's :)

Yes, thanks. Response is on the way.

user00265
1-31-04, 04:48 PM
YaBB SE v1.5.5:

File location:
<forum root>/

Filename:
settings.php

Original code:
*Starting on line #56
########## Database Info ##########
$db_name = "";
$db_user = "";
$db_passwd = "";
$db_server = "";
$db_prefix = "";

Modified code:
*Starting on line #56

########## Database Info ##########
$ruser[] = "user1";
$ruser[] = "user2";
$ruser[] = "user3";
$db_name = "";
$db_user = $ruser[ rand(0,2) ];
$db_passwd = "";
$db_server = "";
$db_prefix = "";

Save & Enjoy!

NOTE: Software MUST be installed and running properly before adding this code.
Special Thanks: Thanks to Roy for giving me the information from the configuration file and it's location.

blueprins
10-12-04, 07:21 AM
Hello, I'm using phpBB. To upgrade from 70.000 to 210.000 I change my Config.php as bellow :


<?php


// phpBB 2.x auto-generated config file
// Do not change anything in this file!

$dbms = 'mysql4';

$dbhost = 'mysqlxx.powweb.com';
$dbname = 'my db Name on mysql';
$u= array( 'User1','user2','user3' );
$dbuser= $u[ rand( 0,2 ) ];
$dbpasswd = 'Password';

$table_prefix = 'phpbb_';

define('PHPBB_INSTALLED', true);

?>

Now am I now still 70.000 or 210.000 ? Must I extra change to Upgrade for anywhere?

bsskibum
10-20-04, 11:52 PM
hey I have scoured the forums and have found one person who posted in this thread with same info and db.php as me but he was asking about something else so I never saw a response..

this is mine

from db.php
-------------------------------------------------------
// Make the database connection.
$db = new sql_db($dbhost, $dbuser, $dbpasswd, $dbname, false);
if(!$db->db_connect_id)
{
message_die(CRITICAL_ERROR, "Could not connect to the database");
}
--------------------------------------------------------------

from config.php
--------------------------------------------------------------
<?php


// phpBB 2.x auto-generated config file
// Do not change anything in this file!

$dbms = 'mysql';

$dbhost = 'mysql07.powweb.com';
$dbname = '555555';
$dbuser = '55555';
$dbpasswd = '555555';

$table_prefix = 'phpbb_';

define('PHPBB_INSTALLED', true);

?>
-0---------------------------------------

which do I change and what :)
thanks

HalfaBee
10-21-04, 12:55 AM
What do you want to do?

bsskibum
10-21-04, 12:59 AM
i want to add the 3 db user.....
there isnt a post with my situation that was answered in this one or the other forum thread
:)
other people posted you jsut pasted back the fixed code...
i was hoping you could spare some time to do the same for me

marcc
11-8-04, 01:10 PM
Has anyone done this with PunBB (http://www.punbb.org)? I would like to know how.

Thanks!

eetwiz
5-17-05, 07:14 PM
Can we get this for IPB 2.x?

The fields are

$INFO['sql_user'] = 'username';
$INFO['sql_pass'] = 'password';

I think I got it:


$ruser[]="UserName1";
$ruser[]="UserName2";
$ruser[]="UserName3";
$INFO['sql_user'] = $ruser[ rand(0,2) ];
#$INFO['sql_user'] = 'COMMENTED OUT USER NAME';

Pig
5-17-05, 07:26 PM
should be the same as version 1.x which is already posted above.

Apathy
7-7-05, 10:06 AM
Solution for Drupal (tested 4.6.0)
============================
in site/default/settings.php where you're instructed to set $db_url make it an array (drupal already accounts for this):

//'default' index is only to account for case where database.inc is not modified!
$db_url['default'] = 'mysql://user1:passwd@mysqlXX.powweb.com/Databasename';
$db_url[1] = 'mysql://user1:passwd@mysqlXX.powweb.com/Databasename';
$db_url[2] = 'mysql://user2:passwd@mysqlXX.powweb.com/Databasename';
$db_url[3] = 'mysql://user3:passwd@mysqlXX.powweb.com/Databasename';

Then in includes/database.inc in function db_set_active() at the top of the function place the following code:

if ($name == 'default') $name = rand(1,3);

and thats it, good luck

jamyam
8-13-05, 03:17 AM
Does anyone have a solution for vBulletin version 3.5.0 RC2 (or anything after 3.0.0 that looks similar to this)?

In the config.php file:


// ****** MASTER DATABASE USERNAME & PASSWORD ******
// This is the username and password you use to access MySQL.
// These must be obtained through your webhost.
$config['MasterServer']['username'] = '#####';
$config['MasterServer']['password'] = '#####';


Thanks in advance!

jamyam
8-15-05, 07:55 PM
Does anyone have a solution for vBulletin version 3.5.0 RC2 (or anything after 3.0.0 that looks similar to this)?

In the config.php file:


// ****** MASTER DATABASE USERNAME & PASSWORD ******
// This is the username and password you use to access MySQL.
// These must be obtained through your webhost.
$config['MasterServer']['username'] = '#####';
$config['MasterServer']['password'] = '#####';


Thanks in advance!

No love for the VB solution? :o

Mastaq
8-22-05, 09:52 AM
Does anyone have a solution for vBulletin version 3.5.0 RC2 (or anything after 3.0.0 that looks similar to this)?

In the config.php file:


// ****** MASTER DATABASE USERNAME & PASSWORD ******
// This is the username and password you use to access MySQL.
// These must be obtained through your webhost.
$config['MasterServer']['username'] = '#####';
$config['MasterServer']['password'] = '#####';


Thanks in advance!

Can anyone help with this? I need a solution too. :D

RTH10260
8-22-05, 10:42 AM
No love for the VB solution? :o
It's not always wise to ask questions in a sticky thread, they tend to be informative only, get ignored.

How about applying your programming skills and copying some of the samples gvien above into your own snippet ?
Slightly different coding but to the same effect, all usernames share the same password:// ****** MASTER DATABASE USERNAME & PASSWORD ******
// This is the username and password you use to access MySQL.
// These must be obtained through your webhost.
$myusernames[] = "#####"; //enter 1st user name
$myusernames[] = "#####"; //enter 2nd user name
$myusernames[] = "#####"; //enter 3rd user name
$config['MasterServer']['username'] = $myusernames[ rand( 0, ( sizeof($myusernames) -1 ) ) ];
$config['MasterServer']['password'] = '#####';

Rosario
9-5-05, 07:40 AM
Would anyone here have a solution for XMB?

RTH10260
9-5-05, 08:46 AM
Would anyone here have a solution for XMB?
The config.php file in the /files subdirectory contains this initial setting:// Database connection settings
$dbname = 'DB_NAME'; // Name of your database
$dbuser = 'DB_USER'; // Username used to access it
$dbpw = 'DB_PW'; // Password used to access it
$dbhost = 'DB_HOST'; // Database host, usually 'localhost'
$database = 'DB_TYPE'; // Database type, currently only mysql is supported.
Adjust the code for $dbuser and possibly $dbpw according to one of the samples discussed above.

Runningwater
9-17-05, 08:42 AM
SMF 1.1b3 Simple Machine Forum

File Location: forum root
File name: settings.php

Original code:
*starting on line #37

######### Database Info ##########
$db_server = ' ';
$db_name = ' ';
$db_user = ' ';
$db_passwd = ' ';
$db_prefix = ' ';
$db_persist = 0;
$db_error_send = 1;


Modified code:
*Starting on line #37

######### Database Info ##########
$db_server = ' ';
$db_name = ' ';
# $db_user = ' ';
$db_user_array[] = " "; //enter 1st user name
$db_user_array[] = " "; //enter 2nd user name
$db_user_array[] = " "; //enter 3rd user name
$db_user = $db_user_array[ rand( 0, ( sizeof($db_user_array) -1 ) ) ];
$db_passwd = ' ';
$db_prefix = ' ';
$db_persist = 0;
$db_error_send = 1;

cowpaintings@ya
10-24-05, 11:18 PM
If anyone can provide me with an oscommerce query limit solution I would really appreciate it...here is my config file(with some variables switched for protection):

<?php
/*
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com

Copyright (c) 2003 osCommerce

Released under the GNU General Public License
*/

// Define the webserver and path parameters
// * DIR_FS_* = Filesystem directories (local/physical)
// * DIR_WS_* = Webserver directories (virtual/URL)
define('HTTP_SERVER', 'mmmmm.net'); // eg, http://localhost - should not be empty for productive servers
define('HTTPS_SERVER', 'mmmmm'); // eg, https://localhost - should not be empty for productive servers
define('ENABLE_SSL', false); // secure webserver for checkout procedure?
define('HTTP_COOKIE_DOMAIN', 'mmmmm.net');
define('HTTPS_COOKIE_DOMAIN', '');
define('HTTP_COOKIE_PATH', '/store/');
define('HTTPS_COOKIE_PATH', '');
define('DIR_WS_HTTP_CATALOG', '/store/');
define('DIR_WS_HTTPS_CATALOG', '');
define('DIR_WS_IMAGES', 'images/');
define('DIR_WS_ICONS', DIR_WS_IMAGES . 'icons/');
define('DIR_WS_INCLUDES', 'includes/');
define('DIR_WS_BOXES', DIR_WS_INCLUDES . 'boxes/');
define('DIR_WS_FUNCTIONS', DIR_WS_INCLUDES . 'functions/');
define('DIR_WS_CLASSES', DIR_WS_INCLUDES . 'classes/');
define('DIR_WS_MODULES', DIR_WS_INCLUDES . 'modules/');
define('DIR_WS_LANGUAGES', DIR_WS_INCLUDES . 'languages/');

define('DIR_WS_DOWNLOAD_PUBLIC', 'pub/');
define('DIR_FS_CATALOG', 'mmmmm');
define('DIR_FS_DOWNLOAD', DIR_FS_CATALOG . 'download/');
define('DIR_FS_DOWNLOAD_PUBLIC', DIR_FS_CATALOG . 'pub/');

// define our database connection
define('DB_SERVER', 'localhost'); // eg, localhost - should not be empty for productive servers
define('DB_SERVER_USERNAME', 'user');
define('DB_SERVER_PASSWORD', 'password');
define('DB_DATABASE', 'store_database');
define('USE_PCONNECT', 'false'); // use persistent connections?
define('STORE_SESSIONS', ''); // leave empty '' for default handler or set to 'mysql'
?>
Thankyou so much...I've been trying to use the work arounds in other discussions, but I keep coming up with parse errors.

Pig
10-24-05, 11:27 PM
replace
define('DB_SERVER_USERNAME', 'user');
with
$ruser[]="user1";
$ruser[]="user2";
$ruser[]="user3";
define('DB_SERVER_USERNAME', $ruser[ rand(0,2) ]);

cowpaintings@ya
10-25-05, 12:47 AM
Pig you are a lifesaver...Thankyou so much

Shanti
10-26-05, 01:22 PM
Here's a slight variation on the phpBB fix. Instead of just choosing a random connection string this one runs through all three until it hits a valid connection. This script isn't perfect though...it can still error out if the account that checks as good at the top of the page reachs it's limit while performing several requests on one page. If the user run into an error though, they can just refresh the page and it will reload properly.

<?php

$dbms = 'mysql';

$dbhost = 'SERVER NAME';
$dbname = 'DATABASE NAME';

$table_prefix = 'phpbb_';
define('PHPBB_INSTALLED', true);

// set a default username and password so the variables
// are properly instantiated

$dbuser = 'FIRST USERNAME';
$dbpasswd = 'FIRST PASSWORD';

// database usernames
$un = array();
$un[] = 'FIRST USERNAME';
$un[] = 'SECOND USERNAME';
$un[] = 'THIRD USERNAME';

// corresponding passwords
$pw = array();
$pw[] = 'FIRST PASSWORD';
$pw[] = 'SECOND PASSWORD';
$pw[] = 'THIRD PASSWORD';

do {
// test the first connection
$dbconn = mysql_connect ($dbhost, $un[0], $pw[0]);
if ( $dbconn ) {
$dbuser = $un[0];
$dbpasswd = $pw[0];
break; // valid connection
}
// if the connection returned false
// remove bad connection credentials from the array
$un = array_splice($un, 0, 1);
$pw = array_splice($pw, 0, 1);
// run the loop again to choose from the remaining
// username/password combinations
} while ( count($un) > 0 );
?>


I can't take credit for this...it's adapted from a script I got here on these boards somewhere several months ago...it's worked great for me ever since!

Shanti
10-28-05, 09:40 PM
The above fix was something I adapted from RTH10260's supplied code in this discussion: http://forum.powweb.com/showpost.php?p=312514&postcount=16

Thanks again to RTH10260!