Topic: Chatusers online

I installed the irc chatroom to my page. Now I added some code so that everybody can see who is in the chatroom in my whosonline block from the miniportal.
Now I just have to add some code to the chat.php file that changes the variable in_chat_room in the online table to 1 when somebody goes to that page and to 0 when he leaves it. Especially the last thing causes some trouble for me.
Could anybody provide some code, maybe? Well, at least I know how to change the variables, but I don't know where to paste the code. So - help would be appreciated. I don't know... is it possible to change it as soon as somebody clicks on the link in the navigation bar?
However, here comes the code:

<?php

define('PUN_ROOT', './');
require PUN_ROOT.'include/common.php';

if ($pun_user['g_chat'] == '0')
    message($lang_common['No permission']);

require PUN_ROOT.'lang/'.$pun_user['language'].'/chat.php';

$page_title = pun_htmlspecialchars($pun_config['o_board_title']) . ' / '.$lang_chat['Chat Room'];
require PUN_ROOT.'header.php';

// Prepare various chat applet settings
if ($pun_user['is_guest'])
{
    $chat_nick = $pun_config['c_guest_nick'];
    $chat_altnick = $pun_config['c_guest_alt_nick'];
    $chat_ident = $pun_config['c_guest_nick'];
}
else
{
    $chat_nick = $pun_user['username'];
    $chat_altnick = $pun_user['username']."??";
    $chat_ident = $pun_user['username'];
}
//Language Settings
$chat_language = $pun_user['language'];
if (!@file_exists(PUN_ROOT.'chat/lang/'.$pun_user['language'].'.lng'))
    $chat_language = "English";
    
//Style Settings
$chat_style = $pun_user['style'];
if (!@file_exists(PUN_ROOT.'chat/style/'.$chat_style.'.php'))
    $chat_style = "Oxygen";
    
require PUN_ROOT.'chat/style/'.$chat_style.'.php';
    
?>
<script type="text/javascript" src="./chat/chat.js"></script>
<div class="block">
    <h2><span>Chat Room</span></h2>
    <div class="box">
    <div class="inbox">
    <object name="pjirc" classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" codebase="http://java.sun.com/products/plugin/autodl/jinstall-1_4-windows-i586.cab#Version=1,4,0,0" height="400" width="100%"> 
    
        <param name="codebase" value="chat/" />  
        <param name="code" value="IRCApplet.class" />
        <param name="archive" value="irc.jar, pixx.jar" />
        <param name="CABINETS" value="irc.cab, securedirc.cab, pixx.cab" />
        
        <param name="nick" value="<?php echo $chat_nick; ?>" />
        <param name="alternatenick" value="<?php echo $chat_altnick; ?>" />
        <param name="host" value="<?php echo $pun_config['c_irc_server']; ?>" />
        <param name="userid" value="<?php echo $chat_ident; ?>" />
        <param name="name" value="<?php echo $pun_config['c_real_name']; ?>" />
        <param name="command1" value="<?php echo $pun_config['c_on_connect_1']; ?>" />
        <param name="command2" value="<?php echo $pun_config['c_on_connect_2']; ?>" />
        <param name="command3" value="<?php echo $pun_config['c_on_connect_3']; ?>" />
        <param name="authorizedjoinlist" value="all" />
        <param name="authorizedleavelist" value="all" />
        <param name="fingerreply" value="<?php echo $pun_config['c_user_info']; ?>" />
        <param name="userinforeply" value="<?php echo $pun_config['c_user_info']; ?>" />
        <param name="quitmessage" value="<?php echo $pun_config['c_quit_message']; ?>" />
        <param name="language" value="<?php echo './lang/'.strtolower($chat_language); ?>" />
        <param name="lngextension" value="lng" />
        <param name="soundbeep" value="snd/bell2.au" />
        <param name="soundquery" value="snd/ding.au" />
        <param name="highlight" value="true" />
        
        <param name="style:sourcefontrule1" value="Status+Channel+Query all SansSerif 14" />
        
        <param name="pixx:language" value="<?php echo './lang/pixx-'.strtolower($chat_language); ?>" />
        
        <!-- Other settings you can't change in the plugin -->
        <param name="style:righttoleft" value="false" />
        <param name="pixx:highlightnick" value="true" />
        <param name="pixx:styleselector" value="true" />
        <param name="pixx:setfontonstyle" value="false" />
        <param name="pixx:timestamp" value="true" />
        <param name="pixx:showabout" value="false" />
        <param name="pixx:showhelp" value="false" />
        <param name="pixx:nickfield" value="false" />
        <param name="pixx:showdock" value="false" />
        <param name="pixx:mouseurlopen" value="1 2" />
        <param name="pixx:mousechanneljoin" value="1 2" />
        
        <param name="gui" value="pixx" />
        <!-- Smilies for the java chat GUI -->
        <param name="style:bitmapsmileys" value="true" />
        <param name="style:smiley1" value=":) ../img/smilies/smile.png" />
        <param name="style:smiley2" value=":-) ../img/smilies/smile.png" />
        <param name="style:smiley3" value=":D ../img/smilies/big_smile.png" />
        <param name="style:smiley4" value=":-D ../img/smilies/big_smile.png" />
        <param name="style:smiley5" value=":-O ../img/smilies/yikes.png" />
        <param name="style:smiley6" value=":o ../img/smilies/yikes.png" />
        <param name="style:smiley7" value=":O ../img/smilies/yikes.png" />
        <param name="style:smiley8" value=":p ../img/smilies/tongue.png" />
        <param name="style:smiley9" value=":P ../img/smilies/tongue.png" />
        <param name="style:smiley10" value=":-P ../img/smilies/tongue.png" />
        <param name="style:smiley11" value=";) ../img/smilies/wink.png" />
        <param name="style:smiley12" value=";-) ../img/smilies/wink.png" />
        <param name="style:smiley13" value=":( ../img/smilies/sad.png" />
        <param name="style:smiley14" value=":| ../img/smilies/neutral.png" />
        <param name="style:smiley15" value=":-| ../img/smilies/neutral.png" />
        <param name="style:smiley16" value=":'( ../img/smilies/sad.png" />
        <param name="style:smiley17" value=":\ ../img/smilies/hmm.png" />
        <param name="style:smiley18" value=":-\ ../img/smilies/hmm.png" />
        <param name="style:smiley19" value="(H) ../img/smilies/cool.png" />
        <param name="style:smiley20" value="(h) ../img/smilies/cool.png" />
        <param name="style:smiley21" value="8) ../img/smilies/cool.png" />
        <param name="style:smiley22" value=":lol: ../img/smilies/lol.png" />
        <param name="style:smiley23" value=":-@ ../img/smilies/mad.png" />
        <param name="style:smiley24" value=":@ ../img/smilies/mad.png" />
        <param name="style:smiley25" value=":s ../img/smilies/roll.png" />
        <param name="style:smiley26" value=":-S ../img/smilies/roll.png" />
        <param name="style:smiley27" value=":mad: ../img/smilies/mad.png" />
        <param name="style:smiley28" value=":rolleyes: ../img/smilies/roll.png" />
        <param name="style:smiley29" value=":cool: ../img/smilies/cool.png" />
        <param name="style:smiley30" value="=) ../img/smilies/smile.png" />
        <param name="style:smiley31" value="=D ../img/smilies/big_smile.png" />
        <param name="style:smiley32" value="=| ../img/smilies/neutral.png" />
        <param name="style:smiley33" value=":=( ../img/smilies/sad.png" />
        <!--Menus for the java chat GUI -->
        <param name="pixx:configurepopup" value="true" />
        <param name="pixx:popupmenustring1" value="Whois" />
        <param name="pixx:popupmenustring2" value="Query" />
        <param name="pixx:popupmenustring3" value="Ban" />
        <param name="pixx:popupmenustring4" value="Kick + Ban" />
        <param name="pixx:popupmenustring5" value="--" />
        <param name="pixx:popupmenustring6" value="Op" />
        <param name="pixx:popupmenustring7" value="DeOp" />
        <param name="pixx:popupmenustring8" value="HalfOp" />
        <param name="pixx:popupmenustring9" value="DeHalfOp" />
        <param name="pixx:popupmenustring10" value="Voice" />
        <param name="pixx:popupmenustring11" value="DeVoice" />
        <param name="pixx:popupmenustring12" value="--" />
        <param name="pixx:popupmenustring13" value="Ping" />
        <param name="pixx:popupmenustring14" value="Version" />
        <param name="pixx:popupmenustring15" value="Time" />
        <param name="pixx:popupmenustring16" value="Finger" />
        <param name="pixx:popupmenustring17" value="--" />
        <param name="pixx:popupmenustring18" value="DCC Send" />
        <param name="pixx:popupmenustring19" value="DCC Chat" />
        <param name="pixx:popupmenucommand1_1" value="/Whois %1" />
        <param name="pixx:popupmenucommand2_1" value="/Query %1" />
        <param name="pixx:popupmenucommand3_1" value="/mode %2 -o %1" />
        <param name="pixx:popupmenucommand3_2" value="/mode %2 +b %1" />
        <param name="pixx:popupmenucommand4_1" value="/mode %2 -o %1" />
        <param name="pixx:popupmenucommand4_2" value="/mode %2 +b %1" />
        <param name="pixx:popupmenucommand4_3" value="/kick %2 %1" />
        <param name="pixx:popupmenucommand6_1" value="/mode %2 +o %1" />
        <param name="pixx:popupmenucommand7_1" value="/mode %2 -o %1" />
        <param name="pixx:popupmenucommand8_1" value="/mode %2 +h %1" />
        <param name="pixx:popupmenucommand9_1" value="/mode %2 -h %1" />
        <param name="pixx:popupmenucommand10_1" value="/mode %2 +v %1" />
        <param name="pixx:popupmenucommand11_1" value="/mode %2 -v %1" />
        <param name="pixx:popupmenucommand13_1" value="/CTCP PING %1" />
        <param name="pixx:popupmenucommand14_1" value="/CTCP VERSION %1" />
        <param name="pixx:popupmenucommand15_1" value="/CTCP TIME %1" />
        <param name="pixx:popupmenucommand16_1" value="/CTCP FINGER %1" />
        <param name="pixx:popupmenucommand18_1" value="/DCC SEND %1" />
        <param name="pixx:popupmenucommand19_1" value="/DCC CHAT %1" />
        <!-- Colours for the java chat GUI -->
        <param name="pixx:color0" value="<?php echo $pixx_colour[1] ?>" /> <!-- Button Highlight / Popup & Close Button Text & Higlight / Scrollbar Highlight -->
        <param name="pixx:color1" value="<?php echo $pixx_colour[2] ?>" /> <!-- Button Border & Text : ScrollBar Border & arrow : Popup & Close button Border : User List border & Text & icons -->
        <param name="pixx:color2" value="<?php echo $pixx_colour[3] ?>" /> <!-- Popup & Close button shadow -->
        <param name="pixx:color3" value="<?php echo $pixx_colour[4] ?>" /> <!-- Scrollbar shadow -->
        <param name="pixx:color4" value="<?php echo $pixx_colour[5] ?>" /> <!-- Scrollbar de-light (3D Dim colour) -->
        <param name="pixx:color5" value="<?php echo $pixx_colour[6] ?>" /> <!-- foreground : Buttons Face : Scrollbar Face -->
        <param name="pixx:color6" value="<?php echo $pixx_colour[7] ?>" /> <!-- background : Header : Scrollbar Track : Footer background -->
        <param name="pixx:color7" value="<?php echo $pixx_colour[8] ?>" /> <!-- selection : Status & Window button active colour -->
        <param name="pixx:color8" value="<?php echo $pixx_colour[9] ?>" /> <!-- event Color  -->
        <param name="pixx:color9" value="<?php echo $pixx_colour[10] ?>" /> <!-- close button -->
        <param name="pixx:color10" value="<?php echo $pixx_colour[11] ?>" /> <!-- voice icon  -->
        <param name="pixx:color11" value="<?php echo $pixx_colour[12] ?>" /> <!-- operator icon  -->
        <param name="pixx:color12" value="<?php echo $pixx_colour[13] ?>" /> <!-- halfoperator icon -->
        <param name="pixx:color13" value="<?php echo $pixx_colour[14] ?>" /> <!-- male ASL -->
        <param name="pixx:color14" value="<?php echo $pixx_colour[15] ?>" /> <!-- female ASL -->
        <param name="pixx:color15" value="<?php echo $pixx_colour[16] ?>" /> <!-- unknown ASL -->
        <param name="style:sourcecolorrule1" value="all all 0=<?php echo $pixx_colour[17] ?> 1=<?php echo $pixx_colour[18] ?>" />
        <!--[if !IE]>  -->
        
        <object name="pjircb" codebase="chat/" classid="java:IRCApplet.class" archive="irc.jar, pixx.jar" height="400" width="100%">
        
            <param name="CABINETS" value="irc.cab, securedirc.cab, pixx.cab" />
            
            <param name="nick" value="<?php echo $chat_nick; ?>" />
            <param name="alternatenick" value="<?php echo $chat_altnick; ?>" />
            <param name="host" value="<?php echo $pun_config['c_irc_server']; ?>" />
            <param name="userid" value="<?php echo $chat_ident; ?>" />
            <param name="name" value="<?php echo $pun_config['c_real_name']; ?>" />
            <param name="command1" value="<?php echo $pun_config['c_on_connect_1']; ?>" />
            <param name="command2" value="<?php echo $pun_config['c_on_connect_2']; ?>" />
            <param name="command3" value="<?php echo $pun_config['c_on_connect_3']; ?>" />
            <param name="authorizedjoinlist" value="all" />
            <param name="authorizedleavelist" value="all" />
            <param name="fingerreply" value="<?php echo $pun_config['c_user_info']; ?>" />
            <param name="userinforeply" value="<?php echo $pun_config['c_user_info']; ?>" />
            <param name="quitmessage" value="<?php echo $pun_config['c_quit_message']; ?>" />
            <param name="language" value="<?php echo './lang/'.strtolower($chat_language); ?>" />
            <param name="lngextension" value="lng" />
            <param name="soundbeep" value="snd/bell2.au" />
            <param name="soundquery" value="snd/ding.au" />
            <param name="highlight" value="true" />
            
            <param name="style:sourcefontrule1" value="Status+Channel+Query all SansSerif 14" />
            
            <param name="pixx:language" value="<?php echo './lang/pixx-'.strtolower($chat_language); ?>" />
            
            <!-- Other settings you can't change in the plugin -->
            <param name="style:righttoleft" value="false" />
            <param name="pixx:highlightnick" value="true" />
            <param name="pixx:styleselector" value="true" />
            <param name="pixx:setfontonstyle" value="false" />
            <param name="pixx:timestamp" value="true" />
            <param name="pixx:showabout" value="false" />
            <param name="pixx:showhelp" value="false" />
            <param name="pixx:nickfield" value="false" />
            <param name="pixx:showdock" value="false" />
            <param name="pixx:mouseurlopen" value="1 2" />
            <param name="pixx:mousechanneljoin" value="1 2" />
            
            <param name="gui" value="pixx" />
            <!-- Smilies for the java chat GUI -->
            <param name="style:bitmapsmileys" value="true" />
            <param name="style:smiley1" value=":) ../img/smilies/smile.png" />
            <param name="style:smiley2" value=":-) ../img/smilies/smile.png" />
            <param name="style:smiley3" value=":D ../img/smilies/big_smile.png" />
            <param name="style:smiley4" value=":-D ../img/smilies/big_smile.png" />
            <param name="style:smiley5" value=":-O ../img/smilies/yikes.png" />
            <param name="style:smiley6" value=":o ../img/smilies/yikes.png" />
            <param name="style:smiley7" value=":O ../img/smilies/yikes.png" />
            <param name="style:smiley8" value=":p ../img/smilies/tongue.png" />
            <param name="style:smiley9" value=":P ../img/smilies/tongue.png" />
            <param name="style:smiley10" value=":-P ../img/smilies/tongue.png" />
            <param name="style:smiley11" value=";) ../img/smilies/wink.png" />
            <param name="style:smiley12" value=";-) ../img/smilies/wink.png" />
            <param name="style:smiley13" value=":( ../img/smilies/sad.png" />
            <param name="style:smiley14" value=":| ../img/smilies/neutral.png" />
            <param name="style:smiley15" value=":-| ../img/smilies/neutral.png" />
            <param name="style:smiley16" value=":'( ../img/smilies/sad.png" />
            <param name="style:smiley17" value=":\ ../img/smilies/hmm.png" />
            <param name="style:smiley18" value=":-\ ../img/smilies/hmm.png" />
            <param name="style:smiley19" value="(H) ../img/smilies/cool.png" />
            <param name="style:smiley20" value="(h) ../img/smilies/cool.png" />
            <param name="style:smiley21" value="8) ../img/smilies/cool.png" />
            <param name="style:smiley22" value=":lol: ../img/smilies/lol.png" />
            <param name="style:smiley23" value=":-@ ../img/smilies/mad.png" />
            <param name="style:smiley24" value=":@ ../img/smilies/mad.png" />
            <param name="style:smiley25" value=":s ../img/smilies/roll.png" />
            <param name="style:smiley26" value=":-S ../img/smilies/roll.png" />
            <param name="style:smiley27" value=":mad: ../img/smilies/mad.png" />
            <param name="style:smiley28" value=":rolleyes: ../img/smilies/roll.png" />
            <param name="style:smiley29" value=":cool: ../img/smilies/cool.png" />
            <param name="style:smiley30" value="=) ../img/smilies/smile.png" />
            <param name="style:smiley31" value="=D ../img/smilies/big_smile.png" />
            <param name="style:smiley32" value="=| ../img/smilies/neutral.png" />
            <param name="style:smiley33" value=":=( ../img/smilies/sad.png" />
            <!--Menus for the java chat GUI -->
            <param name="pixx:configurepopup" value="true" />
            <param name="pixx:popupmenustring1" value="Whois" />
            <param name="pixx:popupmenustring2" value="Query" />
            <param name="pixx:popupmenustring3" value="Ban" />
            <param name="pixx:popupmenustring4" value="Kick + Ban" />
            <param name="pixx:popupmenustring5" value="--" />
            <param name="pixx:popupmenustring6" value="Op" />
            <param name="pixx:popupmenustring7" value="DeOp" />
            <param name="pixx:popupmenustring8" value="HalfOp" />
            <param name="pixx:popupmenustring9" value="DeHalfOp" />
            <param name="pixx:popupmenustring10" value="Voice" />
            <param name="pixx:popupmenustring11" value="DeVoice" />
            <param name="pixx:popupmenustring12" value="--" />
            <param name="pixx:popupmenustring13" value="Ping" />
            <param name="pixx:popupmenustring14" value="Version" />
            <param name="pixx:popupmenustring15" value="Time" />
            <param name="pixx:popupmenustring16" value="Finger" />
            <param name="pixx:popupmenustring17" value="--" />
            <param name="pixx:popupmenustring18" value="DCC Send" />
            <param name="pixx:popupmenustring19" value="DCC Chat" />
            <param name="pixx:popupmenucommand1_1" value="/Whois %1" />
            <param name="pixx:popupmenucommand2_1" value="/Query %1" />
            <param name="pixx:popupmenucommand3_1" value="/mode %2 -o %1" />
            <param name="pixx:popupmenucommand3_2" value="/mode %2 +b %1" />
            <param name="pixx:popupmenucommand4_1" value="/mode %2 -o %1" />
            <param name="pixx:popupmenucommand4_2" value="/mode %2 +b %1" />
            <param name="pixx:popupmenucommand4_3" value="/kick %2 %1" />
            <param name="pixx:popupmenucommand6_1" value="/mode %2 +o %1" />
            <param name="pixx:popupmenucommand7_1" value="/mode %2 -o %1" />
            <param name="pixx:popupmenucommand8_1" value="/mode %2 +h %1" />
            <param name="pixx:popupmenucommand9_1" value="/mode %2 -h %1" />
            <param name="pixx:popupmenucommand10_1" value="/mode %2 +v %1" />
            <param name="pixx:popupmenucommand11_1" value="/mode %2 -v %1" />
            <param name="pixx:popupmenucommand13_1" value="/CTCP PING %1" />
            <param name="pixx:popupmenucommand14_1" value="/CTCP VERSION %1" />
            <param name="pixx:popupmenucommand15_1" value="/CTCP TIME %1" />
            <param name="pixx:popupmenucommand16_1" value="/CTCP FINGER %1" />
            <param name="pixx:popupmenucommand18_1" value="/DCC SEND %1" />
            <param name="pixx:popupmenucommand19_1" value="/DCC CHAT %1" />
            <!-- Colours for the java chat GUI -->
            <param name="pixx:color0" value="<?php echo $pixx_colour[1] ?>" /> <!-- Button Highlight / Popup & Close Button Text & Higlight / Scrollbar Highlight -->
            <param name="pixx:color1" value="<?php echo $pixx_colour[2] ?>" /> <!-- Button Border & Text : ScrollBar Border & arrow : Popup & Close button Border : User List border & Text & icons -->
            <param name="pixx:color2" value="<?php echo $pixx_colour[3] ?>" /> <!-- Popup & Close button shadow -->
            <param name="pixx:color3" value="<?php echo $pixx_colour[4] ?>" /> <!-- Scrollbar shadow -->
            <param name="pixx:color4" value="<?php echo $pixx_colour[5] ?>" /> <!-- Scrollbar de-light (3D Dim colour) -->
            <param name="pixx:color5" value="<?php echo $pixx_colour[6] ?>" /> <!-- foreground : Buttons Face : Scrollbar Face -->
            <param name="pixx:color6" value="<?php echo $pixx_colour[7] ?>" /> <!-- background : Header : Scrollbar Track : Footer background -->
            <param name="pixx:color7" value="<?php echo $pixx_colour[8] ?>" /> <!-- selection : Status & Window button active colour -->
            <param name="pixx:color8" value="<?php echo $pixx_colour[9] ?>" /> <!-- event Color  -->
            <param name="pixx:color9" value="<?php echo $pixx_colour[10] ?>" /> <!-- close button -->
            <param name="pixx:color10" value="<?php echo $pixx_colour[11] ?>" /> <!-- voice icon  -->
            <param name="pixx:color11" value="<?php echo $pixx_colour[12] ?>" /> <!-- operator icon  -->
            <param name="pixx:color12" value="<?php echo $pixx_colour[13] ?>" /> <!-- halfoperator icon -->
            <param name="pixx:color13" value="<?php echo $pixx_colour[14] ?>" /> <!-- male ASL -->
            <param name="pixx:color14" value="<?php echo $pixx_colour[15] ?>" /> <!-- female ASL -->
            <param name="pixx:color15" value="<?php echo $pixx_colour[16] ?>" /> <!-- unknown ASL -->
            <param name="style:sourcecolorrule1" value="all all 0=<?php echo $pixx_colour[17] ?> 1=<?php echo $pixx_colour[18] ?>" />
           <strong>
              <?php echo $lang_chat['This browser does not have a Java Plug-in.'] ?>
              <br />
              <a href="http://java.sun.com/products/plugin/downloads/index.html">
                <?php echo $lang_chat['Get the latest Java Plug-in here.'] ?>
              </a>
            </strong>            
        </object> 
    <!-- <![endif]-->
    </object>
    <p class="con" style="TEXT-ALIGN: right">
            <a href="javascript:smiley(':)')"><img src="img/smilies/smile.png" width="15" height="15" style="BORDER: 0" alt=":)" /></a>
            <a href="javascript:smiley(':D')"><img src="img/smilies/big_smile.png" width="15" height="15" style="BORDER: 0" alt=":D" /></a>
            <a href="javascript:smiley(':lol:')"><img src="img/smilies/lol.png" width="15" height="15" style="BORDER: 0" alt=":lol:" /></a>
            <a href="javascript:smiley(':o')"><img src="img/smilies/yikes.png" width="15" height="15" style="BORDER: 0" alt=":o" /></a>
            <a href="javascript:smiley(':P')"><img src="img/smilies/tongue.png" width="15" height="15" style="BORDER: 0" alt=":P" /></a>
            <a href="javascript:smiley(';)')"><img src="img/smilies/wink.png" width="15" height="15" style="BORDER: 0" alt=";)" /></a>
            <a href="javascript:smiley(':(')"><img src="img/smilies/sad.png" width="15" height="15" style="BORDER: 0" alt=":(" /></a>
            <a href="javascript:smiley(':|')"><img src="img/smilies/neutral.png" width="15" height="15" style="BORDER: 0" alt=":|" /></a>
            <a href="javascript:smiley(':\\')"><img src="img/smilies/hmm.png" width="15" height="15" style="BORDER: 0" alt=":\" /></a>
            <a href="javascript:smiley('(H)')"><img src="img/smilies/cool.png" width="15" height="15" style="BORDER: 0" alt="(H)" /></a>
            <a href="javascript:smiley(':@')"><img src="img/smilies/mad.png" width="15" height="15" style="BORDER: 0" alt=":@" /></a>
            <a href="javascript:smiley(':s')"><img src="img/smilies/roll.png" width="15" height="15" style="BORDER: 0" alt=":s" /></a>
            : <?php echo $lang_chat['Clickable Smilies'] ?>
        </p>
        <form id="form" action="">
        <p class="con" style="TEXT-ALIGN: right">
            <input type="button" value="Set Away" onclick="maway(document.getElementById('form').away_reason.value,'<?php echo $chat_nick; ?>')" />
            <input type="button" value="Set Back" onclick="mback(document.getElementById('form').away_reason.value,'<?php echo $chat_nick; ?>')" />
            <input name="away_reason" type="text" size="30" />
            : <?php echo $lang_chat['Away Message'] ?>
        </p>
        </form>
    </div>
    </div>
</div>

<?php
require PUN_ROOT.'footer.php';

Thanks

FluxBB - v1.4.8

Re: Chatusers online

Moved to Modifications

Re: Chatusers online

the variable in_chat_room in the online table to 1 when somebody goes to that page and to 0 when he leaves it.

When someone enters is easy. When someone leaves... if they close the browser? if they type a new address in the address bar? if they have javascript disabled (javascript ~could~ catch the last two examples)? Also what about guests, who decide to log-on. One guest out, one new user, ect... ect...

Does the chatroom have a user list that shows up when using the irc chatroom thingy? You could steal that code and put it in your miniportal.

echo "deadram"; echo; fortune;

Re: Chatusers online

deadram wrote:

Does the chatroom have a user list that shows up when using the irc chatroom thingy? You could steal that code and put it in your miniportal.

Yes, I think, it does. But that would update too late (meaning sidebar would update earlier then userlist in chat room), although that should not matter (you don't have to see your own name there). Guests are not allowed in my chat room.
Ok, could you give me some code for when the user leaves?

deadram wrote:

if they close the browser? if they type a new address in the address bar?

Ok, how do I do that? The good thing is the chat room opens in a new window in my forum, so that would be perfect.
Could you offer some code? roll

FluxBB - v1.4.8

5 (edited by deadram 2007-03-07 06:42)

Re: Chatusers online

Well... you posted the php code to display a java object. I don't really know anything about how this java applet stores user information without seeing it's code.

Ok, how do I do that? The good thing is the chat room opens in a new window in my forum, so that would be perfect.

I sort of tried to say before... Don't do this in php, or javascript. Use the code that the chatroom is already using. FYI disabling javascript and disabling java are two different things. People could have java applets allowed without allowing javascript.

You might be able to find some php code on the google.country that will let you query an IRC server for it's current user list. That would also work here. All you need is the IRC's user list, in a php variable. No need to create another full blow online list for one php page.

EDIT --

Doing this from the php page also means that users who figure out your IRC channels location, and use something like mirc to connect instead of the page won't be listed.

echo "deadram"; echo; fortune;

Re: Chatusers online

Here is the java(script) file. I looked at it and did not really have a clue, so could you please help:

var english = 0;
var german  = 1;

var lang = english;

var ltxt = new Array();

ltxt[ 0] = ["is away!","ist weg!"];
ltxt[ 1] = ["Reason:","Grund:"];
ltxt[ 2] = ["is back","ist zurück"];
ltxt[ 3] = ["from:","von:"];
ltxt[ 4] = ["Guest","Gast"];
ltxt[ 5] = ["away time","Abwesenheit"];
ltxt[ 6] = ["you are already away!","Du bist bereits abwesend!"];
ltxt[ 7] = ["you are not away!","Du bist nicht abwesend!"];

var mtime;
var jtime;
var lev = 0;
var isaway = false;

function smiley(symbol) {
    var agt=navigator.userAgent.toLowerCase();
    var is_ie     = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));
    if(is_ie) {
        document.pjirc.setFieldText(document.pjirc.getFieldText()+' '+symbol);
        document.pjirc.requestSourceFocus();
    }
    else {
        document.pjircb.setFieldText(document.pjircb.getFieldText()+' '+symbol);
        document.pjircb.requestSourceFocus();
    }
}

function maway(away_reason,nick) {
    if (!isaway) {
        var agt=navigator.userAgent.toLowerCase();
        var is_ie     = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));
        if(is_ie) {
            txt = "/me " + ltxt[0][lang];
            if (away_reason != "") txt += " " + ltxt[1][lang] + " " + away_reason;
            document.pjirc.sendString(txt);
            document.pjirc.sendString("/away " + away_reason);
            document.pjirc.sendString("/nick " + nick +"|away");
            document.pjirc.requestSourceFocus();
            mtime = new Date();
        }
        else {
            txt = "/me " + ltxt[0][lang];
            if (away_reason != "") txt += " " + ltxt[1][lang] + " " + away_reason;
            document.pjircb.sendString(txt);
            document.pjircb.sendString("/away " + away_reason);
            document.pjircb.sendString("/nick " + nick +"|away");
            document.pjircb.requestSourceFocus();
            mtime = new Date();
        }
    } else alert(ltxt[6][lang]);
    isaway = true;
}

function mback(away_reason,nick) {
    if (isaway) {
        var agt=navigator.userAgent.toLowerCase();
        var is_ie     = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));
        if(is_ie) {
            jtime = new Date(); lev = 0; mins = 0; hours = 0;
            secs = Math.round((Date.parse(jtime)-Date.parse(mtime))/1000);
            if (secs>59) {mins = parseInt(secs/60); secs %= 60; lev=1;}
            if (lev==1 && mins>59) {hours = parseInt(mins/60); mins %= 60; lev=2;}
    
            awaytxt = ". "+ltxt[5][lang] + ": ";
            if (lev==2) awaytxt += hours+"h, ";
            if (lev==1) awaytxt += mins+"min, ";
            awaytxt += secs+"sec";

            txt = "/me " + ltxt[2][lang];
            if (away_reason != "") txt += " " + ltxt[3][lang] + " " + away_reason;
            document.pjirc.sendString(txt + awaytxt + ".");
            document.pjirc.sendString("/away ");
            document.pjirc.sendString("/nick " + nick);
            document.pjirc.requestSourceFocus();
        }
        else {
            jtime = new Date(); lev = 0; mins = 0; hours = 0;
            secs = Math.round((Date.parse(jtime)-Date.parse(mtime))/1000);
            if (secs>59) {mins = parseInt(secs/60); secs %= 60; lev=1;}
            if (lev==1 && mins>59) {hours = parseInt(mins/60); mins %= 60; lev=2;}
    
            awaytxt = ". "+ltxt[5][lang] + ": ";
            if (lev==2) awaytxt += hours+"h, ";
            if (lev==1) awaytxt += mins+"min, ";
            awaytxt += secs+"sec";

            txt = "/me " + ltxt[2][lang];
            if (away_reason != "") txt += " " + ltxt[3][lang] + " " + away_reason;
            document.pjircb.sendString(txt + awaytxt + ".");
            document.pjircb.sendString("/away ");
            document.pjircb.sendString("/nick " + nick);
            document.pjircb.requestSourceFocus();
        }
    } else alert(ltxt[7][lang]);
    isaway = false;
}
FluxBB - v1.4.8

Re: Chatusers online

Does anybody have an idea?

FluxBB - v1.4.8