///////////////////////////////////////////////////////////
// Channel List v1.0 by venox[xL]. (c) Kevin Stacey 2004 //
///////////////////////////////////////////////////////////
/* ------------------------------------------------------//
This script works directly with FyreChat 2.0.75 or later.//
It uploads a list of users in the channel, once every 60 //
seconds by default. //
The file that is uploaded is channel_list.txt //
Below are a set of variables that you need to edit to //
match your site/server's settings. //
-------------------------------------------------------- */
///////////////////////////////////////////////////////////
// //
// Please edit the variable values below //
// //
///////////////////////////////////////////////////////////
// ----------------- Server Settings --------------------//
// This is the server path to your log file
$config['logfile'] = "/var/www/fyrechat.openfyre.net/weblog/channel_list.txt";
// This is the url to your icon's directory, do not add a trailing slash
$config['iconurl'] = "https://fyrechat.openfyre.net/weblog/icons";
// ----------------- Channel Settings --------------------//
// Channel Name
$config['channel'] = "Op FyreChat";
// Battle.Net Server
$config['server'] = "useast.battle.net";
// Channel Bot's Name
$config['botname'] = "FyreChat";
// How often the channel updates, in seconds (default 60)
$config['seconds'] = "60";
// ----------------- Style Settings --------------------//
// Table width, pixels or % Example: 450 or 100%
$config['tablewidth'] = "451";
// Table Border
$config['border'] = "0";
// Table cellspacing
$config['cellspacing'] = "1";
// Table cellpadding
$config['cellpadding'] = "3";
// Row 1 Background Color
$config['row1bg'] = "#545454";
// Row 1 Border Color
$config['row1border'] = "#6F6F6F";
// Row 1 Text Color
$config['row1text'] = "#FFF8DC";
// Row 1 Background Color
$config['row2bg'] = "#000000";
// Row 1 Border Color
$config['row2border'] = "#6F6F6F";
// Row 1 Text Color
$config['row2text'] = "#FFFFFF";
// Table Header Text Color
$config['alttc'] = "#FFFFFF";
///////////////////////////////////////////////////////////
// //
// Do not edit below this line. //
// //
///////////////////////////////////////////////////////////
extract($config);
?>
function datediff($firstdate, $seconddate = 0, $numunits = 5, $delimiters = array()) {
$defaults = array(
"second" => "s",
"seconds" => "s",
"minute" => "m",
"minutes" => "m",
"hour" => "h",
"hours" => "h",
"day" => "d",
"days" => "d",
"week" => "w",
"weeks" => "w",
"year" => "y",
"years" => "y",
"separator" => " ",
"suffix" => "ago",
);
$delimiters = array_merge($defaults, $delimiters);
$difference = abs($firstdate - $seconddate);
$years = floor(($difference / 86400) / 365);
$weeks = ($difference / 604800) % 55;
$days = ($difference / 86400) % 7;
$hours = ($difference / 3600) % 24;
$mins = ($difference / 60) % 60;
$secs = ($difference % 60);
$units = array();
if ($years > 0)
$units[] = $years . $delimiters[($years == 1) ? "year" : "years"];
if ($weeks > 0)
$units[] = $weeks . $delimiters[($weeks == 1) ? "week" : "weeks"];
if ($days > 0)
$units[] = $days . $delimiters[($days == 1) ? "day" : "days"];
if ($hours > 0)
$units[] = $hours . $delimiters[($hours == 1) ? "hour" : "hours"];
if ($mins > 0)
$units[] = $mins . $delimiters[($mins == 1) ? "minute" : "minutes"];
if ($secs > 0 || !count($units))
$units[] = $secs . $delimiters[($secs == 1) ? "second" : "seconds"];
if (count($units) > $numunits)
$units = array_slice($units, 0, $numunits);
$units[] = $delimiters["suffix"];
return join($delimiters["separator"], $units);
}
// Get the time the file was last uploaded
$lastupdated = filemtime($logfile);
$lastupdated = datediff($lastupdated, mktime());
// Open the channel_list.txt file, with supression
$lines = @file($logfile);
$numusers = count($lines);
?>
Channel: @ |
| Total Users: - Last Updated: |
| Game |
Username |
Ping |
$gameclient = array("BLIZZ" => "Blizzard Representative",
"SYSOP" => "System Operator",
"OP" => "Channel Operator",
"SPKR" => "Speaker",
"GLASSES" => "Glasses",
"SQUELCH" => "Squelched",
"GFOFFICIAL" => "GF Official",
"GFPLAYER" => "GF Player",
"CHAT" => "Chat User",
"DRTL" => "Diablo",
"STAR" => "StarCraft",
"DSHR" => "Diablo Shareware",
"SSHR" => "StarCraft Shareware",
"SEXP" => "StarCraft Brood War",
"JSTR" => "StarCraft Japan",
"D2DV" => "Diablo II",
"W2BN" => "Warcraft II Battle.net Edition",
"D2XP" => "Diablo II Lord of Destruction",
"WAR3" => "Warcraft III",
"W3XP" => "Warcraft III The Frozen Throne",
);
// Loop through lines in the file
foreach ($lines as $line_num => $line) {
$icon_start = strPos($line, "[ICON]");
$icon_end = strPos($line, "[/ICON]");
$icon = trim(substr($line, $icon_start, ($icon_end - $icon_start)));
$icon = str_replace("[ICON]", "", $icon);
$icon = '
';
$user_start = strPos($line, "[USER]");
$user_end = strPos($line, "[/USER]");
$luser = trim(substr($line, $user_start, ($user_end - $user_start)));
$luser = str_replace("[USER]", "", $luser);
$ping_start = strPos($line, "[PING]");
$ping_end = strPos($line, "[/PING]");
$ping = trim(substr($line, $ping_start, ($ping_end - $ping_start)));
$ping = str_replace("[PING]", "", $ping);
$realping = $ping . "ms";
if($ping == 'PLUG') {
$ping = 'PLUG';
$realping = 'UDP Plug';
}
elseif($ping == 0) {
$ping = '0';
}
elseif($ping == -1) {
$ping = '1b';
}
elseif($ping < 200) {
$ping = '1g';
}
elseif($ping < 300) {
$ping = '2g';
}
elseif($ping < 400) {
$ping = '3y';
}
elseif($ping < 500) {
$ping = '4y';
}
elseif($ping < 600) {
$ping = '5r';
}
else {
$ping = '6r';
}
$ping = '
';
?>
|
|
|
}
$html = implode('', file($logfile));
?>
| *Note: Channel list is uploaded every seconds from |