- Code: Select all
<?php
Header("Cache-control: private, no-cache");
Header("Expires: Mon, 26 Jun 1997 05:00:00 GMT");
Header("Pragma: no-cache");
define('IN_PHPBB', true);
$phpbb_folder_name = '.';
$phpfreechat_folder_name = 'chat';
$phpbb_root_path = '../';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
$userdata = session_pagestart($user_ip, PAGE_INDEX);
init_userprefs($userdata);
require_once dirname(__FILE__)."/src/phpfreechat.class.php";
$params = array();
$params["title"] = "Kissmyrank:) Community Chat";
$params["serverid"] = md5("Kissmyrank"); // calculate a unique id for this chat
$params["channels"] = array("Main Room");
$params["language"] = "en_US";
$params["nick"] = iconv("iso-8859-1", "UTF-8", $userdata[username]);
//$params["nick"] = iconv("windows-1252", "UTF-8", $userdata[username]);
//$params["nick"] = $userdata[username];
$params["theme"] = "zilveer";
$params["frozen_nick"] = true;
$params["proxies_cfg"]["censor"]["words"] = array("heck","darn");
$params["isadmin"] = false;
$params["max_nick_len"] = 30;
$params["timeout"] = 60000;
if ($userdata['user_level'] == ADMIN || $userdata['user_level'] == MOD) $params['isadmin'] = true;
//$params["isadmin"] = true; // just for debug ;)
//$params["debug"] = true;
$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 xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta http-equiv="cache-control" content="no-cache" />
<meta http-equiv="pragma" content="no-cache" />
<title>
<?php echo($board_config['sitename']); ?> :: Chat
</title>
<?php $chat->printJavascript(); ?>
<?php $chat->printStyle(); ?>
<link rel="stylesheet" href="<?php echo($phpbb_root_path . 'templates/ca_artemis/style_main.css'); ?>"
type="text/css" />
</head>
<body>
<?php
if($userdata['session_logged_in'])
{
echo('<span class="gen">');
echo('Hi '.$userdata['username'].'! <a href="'.$phpbb_root_path.'login.php?logout=true&sid='.$userdata['session_id'].'&redirect=..%2F'.$phpfreechat_folder_name.'%2F'.'">Logout</a>');
echo('</span><br />');
?>
<div class="content">
<?php $chat->printChat(); ?>
<p>
Tips:
</p>
<ul>
<li>
To open a <strong>private chat</strong>, click on
the nickname in the right column (user list).
</li>
<li>
To <strong>join a channel</strong>, type this
text in the input box : <code>/join yourchannelname</code>
(replace yourchannelname by what your want)
</li>
<li>
To listen <strong>sound notification</strong>,
put your chat window in the background and wait
for someone post a message.
</li>
</ul>
</div>
<?php
}
else
{
redirect(append_sid($phpbb_root_path . "login.$phpEx?redirect=/chat/" . "index.$phpEx", true));
?>
<?php
}
?>
</body>
<? echo "#".$params["nick"]."#"; ?>
</html>
while this one works.
- Code: Select all
<?php
Header("Cache-control: private, no-cache");
Header("Expires: Mon, 26 Jun 1997 05:00:00 GMT");
Header("Pragma: no-cache");
define('IN_PHPBB', true);
$phpbb_folder_name = '.';
$phpfreechat_folder_name = 'chat';
$phpbb_root_path = '../';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
$userdata = session_pagestart($user_ip, PAGE_INDEX);
init_userprefs($userdata);
require_once dirname(__FILE__)."/src/phpfreechat.class.php";
$params = array();
$params["title"] = "Kissmyrank:) Community Chat";
$params["serverid"] = md5("Kissmyrank"); // calculate a unique id for this chat
$params["channels"] = array("Main Room");
$params["language"] = "en_US";
//$params["nick"] = iconv("iso-8859-1", "UTF-8", $userdata[username]);
//$params["nick"] = iconv("windows-1252", "UTF-8", $userdata[username]);
//$params["nick"] = $userdata[username];
$params["theme"] = "zilveer";
$params["frozen_nick"] = true;
$params["proxies_cfg"]["censor"]["words"] = array("heck","darn");
$params["isadmin"] = false;
$params["max_nick_len"] = 30;
$params["timeout"] = 60000;
if ($userdata['user_level'] == ADMIN || $userdata['user_level'] == MOD) $params['isadmin'] = true;
//$params["isadmin"] = true; // just for debug ;)
//$params["debug"] = true;
$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 xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta http-equiv="cache-control" content="no-cache" />
<meta http-equiv="pragma" content="no-cache" />
<title>
<?php echo($board_config['sitename']); ?> :: Chat
</title>
<?php $chat->printJavascript(); ?>
<?php $chat->printStyle(); ?>
<link rel="stylesheet" href="<?php echo($phpbb_root_path . 'templates/ca_artemis/style_main.css'); ?>"
type="text/css" />
</head>
<body>
<?php
if($userdata['session_logged_in'])
{
echo('<span class="gen">');
echo('Hi '.$userdata['username'].'! <a href="'.$phpbb_root_path.'login.php?logout=true&sid='.$userdata['session_id'].'&redirect=..%2F'.$phpfreechat_folder_name.'%2F'.'">Logout</a>');
echo('</span><br />');
?>
<div class="content">
<?php $chat->printChat(); ?>
<p>
Tips:
</p>
<ul>
<li>
To open a <strong>private chat</strong>, click on
the nickname in the right column (user list).
</li>
<li>
To <strong>join a channel</strong>, type this
text in the input box : <code>/join yourchannelname</code>
(replace yourchannelname by what your want)
</li>
<li>
To listen <strong>sound notification</strong>,
put your chat window in the background and wait
for someone post a message.
</li>
</ul>
</div>
<?php
}
else
{
redirect(append_sid($phpbb_root_path . "login.$phpEx?redirect=/chat/" . "index.$phpEx", true));
?>
<?php
}
?>
</body>
<? echo "#".$params["nick"]."#"; ?>
</html>
My name contains a space and an "@".
I am also admin of the forum.
I get a flashing you are disconnected message.
Error seems to be relative to the encoding of the nick.
Commenting that single line (the one for setting the nick) resolves the disconnected issue (i can send and receive messages right but of course users have to input their nick manually).
When the line is not commented name appears displayed correctly but i can't see nor send messages.
More important on the wrong configuration ie refuses to load the page.
I am using Opera Web Browser but the problem shows up also with firefox.
What am i doing wrong?
Thanks in advance for your help.