phpBB注销

4

我可以使用一个集成的登录系统在我的网站和phpBB3中登录。但是我无法注销...我尝试了销毁会话或使用->logout();

我登录的身份是:

    $phpBBusername = $_SESSION['username'];

    $phpBBpassword = $_SESSION['pswd'];

    $result = $auth->login($phpBBusername, $phpBBpassword);
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!';
?>

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();
}

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


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


1
但它会返回论坛索引页面。我该如何更改? - ineedhelp

-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();
?>

这应该可以满足你的需求。


此答案不适用于phpBB。 - naderman
当然适用于PHP,因此同样适用于phpBB。 - rvxnet
1
phpBB不使用PHP的原生会话功能。 - naderman

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接