|
|||
|
Hi:
I get online user data with this php code: Code:
///CHAT BLOCK///
define("_CHAT_USERLIST","Personas en el video-chat: ");
define("_CHAT_NONE_USER","Nadie");
define("_CHAT_THEREARE","Hay...");
define("_CHAT_CONNECTIONS","personas conectadas al chat server");
define("_CHAT_ROOMS","Salas");
define("_CHAT_LOGON_USERS","Logeados");
$chat_data_path="/usr/local/123flashchat/data/default/";
$content = "";
$userListStr = "";
$room_id = "";
$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 .= _CHAT_THEREARE . " <b>" . $c_connections . "</b> "._CHAT_CONNECTIONS;
$content .= "<br><br>". _CHAT_THEREARE . " <b>" . $c_rooms. "</b> ". _CHAT_ROOMS;
$content .= "<br><br>". _CHAT_THEREARE . " <b>" . $c_logon_users . "</b> "._CHAT_LOGON_USERS;
$content .= "<br><br>". _CHAT_USERLIST . " <b>" . $userListStr . "</b>";
$chateoactivo = $content;
bill david julie jose maria TheCat My question is how I can specify some names to be excluded from getting listed. For example if maria and TheCat are chat moderators, I dont want to show them as connected... Maybe a while $f_user != bla bla bla could work but I need the code!!! that will do the trick! I hope what I want in understood. I use Linux, PHP 5.2.5 and Apache 2. TIA Latino ![]() |
|
|||
|
You could define an array in php and put the names that you want to be excluded from showing in it.
Then just make a judgement at $userListStr = ($userListStr == "") ? _CHAT_NONE_USER : $userListStr; when you generate userlist here. |
![]() |
Was this information helpful? Yes No
| Thread Tools | |
| Display Modes | |
|
|