4

我可以使用我的网站和 phpBB3 的集成登录系统登录。我无法

注销...我尝试破坏会话,或使用 ->logout();

我登录为:

    $phpBBusername = $_SESSION['username'];

    $phpBBpassword = $_SESSION['pswd'];

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

4 回答 4

9

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

<?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!';
?>
于 2011-07-27T16:52:52.940 回答
0

为什么不调用 PHPBB 注销例程并传递您的会话 ID。即:forums.yourphpbbforum.com/ucp.php?mode=logout&sid=d8588ab20cf81e7234342523

于 2011-02-19T19:33:16.277 回答
0
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();
}

请注意,您需要终止会话 TWICE :)

于 2013-08-14T13:23:44.170 回答
-1

观察以下代码以实现对 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();
?>

这应该做你需要的。

于 2011-02-19T14:25:20.327 回答