I have a website that runs for around 2-3 years before, it has its own forum, however, recently I would like to use the phpbb3 to replace that forum. I encounter the problem when I need to do integration .
To be precise, I have an existing database that have fields designed for my own website. What I would like to do is the old user do not need to register again and can login to the phpbb forum, using every functions it provided (e.g. check profile) . Are there any way to implement such conversion?
So far I have got some source code to check login, but there are a lots of works should be done for full integration ? e.g. create forum profile for old user? Are there any step-to-step guide? Thanks for helping.
<?php
define('IN_PHPBB', true);
$phpbb_root_path = '../phpBB3/'; //the path to your phpbb relative to this script
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include("../phpBB3/common.php"); ////the path to your phpbb relative to this script
// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup();
$username = request_var('username', 'john');
$password = request_var('password', '123');
if(isset($username) && isset($password))
{
$result=$auth->login($username, $password, true);
if ($result['status'] == LOGIN_SUCCESS) {
echo "You're logged in";
} else {
echo $user->lang[$result['error_msg']];
}
}
?>
You can create an account in the new forum for all your users with the user_add
function. Details on how to do that can be found in the phpbb wiki:
https://wiki.phpbb.com/Add_users
https://wiki.phpbb.com/Function.user_add
To authenticate the users against the new forum you can use External Logins
来源:https://stackoverflow.com/questions/19241385/full-integrate-phpbb-into-existing-website