My integration with phpbb3 works fine so far, registered users are found and taken from the phpbb3 database. I also want guests to use my chat, so I create a guest-nick with 2 digit random numbers.
Both can login into the chat, but the guest-nick changes every 2 seconds randomly.
What do I do wrong?
Here is my index.php:
<?php
define('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : '../forum/'; // Path to phpbb
$phpEx = substr(strrchr(__FILE__, '.'), 1); // Set the File extension for page-wide usage.
require($phpbb_root_path . 'common.' . $phpEx); // include the common.php file, this is important, especially for database connects.
$user->session_begin(); // Start session management
$auth->acl($user->data);
$user->setup();
require_once dirname(__FILE__)."/src/phpfreechat.class.php";
$params = array();
$params["debug"] = false;
$params["title"] = "Chat-Raum Allgemein";
$params["serverid"] = md5($params["title"]);
$params["language"] = "de_DE-informal";
$params["channels"] = array("Gemeinsamer Chat");
$params["frozen_channels"] = array("Gemeinsamer Chat");
$params["theme"] = "blune";
$params["timeout"] = 35000; // Default: 35000 = 35 sec
$params["refresh_delay"] = 2000; // Default: 2000 = 2 sec
$params["max_privmsg"] = 5; // Default: 5
$params["max_msg"] = 15; // Default: 20
$params["max_displayed_lines"] = 999; // Default: 150
$params["max_text_len"] = 500; // Default: 400
$params["shownotice"] = 0; // 0 = nothing, 1 = just nickname changes, 2 = connect/quit, 3 = nick + connect/quit
$params["clock"] = false; // Default: true
$params["frozen_nick"] = true; // do not allow to change the nickname
if ($user->data['username'] != "Anonymous") // not a guest
{
$params["nick"] = $user->data['username'];
}
else
{
$params["nick"] = "guest".rand(1,100); // setup random nickname
}
if ($user->data['group_id'] == 4 OR $user->data['group_id'] == 5) // Admins and Moderators
{
$params["isadmin"] = true;
}
else
{
$params["isadmin"] = false;
}
$chat = new phpFreeChat($params);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>Chat-Raum Allgemein</title>
</head>
<body>
<?php $chat->printChat(); ?>
</body>
</html>