576

(4 replies, posted in Programming)

I want to execute some php comments in a .js file. Is that possible?

EDIT: Of course I mean commands, not comments.

577

(4 replies, posted in Programming)

How can I do php in Javascript? (I know, that sounds really dumm, but...)

SWEET!
Thanks a lot!

Thanks. I just answered the question myself when I saw the big punBB-frontpage "mod".
Thanks again.

I installed some mods and now some friends of mine want punBB for their site, too. Can I just give them all of my files, (all the copyright stuff is still in there) or do they have to modify everything themselves?
Thanks for the info.

Does anybody have an idea?

...
I know that would force me to modify config.php (pretty heavy!). But did anybody already write something like that? I want to make it so that, depending on from where from my website you come to the forum, you use a different database or at least another prefix (that would hold the changes down)?

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;
}
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

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

Could anybody help me, please?
Again, the error message is:

Warning: preg_replace(): Compilation failed: unmatched parentheses at offset 5 in /home/content/d/e/b/debsue/html/biblestudy/forum/include/parser.php on line 383

Warning: preg_replace(): No ending delimiter '#' found in /home/content/d/e/b/debsue/html/biblestudy/forum/include/parser.php on line 383

Warning: preg_replace(): Compilation failed: unmatched parentheses at offset 6 in /home/content/d/e/b/debsue/html/biblestudy/forum/include/parser.php on line 383

Warning: preg_replace(): No ending delimiter '#' found in /home/content/d/e/b/debsue/html/biblestudy/forum/include/parser.php on line 383

587

(12 replies, posted in Programming)

I figured it out - pretty much. It is because of the forum main page. It is the only page where the people that are logged in don't show up. Not even after I update it 50 times!
@elbekko: Could I send you the questionable file so that you could look through it. It is not even really long.
Thanks for all the help.

588

(12 replies, posted in Programming)

It does not though.
Here is the whole code:
I added that chatonline myself to show on the main page how many people are in my chatroom

function generate_whosonline()
{
    global $pun_config, $lang_common, $pun_user, $db;
    
    if ($pun_user['is_guest'])
    {
        require PUN_ROOT.'lang/'.$pun_user['language'].'/login.php';
        return 'Welcome Guest!<br />
            Please login.<br />
            <form id="login" method="post" action="login.php?action=in" onsubmit="return process_form(this)">
                <input type="hidden" name="form_sent" value="1" />
                <input type="hidden" name="redirect_url" value="index.php" />
                <label><strong>Username</strong><br /><input type="text" name="req_username" size="13" maxlength="25" tabindex="1" /><br /></label>
                <label><strong>Password</strong><br /><input type="password" name="req_password" size="13" maxlength="16" tabindex="2" /><br /></label>
                <p><a href="register.php" tabindex="4">'.$lang_login['Not registered'].'</a><br /></p>
                <p><a href="login.php?action=forget" tabindex="5">'.$lang_login['Forgotten pass'].'</a></p>
                <p><input type="submit" name="login" value="Login" tabindex="3" /></p>
            </form>';
    }
    else
    {
        require PUN_ROOT.'lang/'.$pun_user['language'].'/index.php';
        $result = $db->query('SELECT COUNT(id)-1 FROM '.$db->prefix.'users') or error('Unable to fetch total user count', __FILE__, __LINE__, $db->error());
        $stats['total_users'] = $db->result($result);
        
        $result = $db->query('SELECT id, username FROM '.$db->prefix.'users ORDER BY registered DESC LIMIT 1') or error('Unable to fetch newest registered user', __FILE__, __LINE__, $db->error());
        $stats['last_user'] = $db->fetch_assoc($result);
        
        $result = $db->query('SELECT SUM(num_topics), SUM(num_posts) FROM '.$db->prefix.'forums') or error('Unable to fetch topic/post count', __FILE__, __LINE__, $db->error());
        list($stats['total_topics'], $stats['total_posts']) = $db->fetch_row($result);
        
        $result = $db->query('SELECT COUNT(id) FROM '.$db->prefix.'polls') or error('Unable to fetch poll count', __FILE__, __LINE__, $db->error());
        $stats['total_polls'] = $db->result($result);
        
        if ($pun_config['o_users_online'] == '1')
        {
            // Fetch users online info and generate strings for output
            
            $num_guests = 0;
            $users = array();
            $online = array();
            $chatusers = array();
            $chatonline = array();
            $result = $db->query('SELECT user_id, ident FROM '.$db->prefix.'online WHERE idle=0 ORDER BY ident', true) or error('Unable to fetch online list', __FILE__, __LINE__, $db->error());
        
            while ($pun_user_online = $db->fetch_assoc($result))
            {
                if ($pun_user_online['user_id'] > 1)
                    $users[] = "\n\t\t\t\t".'<a href="profile.php?id='.$pun_user_online['user_id'].'">'.pun_htmlspecialchars($pun_user_online['ident']).'</a><br />';
                else
                    ++$num_guests;
            }
            
            $result = $db->query('SELECT user_id, ident FROM '.$db->prefix.'online WHERE in_chat_room ORDER BY ident', true) or error('Unable to fetch chatters online list', __FILE__, __LINE__, $db->error());
            
            while ($pun_user_online = $db->fetch_assoc($result))
            {
                if ($pun_user_online['user_id'] > 1)
                    $chatusers[] = "\n\t\t\t\t".'<a href="profile.php?id='.$pun_user_online['user_id'].'">'.pun_htmlspecialchars($pun_user_online['ident']).'</a><br />';
            }
                    
            $num_users = count($users);
            $online[] = "\t\t\t\t".$lang_index['Users online'].': <strong>'.$num_users.'</strong><br />'."\n\t\t\t\t".$lang_index['Guests online'].': <strong>'.$num_guests.'</strong>'."\n\t\t\t"."\n";
            $num_chatusers = count($chatusers);
            
            if ($num_users > 0 && $num_users < 10)
                $online[] = "\t\t\t"."\n\t\t\t\t".'<br /><br /><strong>'.$lang_index['Online'].': </strong>'."\t\t\t\t".implode($users)."\n";
            else
                $online[] = "\t\t\t".'<div class="clearer"></div>'."\n";
            
            if ($num_chatusers > 0)
                $chatonline[] = "\t\t\t"."\n\t\t\t\t".'<br /><br /><strong>'.$lang_index['ChatOnline'].': </strong>'."\t\t\t\t".implode($chatusers)."\n";    
                            
  }
      
        
         return 'Welcome <strong>'.$pun_user['username'].'</strong><br />
            <a href="login.php?action=out&id='.$pun_user['id'].'">'.$lang_common['Logout'].'</a><br /><br />
            '.implode($online,'').'<br />
            '.implode($chatonline,'').'<br />
            Users: <strong>'. $stats['total_users'].'</strong><br />
            Topics: <strong>'.$stats['total_topics'].'</strong><br />
            Posts: <strong>'.$stats['total_posts'].'</strong><br />';
          /*'Welcome <strong>'.$pun_user['username'].'</strong><br />
            <a href="login.php?action=out&id='.$pun_user['id'].'">'.$lang_common['Logout'].'</a><br /><br />
            'echo $onlineoutput<br />
            /*'echo $chatonlineoutput<br />
            Users: <strong>'. $stats['total_users'].'</strong><br />
            Topics: <strong>'.$stats['total_topics'].'</strong><br />
            Posts: <strong>'.$stats['total_posts'].'</strong><br />';*/
    }
}

Here is the other function:

//
// Generate the generate_whosonline() output content
//
function output_whosonline()
{
    echo generate_whosonline();
}

589

(12 replies, posted in Programming)

Well, it does not work right. It does not update immediately. When I login, my name does not appear there immediately. I know though, that echo would do it immediately. That is why I tried it that way.

590

(12 replies, posted in Programming)

Ok, I pretty much got that working now.
I created a new function that echos the generate_whosonline function. And now I call the output function from the header.php file. The problem is though, that the output happens at the top of the page, not where it is planned - in the box in the sidebar.

591

(12 replies, posted in Programming)

Oops, that would kinda be a problem, since I somehow have to put that in header.php in the following substitution:

$tpl_main = str_replace('<pun_online>','<div class="inbox">'."\n\t\t\t". generate_whosonline()."\n\t\t".'</div>', $tpl_main);

generate_whosonline() is the function

592

(12 replies, posted in Programming)

Hey that is a sweet idea. Do I have to do that wherever the function is called?

593

(12 replies, posted in Programming)

The following is my problem:

return 'Welcome <strong>'.$pun_user['username'].'</strong><br />
            <a href="login.php?action=out&id='.$pun_user['id'].'">'.$lang_common['Logout'].'</a><br /><br />
            '.implode($online,'').'<br />
            '.implode($chatonline,'').'<br />
            Users: <strong>'. $stats['total_users'].'</strong><br />
            Topics: <strong>'.$stats['total_topics'].'</strong><br />
            Posts: <strong>'.$stats['total_posts'].'</strong><br />';

I want the implode statements somehow expressed with echo (still with implode, though), because this data does not update immediately and with echo it does. I have been playing around with it a lot, but I could not figure out the right syntax.
*bloody beginner*

594

(12 replies, posted in Programming)

Could you say that in easy English again, please? wink

595

(12 replies, posted in Programming)

Problem:
How can I use echo inside a return command?
I would highly appreciate fast help. Thanks a lot!

I figured it out. Now there is just one part left.
How can I use the echo-command in the function generate_whosonline()? I need it at the end inside the return-command (I guess, I have to throw that away, but it still does not really work because it says

unexpected T_STRING

or something like that.

I just need some quick answer really fast: Where the chat file can I add a statement for the moment when a user leaves the chatroom?
I would appreciate help.
I need it pretty fast and I just need the place - the code is already done.
Thanks a lot.

598

(7 replies, posted in PunBB 1.2 troubleshooting)

Found it!!!

I just added an extra line to the install_mod file. He just had not included the line to add the column. Well, now it works. Thanks a lot.

599

(7 replies, posted in PunBB 1.2 troubleshooting)

Wow, I just did restore and it said:
"Unable to delete forumgroups => g_post_polls ; please remove manually"
So, it is really this mistake.
Let's see, I'll try to install it again, now.

600

(7 replies, posted in PunBB 1.2 troubleshooting)

File: <mysite>/forum/install_mod.php
Line: 25

PunBB reported: Impossible d'ajouter les champs nécessaires à la table 

Database reported: Duplicate column name 'question' (Errno: 1060) 

Failed query: ALTER TABLE forumtopics ADD `question` VARCHAR(255) NOT NULL, ADD `yes` VARCHAR(30) NOT NULL, ADD `no` VARCHAR(30) NOT NULL

Do you want me to restore first?