Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/295.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
phpBB注销_Php_Phpbb3 - Fatal编程技术网

phpBB注销

phpBB注销,php,phpbb3,Php,Phpbb3,我能够登录我的网站和phpBB3的集成登录系统。我不能 注销。。。我试图破坏会话,或使用->注销() 我以以下身份登录: $phpBBusername = $_SESSION['username']; $phpBBpassword = $_SESSION['pswd']; $result = $auth->login($phpBBusername, $phpBBpassword); 请遵守以下代码以实现PHP会话和相关cookie信息的完全清除: <?p

我能够登录我的网站和phpBB3的集成登录系统。我不能

注销。。。我试图破坏会话,或使用->注销()

我以以下身份登录:

    $phpBBusername = $_SESSION['username'];

    $phpBBpassword = $_SESSION['pswd'];

    $result = $auth->login($phpBBusername, $phpBBpassword);

请遵守以下代码以实现PHP会话和相关cookie信息的完全清除:

<?php

// Unset all of the session variables.
$_SESSION = array();

// If it's desired to kill the session, also delete the session cookie.
// Note: This will destroy the session, and not just the session data!
if (ini_get("session.use_cookies")) {
    $params = session_get_cookie_params();
    setcookie(session_name(), '', time() - 42000,
        $params["path"], $params["domain"],
        $params["secure"], $params["httponly"]
    );
}

// Finally, destroy the session.
session_destroy();
?>

为什么不调用PHPBB注销例程并传递会话ID。例如:forums.yourphbforum.com/ucp.php?mode=logout&sid=D8588AB20CF81E72342523

也许您已经找到了答案,但无论如何:

<?php
   define('IN_PHPBB', true);
   $phpbb_root_path = '../phpBB3/';
   $phpEx = substr(strrchr(__FILE__, '.'), 1);
   include("../phpBB3/common.php");

   $user->session_kill();
   echo 'Logged out successfully!';
?>


注意,您需要终止会话两次:)

但它会返回到论坛索引。我该如何改变呢?这个答案不适用于phpBB,当然适用于PHP,因此也适用于phpBB。phpBB不使用PHP的本机会话功能。
public function myphpbb_logout()
{
    define('IN_PHPBB', true);
    global $phpEx, $user, $db, $config, $cache, $template;
    $phpEx = 'php';
    $phpbb_root_path = ('.\/forum\/');
    require_once($phpbb_root_path . 'common.php');
    set_include_path(get_include_path.PATH_SEPARATOR.$phpbb_root_path);

    //logout user
    $user->session_kill();
    $user->session_begin();
    $user->session_kill();
}