我已将phpbb3论坛集成到我现有的网站。
我已经能够将注册过程添加到phpbb数据库中。
现在,当我登录我的网站时,我正试图让用户自动登录论坛。
有人在这做过吗?我无法在Google上找到任何相关内容,因为所有帖子似乎都在谈论' phpbb外部网页'以及如何在其他网页上使用phpbb会话。但是我想要做的只是当会员登录我的网站时才启动登录,并且按照我在google上找到的教程将让我的用户登录我的论坛时登录我的网站(这是另一种方式。)
由于
答案 0 :(得分:4)
<?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']];
}
}
?>