Single site, multiple databases, links on home page

Anyone know if this is possible

1 main dolphin site with links on the home page to numerous databases.

 

If you click 'link A' the site will display content from 'DBA'

If you click 'link B' the site will display content from 'dbB'

 

etc...

 

This way, it would be possible to create different networks within one frame site.

Quote · 14 Oct 2011

Yes this is possible, But it's not a feature that's built-in, this would require you to modify the core files in the site.

 

Off the top of my head, I can think of a way that this MIGHT work, but I can't test it at the moment.  Assuming that both databases were on the same server, here's my theory:

Concept: Use a GET value to set which server your connected to.  With a default of none are specified.

Code change: Open /inc/header.  Find the following lines:  (with your own database info filled in)

$db['host']                = 'localhost';
$db['sock']                = '';
$db['port']                = '';
$db['user']                = 'DB1User';
$db['passwd']              = 'DB1Pass';
$db['db']                  = 'DB1';

And replace it with the following:

$DBserverchoice = $_GET['server'];
if(empty($DBserverchoice)) { $DBserverchoice = "DB1"; } // The default to use when none are specified
if($DBserverchoice == "DB1") {
     $db['host']                = 'localhost';
     $db['sock']                = '';
     $db['port']                = '';
     $db['user']                = 'DB1User';
     $db['passwd']              = 'DB1Pass';
     $db['db']                  = 'DB1';
} else if($DBserverchoice == "DB2") {
     $db['host']                = 'localhost';
     $db['sock']                = '';
     $db['port']                = '';
     $db['user']                = 'DB2User';
     $db['passwd']              = 'DB2Pass';
     $db['db']                  = 'DB2';
}

Of Course changing DB1 and DB2 to your databases, with usernames and passwords respective.

This way, you can switch databases on the fly by having a link to the site include ?server=DB2

The likely problem with this, is that the two databases will be sharing an identical file-set.  You may also need to specify different folders for image/media and so on.

In the end this may not really be possible at all, as much site-data may cross over (Avatars, profile images, etc...).  But if this is not a concern, then give it a try.

Note: Please do not copy code directly from this post, I'm not in front of Dolphin nor have I tested, or secured this code.  Although the variable is only used in an IF statement, it's always good to sanitize $_GET data before doing anything with it, so be careful not to allow this variable to touch any SQL or EXECable statements.

Quote · 17 Oct 2011

Has this been tested now? :-)

Diddy is not greedy and has time. Dolphin is cool and its not just mine :-)
Quote · 29 Jan 2012

I did briefly test this and found only one problem.  Since images, sounds, videos, and other file based resources use the numeric member ID, they could easily clash.  Set the auto-index for member-ID on yoru second database to a number that is far higher than you'd ever expect to have on the first database.  IE: 1,000,000.

Quote · 2 Feb 2012
 
 
Below is the legacy version of the Boonex site, maintained for Dolphin.Pro 7.x support.
The new Dolphin solution is powered by UNA Community Management System.