我正在尝试使 phpbb 成为我当前页面的一部分,但我遇到了问题。每当我将用户重定向到不同的站点时,$user->data 都会被重置,我似乎无法弄清楚原因。
<?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!";
}
}
?>