PhpBB logout

I can log in with the built-in login system for my site and phpBB3. I cant

logout ... I tried to destroy the session or use → logout ();

I register as:

$phpBBusername = $_SESSION['username']; $phpBBpassword = $_SESSION['pswd']; $result = $auth->login($phpBBusername, $phpBBpassword); 
+4
source share
4 answers

You may have already found the answer, but in any case:

 <?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!'; ?> 
+9
source

Why not call the exit procedure from PHPBB and pass in the session ID. i.e.: forums.yourphpbbforum.com/ucp.php?mode=logout&sid=d8588ab20cf81e7234342523

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

Note that you need to kill the session. TWICE :)

0
source

Observe the following code to completely eliminate the PHP session and related cookie information:

 <?php // Unset all of the session variables. $_SESSION = array(); // If it 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(); ?> 

This should do what you need.

-1
source

Source: https://habr.com/ru/post/1340440/


All Articles