开发者

Phpbb3 sessions integration with existing site

开发者 https://www.devze.com 2023-03-30 01:44 出处:网络
I hope I am in the right place!! http://www.phpbb.com/kb/article/phpbb3-cross-site-sessions-integration/

I hope I am in the right place!!

http://www.phpbb.com/kb/article/phpbb3-cross-site-sessions-integration/ http://www.phpbb.com/kb/article/phpbb3-sessions-integration/

What I am trying开发者_StackOverflow to do is integrate the phpbb forum with my existing site. I have already looked at the links above, and it doesn't seem to work. I have copied this code

define('IN_PHPBB', true);
define('ROOT_PATH', "/path/to/forums");
if (!defined('IN_PHPBB') || !defined('ROOT_PATH')) {
    exit();
}
$phpEx = "php";
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : ROOT_PATH . '/';
include($phpbb_root_path . 'common.' . $phpEx);

$user->session_begin();
$auth->acl($user->data);

into a loginforum.php file, which I include in every page I want the sessions to be kept. I have done the three steps indicated in the sessions integration section, but when I try to check whether the user is authenticated, it doesn't seem so. Using the same code here:

<?php
if ($user->data['user_id'] == ANONYMOUS){
    echo 'Please login!';
}
else{
   echo 'Thanks for logging in, ' . $user->data['username_clean'];
}
?>

I only get the "Please login" phrase, even when I login.

I've been over this for hours, I don't understand where the problem is. Shouldn't it work after the three miraculous steps?? :(

I would be thankful to anyone who would try to help!

Cheers, Den


This appears to be a duplicate of this question

However, try this answer:

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

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号