PDA

View Full Version : Randomizing database user use...


thuffner
10-10-05, 06:47 PM
Hey I just upgraded my Message Board to the latest version of vBulletin. The problem is, the previous config.php file was incompatible with the new software.

I still want to implement (I believe it was Halfabee's) randomizing database user script.

I tried using the code from the old file but it didn't work. The old code is bold and commented out in my new file:


<?php
// ****** DATABASE TYPE ******
// This is the type of the database server on which your vBulletin database will be located.
// Valid options are mysql and mysqli. Try to use mysqli if you are using PHP 5 and MySQL 4.1+
$config['Database']['dbtype'] = 'mysql';

//$ausers=array( 'largo','largo2','largo3' );
//$user = $ausers[ rand(0,2) ];

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

// ****** TABLE PREFIX ******
// Prefix that your vBulletin tables have in the database.
$config['Database']['tableprefix'] = '';

// ****** TECHNICAL EMAIL ADDRESS ******
// If any database errors occur, they will be emailed to the address specified here.
// Leave this blank to not send any emails when there is a database error.
$config['Database']['technicalemail'] = 'webmaster@bondmovies.com';

// ****** MASTER 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.
$config['MasterServer']['servername'] = 'myhost';

// ****** 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'] = 'name';
// and in the above line I replaced name with $user

$config['MasterServer']['username'] = 'name';
$config['MasterServer']['password'] = 'password';

....................rest of file......................
?>


Any ideas?

mitchind
10-10-05, 08:55 PM
Use double quotes when your including a variable in a string - not single quotes.

$config['MasterServer']['username'] = "$user";

RTH10260
10-10-05, 08:56 PM
Any ideas?From the end of your snippet:$config['MasterServer']['username'] = 'name';
// and in the above line I replaced name with $user

$config['MasterServer']['username'] = 'name';
$config['MasterServer']['password'] = 'password';

Did you code it like this (without quotes):
$config['MasterServer']['username'] = $user;
or like this (with double quotes):
$config['MasterServer']['username'] = "$user";

AND: did you remove the second line you showed just below your comment line ???

thuffner
10-11-05, 02:45 AM
Worked like a charm. Thanks guys. :):)