Icy Phoenix


Documentation And How To - DB - How To Join Two Or More Boards With One User Base (Only One Account For All)



spydie [ Wed 27 Jan, 2010 18:09 ]
Post subject: DB - How To Join Two Or More Boards With One User Base (Only One Account For All)
Hi .

I would like to share with you this tutorial on how to join 2 o more Icy-Boards in one register.

Here you got the link.

This tutorial is made by Novice Programmer.

BBCode Version:

This tutorial will allow you to merge the users table and some other similar tables, so if a guest registers in one of our pages he/she could authentificate himself/herself in all of our sites at once. This tutorial has been specially desinged for Icy Phoenix, version 1.3.0.53.
Special Thanks and Credits to novice_programer, who is the author of this tutorial

Content:





1 Basic concepts for the complete comprehension of this tutorial

You should have at least a Icy Phoenix board system, or one based on it. Perhaps this can be partially aplicable to a PhpBB board, but I have not checked it.

Whenever you can, choose as your Relational Database Management System (RDBMS), MySQL. The reason for choosing databases (DB) managed under this RDBMS, is mainly due to the large number of webmasters which know in a unique way this DB language, and also because many hosting services do only allow MySQL in order to create, modify and manage the DBs.

You will need all the boards to use the same DB, which tables would use the same storage engine (such as MyISAM, as it incorporates functions which other storage engines do not and are required by Icy ). All of the boards must have different installation prefixes.

The files' routes I am gonna give away on this tutorial are based on the root folder of your Icy's scripts.

You shall modify some values of all your Icy based boards in order to login in all of them at once, throught the administration control pannel (ACP).

After sucesfully mergering the boards, you will need to require your users to wipe their cache and cookies, in order to avoid any kind of problems.



2 Files to modify

You will only need to modify two files maximum:

* /includes/constants.php
* /config.php



3 Procedure
3.1 Changes on the files
3.1.1 /includes/constants.php

In this file exists a section starting with the following text, and after that comment it only defines the "paths" to the tables used by Icy:
// Do not insert anything but tables below!
// Table names


NOTE: The following only applies to the forums that will use more then one prefix for their tables

This way we are gonna define one of the forums we want linked as the "master" and the rest as "slaves". If you have ever played with harddrives conected to the motherboard, having to set the jumpers, and not through USB, then you should know what I mean. Anyway this pair of terms are self-descriptive.

At this stage we are going to use a new variable, that we will define in the /config.php file, with the name we want (but we have to make sure, that that variable is not already used by any other script we have on Icy Phoenix, to avoid conflicts.) I recomend a variation of the already defined $table_prefix, like $table_prefix_master. This variable will contain the prefix of the tables of the "master" board. Althought it is written in the requierements of this tutorial, I am gonna remark the following requirement: all boards must have to use the same DB .



3.1.1.1 Sharing only the Username and Password

This way we are going to share the login of at least two Boards, so when you login into one of them you will be automaticly logged in into the other ones aswell.

¡The messages and categories are not going to be shared this way!

To do this changes, these are the changes needed to be made:

#
#----[INSTRUCTIONS]-------
#
We are going to use $table_prefix_master to define a variable, pointing to the prefix of the board we want to "share" the userdata from.
#
#----[SEARCH]--------------
#
define('BANLIST_TABLE', $table_prefix . 'banlist');
#
#----[REPLACE WITH]------
#
define('BANLIST_TABLE', $table_prefix_master . 'banlist');
#
#----[SEARCH]--------------
#
define('BOTS_TABLE', $table_prefix . 'bots');
define('CAPTCHA_CONFIG_TABLE', $table_prefix . 'captcha_config');
#
#----[REPLACE WITH]------
#
define('BOTS_TABLE', $table_prefix_master . 'bots');
define('CAPTCHA_CONFIG_TABLE', $table_prefix_master . 'captcha_config');
#
#----[SEARCH]--------------
#
define('CONFIRM_TABLE', $table_prefix . 'confirm');
#
#----[REPLACE WITH]------
#
define('CONFIRM_TABLE', $table_prefix_master . 'confirm');
#
#----[SEARCH]--------------
#
define('DISALLOW_TABLE', $table_prefix . 'disallow');
#
#----[REPLACE WITH]------
#
define('DISALLOW_TABLE', $table_prefix_master . 'disallow');
#
#----[SEARCH]--------------
#
define('FLAG_TABLE', $table_prefix . 'flags');
#
#----[REPLACE WITH]------
#
define('FLAG_TABLE', $table_prefix_master . 'flags');
#
#----[SEARCH]--------------
#
define('GOOGLE_BOT_DETECTOR_TABLE', $table_prefix . 'google_bot_detector');
define('GROUPS_TABLE', $table_prefix . 'groups');
define('HACKS_LIST_TABLE', $table_prefix . 'hacks_list');
#
#----[REPLACE WITH]------
#
define('GOOGLE_BOT_DETECTOR_TABLE', $table_prefix_master . 'google_bot_detector');
define('GROUPS_TABLE', $table_prefix_master . 'groups');
define('HACKS_LIST_TABLE', $table_prefix_master . 'hacks_list');
#
#----[SEARCH]--------------
#
define('LOGINS_TABLE', $table_prefix . 'logins');
#
#----[REPLACE WITH]------
#
define('LOGINS_TABLE', $table_prefix_master . 'logins');
#
#----[SEARCH]--------------
#
define('NOTES_ADMIN_TABLE',$table_prefix . 'notes');
#
#----[REPLACE WITH]------
#
define('NOTES_ADMIN_TABLE',$table_prefix_master . 'notes');
#
#----[BUSCAR]--------------
#
define('PRIVMSGS_TABLE', $table_prefix . 'privmsgs');
#
#----[REPLACE WITH]------
#
define('PRIVMSGS_TABLE', $table_prefix_master . 'privmsgs');
#
#----[SEARCH]--------------
#
define('PROFILE_VIEW_TABLE', $table_prefix . 'profile_view');
#
#----[REPLACE WITH]------
#
define('PROFILE_VIEW_TABLE', $table_prefix_master . 'profile_view');
#
#----[SEARCH]--------------
#
define('RANKS_TABLE', $table_prefix . 'ranks');
#
#----[REPLACE WITH]------
#
define('RANKS_TABLE', $table_prefix_master . 'ranks');
#
#----[SEARCH]--------------
#
define('SESSIONS_KEYS_TABLE', $table_prefix . 'sessions_keys');
define('SESSIONS_TABLE', $table_prefix . 'sessions');
#
#----[REPLACE WITH]------
#
define('SESSIONS_KEYS_TABLE', $table_prefix_master . 'sessions_keys');
define('SESSIONS_TABLE', $table_prefix_master . 'sessions');
#
#----[SEARCH]--------------
#
define('SMILIES_TABLE', $table_prefix . 'smilies');
#
#----[REPLACE WITH]------
#
define('SMILIES_TABLE', $table_prefix_master . 'smilies');
#
#----[SEARCH]--------------
#
define('SUDOKU_SESSIONS', $table_prefix . 'sudoku_sessions');
define('SUDOKU_SOLUTIONS', $table_prefix . 'sudoku_solutions');
define('SUDOKU_STARTS', $table_prefix . 'sudoku_starts');
define('SUDOKU_STATS', $table_prefix . 'sudoku_stats');
define('SUDOKU_USERS', $table_prefix . 'sudoku_users');
#
#----[REPLACE WITH]------
#
define('SUDOKU_SESSIONS', $table_prefix_master . 'sudoku_sessions');
define('SUDOKU_SOLUTIONS', $table_prefix_master . 'sudoku_solutions');
define('SUDOKU_STARTS', $table_prefix_master . 'sudoku_starts');
define('SUDOKU_STATS', $table_prefix_master . 'sudoku_stats');
define('SUDOKU_USERS', $table_prefix_master . 'sudoku_users');
#
#----[SEARCH]--------------
#
define('USER_GROUP_TABLE', $table_prefix . 'user_group');
define('USERS_TABLE', $table_prefix . 'users');
#
#----[REPLACE WITH]------
#
define('USER_GROUP_TABLE', $table_prefix_master . 'user_group');
define('USERS_TABLE', $table_prefix_master . 'users');
#
#----[SEARCH]--------------
#
define('WORDS_TABLE', $table_prefix . 'words');
#
#----[REPLACE WITH]------
#
define('WORDS_TABLE', $table_prefix_master . 'words');
#
#----[SEARCH]--------------
#
define('ZEBRA_TABLE', $table_prefix . 'zebra');
#
#----[REPLACE WITH]------
#
define('ZEBRA_TABLE', $table_prefix_master . 'zebra');
#
#----[SEARCH]--------------
#
// Attachments - BEGIN
define('ATTACH_CONFIG_TABLE', $table_prefix . 'attachments_config');
define('EXTENSION_GROUPS_TABLE', $table_prefix . 'extension_groups');
define('EXTENSIONS_TABLE', $table_prefix . 'extensions');
define('FORBIDDEN_EXTENSIONS_TABLE', $table_prefix . 'forbidden_extensions');
#
#----[REPLACE WITH]------
#
// Attachments - BEGIN
define('ATTACH_CONFIG_TABLE', $table_prefix_master . 'attachments_config');
define('EXTENSION_GROUPS_TABLE', $table_prefix_master . 'extension_groups');
define('EXTENSIONS_TABLE', $table_prefix_master . 'extensions');
define('FORBIDDEN_EXTENSIONS_TABLE', $table_prefix_master . 'forbidden_extensions');
#
#----[SEARCH]--------------
#
define('QUOTA_TABLE', $table_prefix . 'attach_quota');
define('QUOTA_LIMITS_TABLE', $table_prefix . 'quota_limits');
// Attachments - END
#
#----[REPLACE WITH]------
#
define('QUOTA_TABLE', $table_prefix_master . 'attach_quota');
define('QUOTA_LIMITS_TABLE', $table_prefix_master . 'quota_limits');
// Attachments - END
#
#----[SEARCH]--------------
#
define('CTRACKER_LOGINHISTORY', $table_prefix . 'ctracker_loginhistory');
#
#----[REPLACE WITH]------
#
define('CTRACKER_LOGINHISTORY', $table_prefix_master . 'ctracker_loginhistory');
#
#----[SEARCH]--------------
#
define('DL_CONFIG_TABLE', $table_prefix . 'dl_config');
define('DL_EXT_BLACKLIST', $table_prefix . 'dl_ext_blacklist');
#
#----[REPLACE WITH]------
#
define('DL_CONFIG_TABLE', $table_prefix_master . 'dl_config');
define('DL_EXT_BLACKLIST', $table_prefix_master . 'dl_ext_blacklist');
#
#----[SEARCH]--------------
#
define('DL_BANLIST_TABLE', $table_prefix . 'dl_banlist');
#
#----[REPLACE WITH]------
#
define('DL_BANLIST_TABLE', $table_prefix_master . 'dl_banlist');
#
#----[SEARCH]--------------
#
define('PA_LICENSE_TABLE', $table_prefix . 'pa_license');
#
#----[REPLACE WITH]------
#
define('PA_LICENSE_TABLE', $table_prefix_master . 'pa_license');
#
#----[SEARCH]--------------
#
define('PA_AUTH_ACCESS_TABLE', $table_prefix . 'pa_auth');
#
#----[REPLACE WITH]------
#
define('PA_AUTH_ACCESS_TABLE', $table_prefix_master . 'pa_auth');
#
#----[SAVE AND CLOSE THE FILE]------
#
EoM




3.1.2 /config.php

Even if this change could be realized aswell in /includes/constants.php, we´re going to do this change in config.php, because most of the Webmasters ( normaly starters, no professionals), forget to do backup´s of everything, but realize one of their /config.php.


¡In this file, we´re NOT going to replace or eliminate anything, in any line!

The change consists in adding the new variable $table_prefix_master with the result to not to obtain an critical error in the recovery of contents of the Database ( said in another way, that the consults to the DB don´t fail).

So now, in the file /config.php:

#
#----[SEARCH]-----------
#
?>
#
#----[ADD, BEFORE]----
#
$table_prefix_master = 'prefix';
#
#----[SAVE/CLOSE]----
#
EoM



Replace prefix with your masterboard DB prefix. Example: $table_prefix_master = 'main_';

This is all you´ve got to change in the server files. But there´s still something to do in the interface of Icy Phoenix.



3.2 Changes in the ACP

With the idea to make it easier for the Final Users, we´re going to do, that on autentify with their User and Password, this process aplicates to all of our Boards, so they don´t have to repeat the process.


NOTE: I only got this working on one Domain and it´s Subdomains (Domain names of second level and following). If anyone gets this working on 2 different Domains, please leave a note in discussion page of this article or in Eledran's discussion page.

So now, we´re going to proceed entering the administracion interface of every of our Boards with shared login through this process.

Once inside the Administration panel (ACP), we proceed to Configuration on the main ACP menu, then we select the link called Server. Now we search the section called "Cookie Configuration". Here we change the cookie domain for the name of the second level of our site ( in the case of this site, the Domain name of second level is forofos-f1.com, because the first level is .com and the third level is wiki.forofos-f1.com).


The name of the cookie could be anything not used by another cookie of any of our other sites (¡Not only your Boards, all of the software you got on your server!).


The route of the cookie is, inside the domain name, the archive and subarchive there it´s going to be "efectiv". This is, if all Boards use the same path, you can put the relativ path to the index of the Domain as this value. In other case, take the common part of the path of ALL the boards you have.


NOTE: If you don´t know what to put here, simply place a slatch (/). This will do.

The rest of the values of this part, set them as you please




3.3 Instructions for the Users

With the idea, to don´t have any problems, you´ve got to ask your Users to clean the cache and the cookies of their browsers, so they don´t enter in conflict with the new configuration.




3.3.1 Delete/clean the cache

The cache is a copy in local of a page/site, like received from the server, who speeds up the process to obtain a page, so if nothing has changed since the last time chached, the browser does´nt asked for it again to the server, and uses the last copy in local cache of the browser.

3.3.1.1 Internet Explorer

To clean the cache in IE, we´ve got to :

1. Go to 'Tools (in the menu of the archiv)
2. Click in Internet Options
3. Go to Option General (open by defect)
4. Go to section Exploracion Historial
5. Click on the button delet...
6. Go to the section Temporal Internet Archives
7. Cclick on the button Delet Archives/Files...
8. Confirm in the new window opend Yes.

When the window with the title Delet Exploration Historial has closed, your cache is empty. Don´t care, your Historial is mantained. This could take a few minutes, depending on the frequency you´re cleaning your cache and the number of sites you´re visiting. If you´re using other Browsers aswell, apart from Internet Explorer, you´ll have to clean the cache of those aswell.

Note for the Users of IE version 7 and following: Since in this versions of Internet Explorer would´nt apear the archive menu at defect, you should use a little trick: Press Alt on your keyboard so the menu turns up.


3.3.1.2 Mozilla Firefox

To purge the cache of Firefox, you´ve got to:

1. Go to Tools (in the archive menu)
2. Select Purge recent history... (if you want, you can use Ctrl+Shift+Supr and skip these steps)
3. Only selct the square close to Caché
4. Make shure that the temporal range to purge: is defined as All and change it if necesary.
5. Click in Purge now

When the window closes, the cache of your Firefox would be clean. This could take a few minutes, depending on the frequency you´re cleaning your cache and the number of sites you´re visiting. If you´re using other Browsers aswell, apart from Firefox, you´ll have to clean the cache of those aswell.

3.3.1.3 Google Chrome

To purge the cache of Chrome, proceed this way:

1. Click on the symbol that looks like a wrench
2. Click on Delet Navigation data... (if you want, you can use Ctrl+Shift+Supr and skip these steps)
3. Check only in stroke Empty the cache
4. Check that "Clear data from this period" is set to All and replace if necessary

As the window closes, your cache Google Chrome will be cleared. This may take several minutes depending on the frequency with which empty your cache and the number of sites you visit. If you use other web browsers than Google Chrome, need to empty the cache of those.



3.3.2 Deleting cookies

The cookies are small pieces of information that are generated by the web server, and stored by the clients. Allow a user supposedly anonymous can be recognized as a username and registered without having to authenticate again, omitting the introduction of the credentials of this (normally user password). As we changed the values of the emission of these, may conflict with the current reason that ask users to deletion.


3.3.2.1 Internet Explorer

For delete the cookies in IE, we have to use:

1. Access 'Tools' (at File menu)
2. Click on 'Internet Options'
3. Go to Tab 'General' (open by default)
4. Go to section 'Browsing History'
5. Click the button 'Delete ...'
6. Go to sectionCookies'
7. Click the button 'Delete Cookies ...'
8. Check in the new window by clicking on' Yes '.

As the window titled Delete Browsing History is closed, your cache will be empty. Do not worry, your history is preserved. This may take several minutes, or less than one second, depending on the frequency with which empty your cache and the number of sites you visit. If you use other web browsers than Internet Explorer, you´ll need to purge they´re cookies too.

Note for users IE version 7 and below: As users of these version of Internet Explorer do not appear on File menu by default, be apply to use a little trick: Press the Alt of keyboard to their menu that appears.

3.3.2.2 Mozilla Firefox

To purge the cookies in Firefox, it should be:

1. Access Tools (File menu)
2. Select Clear recent history ... '(you can press Ctrl + Shift + Del ' and skip the steps above)
3. Select only the box next to Cookies
4. Make sure the clean temporary rank: is set toAll and if necessary change this value.
5. Click Clean now

As the window closes, your cookies in Firefox have been removed. This may take several minutes, or less than one second, depending on the frequency with which empty your cookies and the number of sites you visit. If you use other web browsers than Mozilla Firefox, you´ll need to empty they´re cookies too.

3.3.2.3 Google Chrome

To purge the cookies in Chrome, it should be:

1. Click on the symbol, which resembles a wrench
2. Click on Clear browsing data ... (you can press Ctrl + Shift + Del and skip the steps above)
3. Select only stroke Delete Cookies
4. Check that "Clear data from this period" is set to All and replace if necessary

As the window closes, your cookies on Google Chrome will have been eliminated. This may take several minutes or even less than a second, depending on the frequency with which empty your cookies and the number of sites you visit. If you use other web browsers than Google Chrome, you´ll need to empty they´re cookies too.


Mighty Gorgon [ Fri 29 Jan, 2010 16:05 ]
Post subject: Re: How To Join 2 Or More Boards In 1 Register
Thanks for sharing, if you could create a BBCode version of this article and post here, I will add it to docs section.

Thanks.


spydie [ Sun 31 Jan, 2010 01:58 ]
Post subject: Re: How To Join 2 Or More Boards In 1 Register
I´ll see what i can do.


Mighty Gorgon [ Thu 04 Feb, 2010 00:38 ]
Post subject: Re: How To Join 2 Or More Boards In 1 Register
Thank you for your time.


spydie [ Sat 06 Feb, 2010 21:10 ]
Post subject: Re: How To Join 2 Or More Boards In 1 Register
EDIT:

Moved to first post


Mighty Gorgon [ Sun 14 Feb, 2010 18:03 ]
Post subject: Re: DB - How To Join Two Or More Boards With One User Base (Only One Account For All)
Moved to docs!

Thanks a lot for sharing, many users will found this very useful.

Thanks spydie, thanks Novice Programmer




Powered by Icy Phoenix