문제

I want to add bridge between my PHP website and my PhpBB3 forum, so that when user login in my website then he automatically logged-in into PHPBB forum or when he sign-up in my site then he automatically signed-up in Forum. I have seen many article about it but not able to find the correct one which can solve my problem.

도움이 되었습니까?

해결책

You can use the session that the PHPBB forum uses for this integration.

define('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : '/var/www/clients/client9/web8/web/forums/';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include_once($phpbb_root_path . 'common.' . $phpEx);

$user->session_begin();

From here, you can use the $user object for your integration. For example, the code below will show you if your user is logged in or not.

if ($user->data['username'] == 'Anonymous')
{
    echo 'Please login!';
}

This uses the Anonymous user for validation, which PHPBB adds as the first user account when it is installed.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top