| Author |
Message |
whazoo
MDBooster


Joined: Feb 05, 2006
Posts: 34
Location: Chicago
Member
|
 Posted:
Feb 11, 2006 - 05:04 AM |
|
|
shorty,
I was just commenting that
it would be nice to have a user table option
in the config file...
Not that it would be pratical in this instance...
Sorry for leading you on,
that wasnt my intention. |
|
|
|
 |
Shorty
MD user level 5


Joined: Jan 10, 2006
Posts: 149
bannato
|
 Posted:
Feb 12, 2006 - 10:36 AM |
|
|
| Code:
|
|
**Note - This is an example. If you are actually sharing the users tables, then you need to edit all of the associated users tables. It also might be wise to change the _group_membership prefix so users are assigned to the proper group throughout your multisites.
|
Can someone explain a bit more why it`s so hard to make the sites use the same DB.What needs to be changed? The main reason for having a multisite is so that members can log in at one and stay logged in at them all. There must be a way for sites using the same DB from a fresh install without having to install xaampand using parked domains etc. I read a tutorial for postnuke which doesn`t work for mdpro. I was hoping though. http://docs.postnuke.com/index.php?name ... amp;sid=24
sorry for posting outside links but to explain and to let you know what i`m talking about. That one seems so straight forward. All sites pointing at the same tables shared as you wish, cookie settings changed to make surfing on all sites possible. Why doesn`t this work with mdpro.
I don`t wan`t to make the multisite module cause i wan`t to have an own admin section on all sites with a totally of its own build. This might sound stupid but i just wanna manage them separate instead under the same admin section as i understand the mutisite module does.
When phpbb and other modules can use the same db with no problems, then i guess there must be a clever way to just share usertables in several sites too. I`m rambling on now i know. I`m trying to figure out the process that runs and what`s needed to be done to makt this work.
I tried to do somethings to the prefix and forcing it to read from the original prefix and that was somewhat successful.It used the right user DB i think but where in the usertable is makes the theme change? That is set in the admin settings and shouldn`t change on the usertable, right? Well, it did. The theme and other blocks modules was called up through that usertable. Maby just strip that quite a bit and drop a few other tables as they`re not needed maby..
Shorty |
Last edited by Shorty on Feb 12, 2006 - 11:48 AM; edited 1 time in total |
|
|
 |
PeteBest
MD user level 5


Joined: Oct 06, 2003
Posts: 4845
bannato
|
 Posted:
Feb 12, 2006 - 11:14 AM |
|
|
That should work just fine, but wherever it says config.php, you'll have to use \config\md-config.php
The reason why multisites are so hard is because it's a very advanced topic that requires a lot of input from the user. Due to the very flexible nature of the system I can't think of anyway to automate the process for every server. You just need to know what you're doing and be able to follow instructions |
_________________ Retired from official MAXdev duties |
|
|
 |
Shorty
MD user level 5


Joined: Jan 10, 2006
Posts: 149
bannato
|
 Posted:
Feb 12, 2006 - 12:08 PM |
|
|
is there any tables that needs to be taken out? I tried this but ended up having a problem as follows. The theme was set to the maindomains theme and some block, modules where being called from the main domain. I don`t see why though being that the userDB doesn`t contain any of those configurations. Or maby i`m wrong, i`ll try again.
Funny, i`ve uploaded mdpro in various domains/subdomains about 20 times now and almost everytime the smartftp uploads, there are missing files, folders or incomplete files. I haveto upload folder by folder. ish, takes time sitting monitering.
Shorty |
|
|
|
 |
Shorty
MD user level 5


Joined: Jan 10, 2006
Posts: 149
bannato
|
 Posted:
Feb 12, 2006 - 02:31 PM |
|
|
I installed, changed to proper cookie settings changed so it calls up md_user like this:
| Code:
|
$users = $md . '_users';
$pntable['users'] = md_users;
|
I can enter both sites, i can log in at main, i can`t however log in as admin at gamer.alesundportalen.net. I get this error:
| Code:
|
|
Fatal error: Call to a member function on a non-object in /hsphere/local/home/alesundp/gamer.alesundportalen.net/includes/pnUser .php on line 71
|
| Code:
|
70 list($uid, $realpass) = $result->fields;
71 $result->Close();
72 // Confirm that passwords match
73 if (!comparePasswords($pass, $realpass, $uname, substr($realpass, 0, 2))) {
74 return false;
|
What exactly happens there?
Will it be crucial to share the _session_info or am i wrong there?
Shorty |
|
|
|
 |
PeteBest
MD user level 5


Joined: Oct 06, 2003
Posts: 4845
bannato
|
 Posted:
Feb 12, 2006 - 09:47 PM |
|
|
$users = $md . '_users';
What is the value of $md, why have you used a variable there? If you're attempting to follow that guide at PN it should be
$users = md . '_users';
Where md is the prefix for your main site with all the user information. In the main file it's $prefix . '_users'; as the $prefix variable holds the prefix, unless you've defined $md it'll have no value |
_________________ Retired from official MAXdev duties |
|
|
 |
Shorty
MD user level 5


Joined: Jan 10, 2006
Posts: 149
bannato
|
 Posted:
Feb 12, 2006 - 10:10 PM |
|
|
ah, forgot to define $md in the beginning. Just took away the value and it`s working now. I`ll have to test a bit on which tables to share and not so there`s no conflicts and such but it seems to work so far. This guide was actually pretty darn good and straight forward, even if i managed to screw it up;) |
|
|
|
 |
Shorty
MD user level 5


Joined: Jan 10, 2006
Posts: 149
bannato
|
 Posted:
Feb 13, 2006 - 05:19 AM |
|
|
just to let you fellas know about how this turned out, i now have 5 sites operational sharing the DB. This is without the multi-site module.
In the tutorial linked above, there`s a small error that might work with PN but will not work with mdpro. It reads:
| Code:
|
$pnconfig['dbtype'] = 'mysql';
$pnconfig['dbtabletype'] = 'myisam';
$pnconfig['dbhost'] = 'localhost';
$pnconfig['dbuname'] = 'yournick';
$pnconfig['dbpass'] = 'yourpassword';
$pnconfig['dbname'] = 'yourdatabase';
$pnconfig['system'] = '0';
$pnconfig['prefix'] = 'nuke';
$pnconfig['encoded'] = '0';
|
This will not work. It has to be:
| Code:
|
$pnconfig['dbtype'] = 'mysql';
$pnconfig['dbtabletype'] = 'myisam';
$pnconfig['dbhost'] = 'localhost';
$pnconfig['dbuname'] = 'yournick';
$pnconfig['dbpass'] = 'yourpassword';
$pnconfig['dbname'] = 'yourdatabase';
$pnconfig['system'] = '0';
$pnconfig['prefix'] = 'nuke';
$pnconfig['encoded'] = '1';
|
$pnconfig['encoded'] = '1';
This will have to be done to all portal md-configs.
Now the finetuning begins. Just hope it`s stable.
Shorty |
|
|
|
 |
PeteBest
MD user level 5


Joined: Oct 06, 2003
Posts: 4845
bannato
|
 Posted:
Feb 13, 2006 - 05:42 AM |
|
|
$pnconfig['encoded'] = '0'; is perfectly valid in MDPro. Your problem with it will be that you had the username and password md5 hashed. If you have them in plain text in your md-config.php you'd set $pnconfig['encoded'] = '0'; if they are md5 hashed you've got to set $pnconfig['encoded'] = '1'; |
_________________ Retired from official MAXdev duties |
|
|
 |
Seb
MD Staff


Joined: Nov 24, 2003
Posts: 283
Location: Birmingham, UK
bannato
|
 Posted:
Feb 13, 2006 - 08:34 AM |
|
|
Shorty,
You're probably busy now with all this setup, but when you get the chance/time, it would be great if you could share your experience and write a tutorial. I'm sure some users would be grateful for this
Cheers
Seb |
_________________ French Support Manager
http://www.maxdevfrance.com |
|
|
 |
Shorty
MD user level 5


Joined: Jan 10, 2006
Posts: 149
bannato
|
 Posted:
Feb 14, 2006 - 01:56 AM |
|
|
I`ve already wrote it. I`m rewriting as changes are made.Still there are one issue. When i go to the main domain and log in as admin, it says there`s one member online and one guest.I can`t get to the admin section. It also says that i am anonymous. So the admin is logged in but i`m not recognised as admin trhough the cookie. Correct? Now, i thought this was resolved with the pnsession cookie domainchange.
| Code:
|
We have
1 guest and
1 member online
You are anonymous user. You can log in or register here.
|
This is on all of the portals. So did i miss something with the cookie settings in pnsession.php?
From my pnsession.php:
| Code:
|
// Cookie path
ini_set('session.cookie_path', $path);
// Cookie domain
// only needed for multi-server multisites - adapt as needed
$domain = preg_replace('/^[^.]+/','',$host);
ini_set('session.cookie_domain', $domain);
|
Here lies the key i think. Anyone see any changes that can be made to fix this problem?
Shorty |
|
|
|
 |
Shorty
MD user level 5


Joined: Jan 10, 2006
Posts: 149
bannato
|
 Posted:
Feb 14, 2006 - 02:46 AM |
|
|
ok i found the problem. i`ll rewrite my tutorial a bit and continue testing for a little while before i post it.
Thx for tips so far guys:)
Shorty |
|
|
|
 |
Shorty
MD user level 5


Joined: Jan 10, 2006
Posts: 149
bannato
|
 Posted:
Feb 14, 2006 - 10:50 PM |
|
|
I`ve completed the tutorial it might need a rewrite on domain/sub/ etc names as i was not sure how to explain it properly i think. Typos and explanations etc too as i don`t speak english originally.
There`s a couple of issues that i need to test before it can be published. I don`t think you can have enabled the "Allow members to change theme" because if that is stored in user_data and is read by all sites. The $pnconfig['encoded'] = ? will not work on default. It needs to be set to 1. Why? I don`t know. Maby i did something wrong somewhere or i had 0 on some and 1 on others but i got a admin database error when on 0.
I now have 5 sites (1 main and 4 subdomains) running on the same userdatabase and share the same MDForum database. Had no other issues. It will be insanely mcuh work to maintain 4 sites but i guess i can`t complain:) |
|
|
|
 |
PeteBest
MD user level 5


Joined: Oct 06, 2003
Posts: 4845
bannato
|
 Posted:
Feb 15, 2006 - 01:00 AM |
|
|
OK, I'll try and explain the whole encoded thing again. If you follow the mdpro install procedure it takes your database username and password and uses a base64 hash to attempt to secure the data a bit more. So, lets say my database username is root and my password is password, my md-config.php details can look like:
| Code:
|
$pnconfig['dbtype'] = 'mysql';
$pnconfig['dbhost'] = 'localhost';
$pnconfig['dbuname'] = 'cm9vdA==';
$pnconfig['dbpass'] = 'cGFzc3dvcmQ=';
$pnconfig['dbname'] = 'md107';
$pnconfig['system'] = '0';
$pnconfig['prefix'] = 'md';
$pnconfig['encoded'] = '1';
|
Or, if I want the user/pass to be just plain text I can use:
| Code:
|
$pnconfig['dbtype'] = 'mysql';
$pnconfig['dbhost'] = 'localhost';
$pnconfig['dbuname'] = 'root';
$pnconfig['dbpass'] = 'password';
$pnconfig['dbname'] = 'md107';
$pnconfig['system'] = '0';
$pnconfig['prefix'] = 'md';
$pnconfig['encoded'] = '0';
|
|
_________________ Retired from official MAXdev duties |
|
|
 |
Shorty
MD user level 5


Joined: Jan 10, 2006
Posts: 149
bannato
|
 Posted:
Feb 18, 2006 - 06:15 AM |
|
|
hi. i made the tutorial including the share of the MDforum tables. not much really but it works so far. if you guys want to check it out and let me know if it`s incomplete or any other feedback on it, i attached it in this post. hope it`s ok. if not, then i`ll haveto do it again
Shorty
EDIT. it seems i can`t attach .txt files. that is kind of strange isn`t it?
Here is the complete text:
| Code:
|
This is a tutorial on how to make several MDPro sites can use the same user database without using the Multisites module included with MDPro. As some might want to have independent sites sharing the same database here is how you do it.
Tutorial to create MultiSites:
Introduction:
This is tested with MDPro version 1.0.75. It works with subdomains and domains sharing the same database. Some changes must be done if it`s on different databases, but that`s another story. The test setup was performed on one domain and 4 subdomains.
Examples:
http://www.yourdomain.com (main domain)
http://subdomain.yourdomain.com (subdomain)
http://www.yourotherdomain.com (other domain)
In this system you will use one database (databases for each portal will be in such database) and as many MDPro installations as you would like(tested with 1 domain and 4 subdomain).
1.Installation:
We begin installing MDPro normally on the server and creating a database with it's tables, for this first intallation we use the default prefix, meaning, "md" (it's an important detail, because each extra portal we install will has to have a new prefix).
2.Once we've got our main portal installed and working we access the server's control panel to create as many subdomains as needed.
3.Inside each of those folders we install a different MD-Pro.Use same database settings as main but install the portals with its own table prefix.
Example(you can name the other prefixes as you please, this is just examples):
Table prefix: md (main)
Table prefix: md2 (subdomain)
Table prefix: md3 (subdomain)
Table prefix: md4 (other domain)
4.Setting up the config/md-config.php file in all of the subdomains and other domains is crucial to make this work.
The main domain md-config.php file has to be set up like this:
$pnconfig['dbtype'] = 'mysql';
$pnconfig['dbtabletype'] = 'myisam';
$pnconfig['dbhost'] = 'localhost';
$pnconfig['dbuname'] = 'yournick';
$pnconfig['dbpass'] = 'yourpassword';
$pnconfig['dbname'] = 'yourdatabase';
$pnconfig['system'] = '0';
$pnconfig['prefix'] = 'md';
$pnconfig['encoded'] = '0';
The other md-config.php files from the subdomains and other domains will be like this:
$pnconfig['dbtype'] = 'mysql';
$pnconfig['dbtabletype'] = 'myisam';
$pnconfig['dbhost'] = 'localhost';
$pnconfig['dbuname'] = 'yournick';
$pnconfig['dbpass'] = 'yourpassword';
$pnconfig['dbname'] = 'your database';
$pnconfig['system'] = '0';
$pnconfig['prefix'] = 'md2';
$pnconfig['encoded'] = '0';
$pnconfig['dbtype'] = 'mysql';
$pnconfig['dbtabletype'] = 'myisam';
$pnconfig['dbhost'] = 'localhost';
$pnconfig['dbuname'] = 'yournick';
$pnconfig['dbpass'] = 'yourpassword';
$pnconfig['dbname'] = 'your database';
$pnconfig['system'] = '0';
$pnconfig['prefix'] = 'md3';
$pnconfig['encoded'] = '0';
and so on until you complete each one of the files inside each MDPro installations you may have. As you can see, we will have only changed the prefix (md2, md3, ..., md2 and md3 are just my examples, name them as you please). Remember that each portal has to have a different prefix.
Now, we have the Multisite portals installed and the subdomains working, but as of now they are totally independant.
6.Setting up the pntables.php file
In order to have a Multisite operational and working we have to share some tables (you could really share as many tables as you want), like: Users and PM's (Private Messages), because we want that once our users have logged in or registered to one of the portals, they become registered or logged on to all the portals, so they can access their private messages from anywhere in the Multisite.
So then, lets see how we have to modify the tables and what tables are recomendable to modify:
The pntables.php file (which is in the root folder) from the main portal doesn't need to be modified, but the ones inside the portal folders do.
Find the next string in each file:
$users = $prefix . '_users';
$pntable['users'] = $users;
and change it to:
$users = md . '_users';
$pntable['users'] = $users;
As you can see, we have substituted prefix for md so the other portals share the same tables as the main portal (which in our example has the prefix md).
The same has to be done to each table you want to share, in my case i have shared the next tables:
$group_membership
$group_perms
$groups
$user_data
$user_perms
$user_property
$priv_msgs
$users
$sessions_infos
logically in some portals you could be interested in sharing less tables or some other types of tables, but we leave that to your own choice, the one which suits your needs better.
We almost have our multisite portal ready, but we still need to do a small but important tweak, because since MDPro works with cookies, we have to configure them in order to get our Multisite working.
7.Setting up the pnSession.php file
The pnSession.php file is located inside the includes folder.
This file has to be modified in all installations, main and secondary, like this.
1.- Find this(Line 34):
$path = pnGetBaseURI();
if (empty($path)) {
$path = '/';
}
and change it to this:
$path = '/';
2.- You will find this 2 lines like commented out like this(Line 81):
// $domain = preg_replace('/^[^.]+/','',$host);
// ini_set('session.cookie_domain', $domain);
remove the // in order to make them operational. They should look now like this:
$domain = preg_replace('/^[^.]+/','',$host);
ini_set('session.cookie_domain', $domain);
TIP:
In order to make it definetively operational, most of all if the main portal was already active and it had its own cookies, session info, etc. you will have to empty the prefix_sessions_infos tables and eliminate the cookies. From now on you have a new Multisite ready and completely operational.
Enjoy.
---------------------------------------------------------------------- ------------------------------------------------
Installing MDForum 2.0.1 shared with the multisites we just installed.
If you don`t want to install MDForum, ignore these steps.
Installing MDForum while sharing the database with multisites (this is not for the multisite module)
1.First we need to upload the complete module to all our sites to /modules. This will haveto be done to both main domain and all subdomains an other domains.
2.Then go to your main domains Administration >Settings >Modules. Press "Regenerate" and your list of modules will appear. Find MDForum module currently "Uninitialized". Press initialize, then activate when the page reloads.
The MDForum is now activ and you can find it here(change to your actual domain): http://yourdomain.com/modules.php?op=modload&name=MDForum&file=index
3.Now we need to change and delete some files to integrate this module for the other sites. As the MDForum has been installed and the proper tables inserted to our database, we do not want another set of tables.
First the delete(this will be done to all subdomains and other domains. NOT the main domain!):
In all subdomains/other domains, delete the entire MDForum install folder and all its files. /modules/MDForum/install/. Also delete pninit.php found in /modules/MDForum/.
4.Then the file change((this will be done to all subdomains and other domains. NOT the main domain!):
Find the file common.php in /modules/MDForum/ and do the following change:
Find on line 191
// Begin MDForum Multi-Site Support
$table_prefix = pnConfigGetVar('prefix') . '_phpbb_';
// End MDForum Multi-Site Support
Change to:
// Begin MDForum Multi-Site Support
$table_prefix = md. '_phpbb_';
// End MDForum Multi-Site Support
As you can see we now have changed what prefix the MDForum should query from. As the tables have been installed on our main prefix, we set that as the prefix for the forum.
Do this to all subdomains and other domains.
After these changes we can enter the Administration >Settings >Modules to initialize and aktivate MDForum for all our subdomains and other domains.
Now we should have a multisite sharing user database and a shared forum.
Tip. You might want to empty the _phpbb_session_info table in your database before using.
Enjoy.
|
|
|
|
|
 |
|
|
|