06-25-2010, 07:20 AM
I already have a site that has its own login system. I would also love to have a forum. I have no idea how to code one myself and google search results just came up with "have a forum for your site in minutes by installing....". So I saw the phpBB was one of the best free ones. The problem is, I don't want my users to have to sign up twice, once for the site and the second for the forums.
So I ask, is it possible to integrate my user table with phpBB's user table? If not, any suggestions on where to go?
06-25-2010, 04:24 PM
Yes, but the amount of work to do so is dependant on what you have.
Sounds like the only table you need to migrate is the users table. This is the approach I'd take to this.
First, install PHPBB (and yes, PHPBB is one of the good ones, bonus that its free). Then, you need to find a way to migrate your current datastructure into the new datastructure. Most of these will be a simple SELECT INTO, or SELECT and INSERT/UPDATE. The tricky one will be the passwords. There is no standard to writing passwords hashing, so you need to determine what it is that PHPBB is using. Sometimes its simple; sometimes its not.
Once complete, you then need to modify your current scripts to either deal with the new table, or use the login interface provided from PHPBB. Both are easy to do, its the data migration thats the hard part. Remember not to delete your original table until you have verified with testing that its doing ok. If your passwords are currently hashed, you'll need to modify both your current scripts and the PHPBB scripts to allow an intercepting password table. If the user has a record existing on this table, force them to change their password (even if its to the same). Alternatively, PHPBB should have a lost password recovery form; I'd assume there is a way to batch send this, so you wouldn't need to even bother with the third table, just make all of your users use the password recovery system. Even a simple world readable notification of this being the case (explaining that passwords cannot be converted) should be good enough. Also, there is a potential that you are using the same hashing system, or similar to PHPBB.
Unless of course your current software is OO with a DAO backend. Then its a matter of writting a simple new DAO pointing to the PHPBB table instead of the original, and wrap it in an adapter to match your current properties. Password issue will still apply, but much less work this way.
As mentioned, if you are using the same, or similar hashing system, there may be no need to concern yourself when migrating the data.
For example, a simple common one for starter scripts with PHP would be:
$password = md5($password);
Now, vBulletin I believe uses:
$password = md5(md5($password) . $salt);
Where $salt is a 3 random character string. If you currently just have md5, and PHPBB uses something similar to the salting technique, your already half way there. You can at this point directly convert your current passwords into the passwords required by PHPBB.
The migration script won't be to bad to write, but you may have complications regarding runtimes or memory executing it through the web. For this, I'd look at either allowing infinite run scripts in the background (until completion of course), or executing on the cli.
06-25-2010, 07:31 PM
Wow that is a lot of info! You have greatly helped me out. I understand what you are explaining and will start to look into it. :thumbsup: