PFC Version: 1.3
PHP Version: 4.4.9
Shared or Dedicated Hosting: LOCAL test
Link to your website:
Are you able to reproduce the issue on the official demo (http://www.phpfreechat.net/demo)? No phpBB3 isn't available
Are you seeing any error messages, such as javascript errors? NO
------------------------------------------------------------------------
Problem if user closes their browser without logging out of phpbb3 first, then if they reopen browser before pfc has timed them out then they get a dialog stating that the nick is in use. They can then enter any nick into that dialog even if that nick is not registered in phpbb3 which is a security issue.
I have tried two solutions which should work but they don't
1. set param 'quit_on_closedwindow' but that doesnt seem to work in any browser even though documentation states it only doesnt work in firefox
2. set a low param 'timeout' value eg 3000ms because after the timeout expires the user can use pfc again. However this causes lots of random 'XXXX quit (timeout)' messages for some reason.
The best solution I can find is adding to the start of my php
session_start();
The dialog is no longer displayed stating that the nick is in use, so they cannot enter another nick that is not registered in phpbb3. However, pfc displays the message "Chosen nickname is not allowed" and the user has to wait for pfc to time out their previous session before they can use pfc again.
Can anyone offer a better solution?
I did try expanding on the session_start(); solution but I got bogged down and the following code made no difference
- Code: Select all
// Declare global vars
$loggedIn = TRUE;
$chat = NULL;
$phpbb_root_path = NULL;
$user = NULL;
$UserNick= '';
session_start();
// Get $UserNick either from previous session or from logging into phpbb3. If $UserNick does not
// exist in phpbb3 then set $loggedIn to false
if (isset($_SESSION['login']))
{
$UserNick = $_SESSION['login'];
}
else
{
// How to connect phpBB3 nicknames to phpfreechat
define('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './phpBB3/';
$phpEx = 'php'; //use file extension .php
require($phpbb_root_path . 'common.' . $phpEx);
// Start phpBB session management
$user->session_begin();
$auth->acl($user->data);
$user->setup();
// Test if logged into phpBB
if (!$user->data['is_registered'])
{
$loggedIn = FALSE;
}
else
$UserNick= $user->data['username_clean'];
}
// If logged into phpBB then setup phpFreeChat
if($loggedIn)
{
require_once dirname(__FILE__)."/phpfreechat-1.3/src/phpfreechat.class.php";
$params = array();
$params["title"] = "Tonys chat";
$params["nick"] = $UserNick;
$params["frozen_nick"] = true; // Setting this to true will forbid the user to change his nickname later
$params['firstisadmin'] = false;
$params['theme'] = "blune";
// If phpBB group_id is 4 or 5 ie Admin or Moderator then setup phpFreeChat as isadmin = true
if ($user->data['group_id'] == 4 OR $user->data['group_id'] == 5)
{
$params["isadmin"] = true;
}
$params["serverid"] = md5(__FILE__); // calculate a unique id for this chat
$params["debug"] = false;
// load room1 and create 2 and 3 but put on hold
$params["channels"]= array("Room1");
$params["frozen_channels"]= array("Room1", "Room2", "Room3");
$chat = new phpFreeChat( $params );
}