Fork me on GitHub

Need help to pass userid to ChatEverywhere java-clientapplet  Bottom

  • Hi,
    I have installed ChatEverywhere from http://freshmeat.net…rver-0.0.17a.tar.gz

    The server install works as well as the standalone client from http://aleron.dl.sou…java-0.0.17a.tar.gz

    The code of the client PHP is:

    Code

    ?php

        $chat_cookie_prefix = "CHAT_";
        $chat_cookie_expires = "0"; // delete when browser is closed

        // get nick from cookie or, preferably, via GET
        if(!$nick = $HTTP_GET_VARS["nick"]) $nick = $HTTP_COOKIE_VARS[$chat_cookie_prefix."NICK"];
            else setcookie($chat_cookie_prefix."NICK","$nick",$chat_cookie_expires);

        // if no nick given...
        if(!$nick)
            {
            // ...then show the form.
            echo("<form action=\"".basename($HTTP_SERVER_VARS['SCRIPT_NAME'])."\" method=\"GET\">\n");
            echo(" <input name=\"nick\"/>\n");
            echo(" <input type=\"submit\" value=\"Enter\"/>\n");
            echo("</form>\n");
            }
        // else,
        else
            {
            // return HTML code that will run the applet.
            echo("<applet archive=\"ChatEverywhere.jar\" code=\"Chat.class\" width=\"600\" height=\"400\">");
            echo(" <param name=\"Nick\" value=\"${CHAT_NICK}\"/>");
            echo(" <param name=\"ServerPort\" value=\"5656\"/>");
            echo("</applet>");
            }

    ?>


    The help is how can I pass on a logged in PN userid to the 'Nick'? Please advise. Thanks.
  • pnCopilot is an already integrated IRC java applet. Available at pnaddons.com
  • Thanks but I wish to use this specific java applet instead. The server is not based on IRC and easier to manage.
  • The function to get the currently logged in uid is:

    Code

    pnUserGetVar('uid');


    I don't know what this returns if the current user is not logged in, probably just the annonymous uid, so you may want to do this:

    Code

    if(pnUserLoggedIn()){
       //User is logged in so do something...
       $uid = pnUserGetVar('uid');
    }else{
       //User is NOT logged in so do nothing....
    }

    Hope this helps.

This list is based on users active over the last 60 minutes.