I have the following file used in the chat box that is installed in my forum, and I would like to add a code to have a sound notification whenever a member joinchat.
Here is the chatbox.php code:
define('IN_PHPBB', true);
$phpbb_root_path = './../';
include_once($phpbb_root_p
ath . 'extension.inc');
include_once($phpbb_root_p
ath . 'common.'.$phpEx);
include_once($phpbb_root_p
ath . '/chatbox_mod/chatbox_conf
ig.'.$phpE
x);
error_reporting (E_ERROR | E_WARNING | E_PARSE); // This will NOT report uninitialized variables
set_magic_quotes_runtime(0
); // Disable magic_quotes_runtime
//
// Start session management
//
$userdata = session_pagestart($user_ip
, PAGE_INDEX);
init_userprefs($userdata);
//
// End session management
//
$nick = $userdata['username'];
?>
<html>
<head>
<title><?php echo $nick . " - " . $lang['ChatBox'] . " " . _CHATBOX_VERSION; ?></title>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $lang['ENCODING']; ?>">
<link rel="stylesheet" href="<?php echo $chatbox_config['styleshee
t']?>" type="text/css">
<script language="JavaScript">
<!--
function MM_openBrWindow(theURL,win
Name,featu
res)
{
window.open(theURL,winName
,features)
;
}
//-->
</script>
</head>
<?php
// Check User Session
if (!$userdata['session_logge
d_in'])
{
echo "<body>Please login to chat</body></html>";
exit();
}
user_join($nick,"online");
write_msg(_CHATBOX_SYSTEM_
MSG,"<span
style='color: #DD6900'><b><i>$nick</b> has joined chat on " . create_date($board_config[
'default_d
ateformat'
], time(), $board_config['board_timez
one']) . "</i></span>
", "");
?>
<frameset rows="*" cols="30%,*" scrolling=NO noresize framespacing=0 frameborder=NO border="0" onUnload="MM_openBrWindow(
'<?php echo append_sid("chatbox_drop.p
hp"); ?>', 'drop', 'scrollbars=no, width=225, height=100')">
<frame src="<?php echo append_sid("messenger_list
.php"); ?>" name="who" noresize marginwidth="0" marginheight="0">
<frameset rows="80%, 20%" cols="*" scrolling=NO noresize framespacing=0 frameborder=NO border="0">
<frame src="<?php echo append_sid("messenger_view
.php"); ?>" name="ekran" noresize marginwidth="0" marginheight="0">
<frame src="<?php echo append_sid("messenger_send
.php"); ?>" scrolling="no" name="sender" noresize marginwidth="0" marginheight="0">
</frameset>
</frameset>
<noframes>
<body>
Your browser does not support this feature!!!</body>
</noframes>
</html>
And here is the code in index_body.tpl
<!-- BEGIN switch_user_logged_in -->
[ <a href="javascript:void(0);"
onClick="window.open('{S_J
OIN_CHAT}'
,'{CHATBOX
_NAME}','s
crollbars=
yes,width=
540,height
=600,resiz
able')">{L
_CLICK_TO_
JOIN_CHAT}
</a> ]
<!-- END switch_user_logged_in -->
Please help me out. Thank you!