phpbb网站集成

I'm trying to make phpbb a part of my current page, but I have run into a problem. When ever i redirect my user to a different site $user->data gets reset, and i can't seem to figure out why.

<?php
define('IN_PHPBB', true);
$phpbb_root_path = 'forum/';
$phpEx = "php";
include($phpbb_root_path . 'config.' . $phpEx);
include($phpbb_root_path . 'common.' . $phpEx);

// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup();

if(isset($_GET["p"]) && $_GET["p"]=="login"){
    $result=$auth->login("username", "123456");

    if ($result['status'] == LOGIN_SUCCESS) {

        echo "You're logged in";

        header("location: test.php?p=test");

    } else {

        echo $user->lang[$result['error_msg']];

    }

}

if(isset($_GET["p"]) && $_GET["p"]=="test"){
    $user->session_begin();
    $auth->acl($user->data);
    $user->setup();
    if($user->data['is_registered']){
        echo "logged in!";
    }
    else{
        echo "not logged in!";
    }
}
?>

Found the solution, i'm running this local and was using a different cookie domain. So the solution was just to update the cookie domain in phpbb settings

I am also working on a similar project and for me it worked by just saving the user data in a $_SESSION and then just on every page to have

session_start();