PDA

View Full Version : Database Question with Invision Board


DarkWarriorXII
02-16-2004, 07:53 PM
On my site I will soon get, I am going to have multiple forums (all of which will be Invision Power Board). I was wondering how you can make it so that a user can register on one of the forums and be automatically registered on all the others as well. Basically what I'm trying to ask is how do you combine several different member tables with each other and run several forums from the same member table?

DarkWarriorXII

Chile
02-17-2004, 12:44 AM
What you do is install the forum software to the directories you want. Install with different database prefixes, and then alter the SQL driver of the software to point to only one prefix for all but one installation. The prefix that all of the other board install to becomes the main database for members, and stats.

The driver contains many options, so you will need to do a little research to figure which features you want to share, and which ones you do not.

After you've done that, you will want to make certain that each forum uses the same cookies.

cheers!

Viper007Bond
02-17-2004, 03:36 AM
Chile - depends if there is a file where it generates the table names in a certain file or at each query.

Like if there is a file that goes:

$usertable = $prefix . users

or whatever the Invisison users table is called.

If not and that's done at every query, you'd have to replace each one.

I'd ask at the Invision Forums and see if there's a hack that has all the files modified or what...

Chile
02-17-2004, 04:58 AM
Yeah, that's pretty much how it's created, heh.

it starts right about here:

$the_query = ereg_replace("ibf_members","ibf_members",$the_query);

DarkWarriorXII
02-18-2004, 08:22 PM
Where can that SQL driver be found at? I've never messed (or even looked at) one of these databases.

Chile
02-19-2004, 01:06 AM
okay, if you have never done it before then don't perform this with a database you actually use.

create a database, create a user, install your first board with a table prefix other than the default one which is _ibf. Then, install a second forum to the same database, but with a different table prefix

You only need to change one installation, btw.

One of the folders you uploaded is called Drivers.
Inside the Drivers folder is a file called mySQL.php
Inside the mySQL.php file is a block of lines that look a lot like the last reply I made.

right, so on one mySQL.php file, swap out the prefixes to use the other prefix and save an upload the modified mySQL.php file to the same Driver folder from where it originated.

I'm still trying to sort out a couple glitches (such as post counts and such), but that is the gist of a simple way to use multiple boards with the members, posts, and stats.

DarkWarriorXII
02-23-2004, 09:38 PM
Ok. So I'm assuming this is where I change the prefixes:


class db_driver {

var $obj = array ( "sql_database" => "" ,
"sql_user" => "root" ,
"sql_pass" => "" ,
"sql_host" => "localhost",
"sql_port" => "" ,
"persistent" => "0" ,
"sql_tbl_prefix" => "ibf_" ,
"cached_queries" => array(),
'debug' => 0,
);

var $query_id = "";
var $connection_id = "";
var $query_count = 0;
var $record_row = array();
var $return_die = 0;
var $error = "";
var $failed = 0;


This is the first code of the file. Or would it be:


function query($the_query, $bypass=0) {

//--------------------------------------
// Change the table prefix if needed
//--------------------------------------

if ($bypass != 1)
{
if ($this->obj['sql_tbl_prefix'] != "_main_")
{
$the_query = preg_replace("/ibf_(\S+?)([\s\.,]|$)/", $this->obj['sql_tbl_prefix']."\\1\\2", $the_query);
}
}