我将phpbb3集成到我的网站中。当用户登录到我的网站时,有一个名为forum的选项卡。如果他点击论坛,它会进入一个页面,要求用户名和密码登录。但我想当用户点击论坛,然后他不得不直接去他的帐户详细信息的论坛,而无需再次登录。如何从我的网站直接登录到phpBB3?
请帮帮我......
我将phpbb3集成到我的网站中。当用户登录到我的网站时,有一个名为forum的选项卡。如果他点击论坛,它会进入一个页面,要求用户名和密码登录。但我想当用户点击论坛,然后他不得不直接去他的帐户详细信息的论坛,而无需再次登录。如何从我的网站直接登录到phpBB3?
请帮帮我......
您是如何进行整合的? 看看http://www.phpbb.com/kb/article/phpbb3-sessions-integration/寻求帮助。
我实际上做了同样的事情,用户在我的网站上注册,同时我也会自动为他们创建一个phpbb帐户。
这里是我用来注册它们的代码(我用我的散列函数,我不使用密码phphash函数MD5散列的口令散列实际上已经一个散列密码):
//Register the user on the forum code
global $phpbb_root_path, $phpEx, $user, $db, $config, $cache, $template,$auth;
define('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './Forums/';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
require('./Forums/includes/functions_user.php');
// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup('viewtopic');
$user_row = array(
'username' => $username, //REQUIRED IN FORM
'user_password' => md5($password_1), //REQUIRED IN FORM
'user_email' => $email, //REQUIRED IN FORM
'group_id' => 2,//(int) $group_id,
'user_timezone' => $timezone = date(Z)/3600,//(float) $data[tz],
'user_dst' => date(I),//$is_dst,
'user_lang' => $user->lang_name,//$data[lang],
'user_type' => USER_NORMAL,//$user_type,
'user_actkey' => '',//$user_actkey,
'user_ip' => $user->ip,
'user_regdate' => time(),
'user_inactive_reason' => 0,//$user_inactive_reason,
'user_inactive_time' => 0,//$user_inactive_time,
);
//Register user on the forum
$forum_user_id = user_add($user_row);
return "both_registered";
然后记录他们在我使用这个:
//Now log them into the forum
global $phpbb_root_path, $phpEx, $user, $db, $config, $cache, $template, $auth;
define('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : getcwd().'/Forums/';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
require(getcwd().'/Forums/includes/functions_user.php');
// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup();
// Begin phpBB login
if(!$user->data['is_registered'])
{
$username = $username;
$password = $password;
$autologin = 1;
$result = $auth->login($username, $password, $autologin);
//print_r($result);
}
显然,你可能需要改变这个局面一点,我做了很多检查之前,甚至已经开始将它们注册或登录他们希望这有助于如果有人看到我不正确的话,请l我知道。
您是否在使用任何CMS?通常,这种事情需要在phpBB和主站点设置之间同步用户表。例如,我听说过Joomla的插件,它可以为你处理。如果我们更了解您的设置,我们可能会指出您朝着正确的方向。 – 2010-04-23 12:21:00
当ajax调用返回成功,然后刷新当前页面时,您也可以使用jquery/ajax进行登录,而无需用户离开页面。我使用相同的东西来为我的Facebook开发phpbb mod – 2013-05-06 01:09:39