我已经集成了一个phpbb3论坛到我已经存在的网站。
我已经能够让我的注册过程将用户添加到phpbb数据库中。
现在我面临着一个问题,我试图让用户在登录我的网站时自动登录到论坛。
这里有人这么做过吗?我在Google上找不到任何相关的东西,因为所有的帖子似乎都在谈论'phpbb外部网页‘,以及如何在其他网页上使用phpbb会话。然而,我试图做的是,只有当会员登录到我的网站时才开始登录,遵循我在google上找到的教程,当我的用户登录到我的论坛时,他们就可以登录到我的网站(反过来)。
谢谢
发布于 2011-07-27 23:29:33
<?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']];
}
}
?>https://stackoverflow.com/questions/5092340
复制相似问题