Fork me on GitHub

room_is is undefined, please check this one  Bottom

  • Hi:

    This is the code for a 123_Flash_Chat block. Only problem is rooms data (conections are not show). Browser shows an 'room_id is undefined' error at bottom of page.

    The other part of the code work fine.
    The code is:

    Quote

    define("_CHAT_TITLE","123 Flash Chat Server Module for PHP-Nuke");
    define("_CHAT_NOW","Chat Now");
    define("_CHAT_USERLIST","Chatting users: ");
    define("_CHAT_NONE_USER","None");
    define("_CHAT_THEREARE","There are");
    define("_CHAT_CONNECTIONS","users connected to the chat server");
    define("_CHAT_ROOMS","Chat Rooms");
    define("_CHAT_LOGON_USERS","Logon chatters");

    $ModName = "Chat";

    include "modules/$ModName/config.php";


    $content = "";
    $userListStr = "";

    $room = array();


    $online_file = $chat_data_path."online.txt";

    if (!file_exists($online_file))
    {
    echo "Can't find $online_file";

    }
    else if (!$trow = file($online_file))
    {
    echo "Read $online_file error";

    }
    else
    {
    $room_data = explode("|", $trow[0]);


    if (count($room_data) == 3)
    {
    $room['connections'] = intval($room_data[0]);
    $room['logon_users'] = intval($room_data[1]);
    $room['room_numbers'] = intval($room_data[2]);
    }

    $d = dir($chat_data_path);

    while (false !== ($entry = $d->read()))
    {
    $rest = substr($entry, 0, 5);
    if ($rest == "room_")
    {

    if (file_exists($chat_data_path.$entry))
    {

    $f_users = file($chat_data_path.$entry);

    for ($i = 0; $i < count($f_users); $i ++)
    {
    $f_line = trim($f_users[$i]);

    if ($f_line != "")
    {
    $userListStr = ($userListStr == "") ? $f_line : $userListStr. ", " . $f_line;
    }
    }

    }
    }

    }
    $d->close();

    $userListStr = ($userListStr == "") ? _CHAT_NONE_USER : $userListStr;

    }

    $c_connections = $room['connections'];
    $c_rooms = $room['room_numbers'];
    $c_logon_users = $room['logon_users'];


    $content = " \n";

    $content .= _CHAT_THEREARE . " " . $c_connections . " "._CHAT_CONNECTIONS;
    $content .= "

    ". _CHAT_THEREARE . " " . $c_rooms. " ". _CHAT_ROOMS;
    $content .= "

    ". _CHAT_THEREARE . " " . $c_logon_users . " "._CHAT_LOGON_USERS;
    $content .= "

    ". _CHAT_USERLIST . " " . $userListStr . "";
    $content .= "

    You can open the chat by clicking here";

    echo $content;

    echo "

    ";
    print <<<eot language="Javascript" type="text/javascript">




      EOT;
    </eot>


    TIA
    :?:
  • Hi:

    Nevermind problem was this line:

    echo "

    ";

    Correct functions file is functions_phpnuke.php. Now it works.

    Later

    :)

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