开发者

Phpbb3 forum integration with existing site

I am trying to integrate the phpbb forum with my existing site. I have already looked at these links, and it doesn't see开发者_C百科m 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?


Try this:

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

This is the first (and guest) user in the PHPBB database:

SELECT  `user_id`, 
    `username`, 
    `username_clean` 
    FROM 
`phpbb_users` WHERE user_id = 1

Result:

"user_id"   "username"  "username_clean"
"1" "Anonymous" "anonymous"
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜