Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/video/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Session phpBB会话不会从一页传送到另一页_Session_Web_Integration_Phpbb - Fatal编程技术网

Session phpBB会话不会从一页传送到另一页

Session phpBB会话不会从一页传送到另一页,session,web,integration,phpbb,Session,Web,Integration,Phpbb,我有一个网站(位于根目录中),论坛位于./forum/ 我已使用以下代码成功地将phpBB的会话集成到我的网站索引中: 在之前的我的索引页中: phpbb.php: <?php define('IN_PHPBB', true); $phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './forum/'; $phpEx = substr(strrchr(__FILE__, '.'), 1); requi

我有一个网站(位于根目录中),论坛位于./forum/

我已使用以下代码成功地将phpBB的会话集成到我的网站索引中:

之前的我的索引页中:


phpbb.php:

<?php
define('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH :  './forum/';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
require($phpbb_root_path . 'common.' . $phpEx);
// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup();
?>

显示信息-这在header.php中,包含在我的索引中:

<?php
// Page login notice
if ($user->data['user_id'] == ANONYMOUS)
{
?>

<img src="forum/images/avatars/gallery/noavatar.png" style="float:left; width:72px; height:72px;">
<div class="login">
    <form method="POST" action="forum/ucp.php?mode=login">
    <ul><li><span>Username:</span> <input class="loginfield" type="text" name="username" size="20"></li>
        <li><span>Password:</span> <input class="loginfield" type="password" name="password" size="20"></li>
        <li>Remember Me? <input type="checkbox" name="autologin"> &nbsp; &nbsp; &nbsp; <a href="forum/ucp.php?mode=register">Register</a></li>
        <li><input type="submit" value="Login" name="login"></li>
    </ul>
    <input type="hidden" name="redirect" value="../index2.php">
    </form>
</div>  

<?php
} else { ?>

<img src="forum/images/avatars/gallery/<?php echo $user->data['user_avatar']; ?>" style="float:left; width:72px; height:72px;">
<div class="login">
    Welcome back, <?php echo $user->data['username_clean']; ?><br> 
    You have <?php echo $user->data['user_unread_privmsg']; ?> new messages<br>
    <a href="index2.php?cp=logout">Log Out</a>
</div>
<?php } ?>

  • 用户名:
  • 密码:
  • 还记得我吗
数据['user_avatar'];?>“style=”float:左;宽度:72px;高度:72px;"> 欢迎回来,
您有新消息
我可以使用我创建的表单成功登录索引,但是如果我单击另一个页面(即about.php),我会被要求再次登录。每个页面都会发生这种情况。如果我单击phpbb论坛,也会发生这种情况

有没有办法使我可以登录到任何页面,并且在浏览其他页面时不会重新启动会话


感谢您的帮助!

在phpBB ACP中检查电路板配置中的cookie路径。默认情况下,phpBB会尝试使用指定为cookie路径的电路板根创建限制性cookie

如果cookie路径为
/forum/
,则会话将不会保留在/

<?php
// Page login notice
if ($user->data['user_id'] == ANONYMOUS)
{
?>

<img src="forum/images/avatars/gallery/noavatar.png" style="float:left; width:72px; height:72px;">
<div class="login">
    <form method="POST" action="forum/ucp.php?mode=login">
    <ul><li><span>Username:</span> <input class="loginfield" type="text" name="username" size="20"></li>
        <li><span>Password:</span> <input class="loginfield" type="password" name="password" size="20"></li>
        <li>Remember Me? <input type="checkbox" name="autologin"> &nbsp; &nbsp; &nbsp; <a href="forum/ucp.php?mode=register">Register</a></li>
        <li><input type="submit" value="Login" name="login"></li>
    </ul>
    <input type="hidden" name="redirect" value="../index2.php">
    </form>
</div>  

<?php
} else { ?>

<img src="forum/images/avatars/gallery/<?php echo $user->data['user_avatar']; ?>" style="float:left; width:72px; height:72px;">
<div class="login">
    Welcome back, <?php echo $user->data['username_clean']; ?><br> 
    You have <?php echo $user->data['user_unread_privmsg']; ?> new messages<br>
    <a href="index2.php?cp=logout">Log Out</a>
</div>
<?php } ?>