");
print("Recent news");
if (get_user_class() >= UC_ADMINISTRATOR)
print(" - [News page]");
print("\n");
$res = mysql_query("SELECT * FROM news WHERE ADDDATE(added, INTERVAL 45 DAY) > NOW() ORDER BY added DESC LIMIT 10") or sqlerr(__FILE__, __LINE__);
if (mysql_num_rows($res) > 0)
{
print("\n");
while($array = mysql_fetch_array($res))
{
print("- " . gmdate("Y-m-d",strtotime($array['added'])) . " - " . $array['body']);
if (get_user_class() >= UC_ADMINISTRATOR)
{
print(" [E]");
print(" [D]");
}
print("
");
}
print(" | \n");
}
/*
Active users
*/ ?>
if ($CURUSER)
{
// Get current poll
$res = mysql_query("SELECT * FROM polls ORDER BY added DESC LIMIT 1") or sqlerr();
$arr = mysql_fetch_assoc($res);
$pollid = $arr["id"];
$userid = $CURUSER["id"];
$question = $arr["question"];
$o = array($arr["option0"], $arr["option1"], $arr["option2"], $arr["option3"], $arr["option4"],
$arr["option5"], $arr["option6"], $arr["option7"], $arr["option8"], $arr["option9"],
$arr["option10"], $arr["option11"], $arr["option12"], $arr["option13"], $arr["option14"],
$arr["option15"], $arr["option16"], $arr["option17"], $arr["option18"], $arr["option19"]);
// Check if user has already voted
$res = mysql_query("SELECT * FROM pollanswers WHERE pollid=$pollid && userid=$userid") or sqlerr();
$arr2 = mysql_fetch_assoc($res);
print("Poll");
if (get_user_class() >= UC_MODERATOR)
{
print("");
print(" - [New]\n");
print(" - [Edit]\n");
print(" - [Delete]");
print("");
}
print("\n");
print("\n");
print("| ");
print(" $question \n");
$voted = $arr2;
if ($voted)
{
// display results
if ($arr["selection"])
$uservote = $arr["selection"];
else
$uservote = -1;
// we reserve 255 for blank vote.
$res = mysql_query("SELECT selection FROM pollanswers WHERE pollid=$pollid AND selection < 20") or sqlerr();
$tvotes = mysql_num_rows($res);
$vs = array(); // array of
$os = array();
// Count votes
while ($arr2 = mysql_fetch_row($res))
$vs[$arr2[0]] += 1;
reset($o);
for ($i = 0; $i < count($o); ++$i)
if ($o[$i])
$os[$i] = array($vs[$i], $o[$i]);
function srt($a,$b)
{
if ($a[0] > $b[0]) return -1;
if ($a[0] < $b[0]) return 1;
return 0;
}
// now os is an array like this: array(array(123, "Option 1"), array(45, "Option 2"))
if ($arr["sort"] == "yes")
usort($os, srt);
print("\n");
$i = 0;
while ($a = $os[$i])
{
if ($i == $uservote)
$a[1] .= " *";
if ($tvotes == 0)
$p = 0;
else
$p = round($a[0] / $tvotes * 100);
if ($i % 2)
$c = "";
else
$c = " bgcolor=#ECE9D8";
print("| " . $a[1] . " | " .
"  $p% | \n");
++$i;
}
print(" \n");
$tvotes = number_format($tvotes);
print("Votes: $tvotes \n");
}
else
{
print(" |
if ($voted)
print("Previous polls \n");
?>
|
}
function sortusers($a, $b)
{
$score_a = trim(substr($a, 4, 5));
$score_b = trim(substr($b, 4, 5));
if ($score_a > $score_b)
return -1;
elseif ($score_a < $score_b)
return 1;
else
return 0;
}
function getgametype($gametype)
{
switch ($gametype)
{
case "bel": $gametype = "Behind Enemy Lines"; break;
case "dm": $gametype = "Deathmatch"; break;
case "hq": $gametype = "Headquarters"; break;
case "re": $gametype = "Retreival"; break;
case "sd": $gametype = "Search and Destroy"; break;
case "tdm": $gametype = "Team Deathmatch"; break;
}
return $gametype;
}
function getmapname($mapname)
{
switch ($mapname)
{
case "mp_bocage": $mapname = "Bocage"; break;
case "mp_brecourt": $mapname = "Brecourt"; break;
case "mp_carentan": $mapname = "Carentan"; break;
case "mp_chateau": $mapname = "Chateau"; break;
case "mp_dawnville": $mapname = "Dawnville"; break;
case "mp_depot": $mapname = "Depot"; break;
case "mp_harbor": $mapname = "Harbor"; break;
case "mp_hurtgen": $mapname = "Hurtgen"; break;
case "mp_neuville": $mapname = "Neuville"; break;
case "mp_pavlov": $mapname = "Pavlov"; break;
case "mp_powcamp": $mapname = "POW-Camp"; break;
case "mp_railyard": $mapname = "Railyard"; break;
case "mp_rocket": $mapname = "Rocket"; break;
case "mp_ship": $mapname = "Ship"; break;
case "mp_stalingrad": $mapname = "Stalingrad"; break;
case "evreux": $mapname = "Evreux"; break;
case "mittenwald": $mapname = "Mittenwald"; break;
case "mp_centerville": $mapname = "Centerville"; break;
}
return $mapname;
}
function updateserverinfo($host, $port, $rcon)
{
$secs = 5;
$mtime = @filemtime(".cod-$host.cache");
if (gmtime() - $secs < $mtime)
return;
$lfd = @fopen(".cod-$host.lock", "w+");
if (!$lfd) return;
if (!flock($lfd, LOCK_EX | LOCK_NB)) return;
$sd = fsockopen("udp://$host", $port);
socket_set_timeout($sd, 1);
fwrite($sd, "\xFF\xFF\xFF\xFFgetstatus");
$s = fread($sd, 8192);
if ($s == "")
$output .= "----- Server is offline ----- \n";
else
{
if (preg_match("/\\\\g_gametype\\\\(.+?)\\\\/", $s, $matches) > 0)
$gametype = $matches[1];
if (preg_match("/\\\\mapname\\\\(.+?)\\\\/", $s, $matches) > 0)
$mapname = $matches[1];
if (preg_match("/\\\\sv_maxclients\\\\([0-9]+)/", $s, $matches) > 0)
$maxclients = $matches[1];
$gametype = getgametype($gametype);
$mapname = getmapname($mapname);
$output .= "IP: $host - Port: $port - \n";
$output .= "Game type: $gametype - Map: $mapname\n";
fwrite($sd, "\xFF\xFF\xFF\xFFrcon $rcon status");
$s .= fread($sd, 1500);
if ($s == "")
{
flock($lfd, LOCK_UN);
return;
}
else
$s .= substr(fread($sd, 1500), 10);
$orig = $s;
$x = fopen(".output", "w+");
fwrite($x,$orig);
fclose($x);
$n = 0;
$s = rtrim(substr($s, strpos($s, "-----\n") + 6));
$players = explode("\n", $s);
if ($players[0] != "")
{
usort($players, "sortusers");
for ($i = 0; $i < count($players); ++$i)
{
// extract num, score, ping, guid
$s = trim($players[$i]);
$ns = strpos($s, " ");
$num = substr($s, 0, $ns);
$s = ltrim(substr($s, $ns));
$ns = strpos($s, " ");
$score = substr($s, 0, $ns);
$s = ltrim(substr($s, $ns));
$ns = strpos($s, " ");
$ping = substr($s, 0, $ns);
if ($ping == "999" || $ping == "CNCT") $ping = "---";
$s = ltrim(substr($s, $ns));
$ns = strpos($s, " ");
$s = ltrim(substr($s, $ns));
// extract ip
$ns = strrpos($s, " ");
$s = rtrim(substr($s, 0, $ns));
$ns = strrpos($s, " ");
$s = rtrim(substr($s, 0, $ns));
$ns = strrpos($s, " ");
$ip = substr($s, $ns + 1);
$ip = substr($ip, 0, strpos($ip, ":"));
$s = rtrim(substr($s, 0, $ns));
$ns = strrpos($s, " ");
$s = rtrim(substr($s, 0, $ns));
// extract player name
$player = $s;
// strip color codes
$player = preg_replace("/(\^[0-9])/", "", $s);
if ($player == "")
continue;
$r = mysql_query("SELECT id,username FROM users WHERE username=" . sqlesc($player) . " AND ip='$ip' AND enabled = 'yes'") or sqlerr();
if (mysql_num_rows($r) != 1)
{
$tfd = fopen(".cod-$host.log", "a");
fwrite($tfd, "[$num] [$player] [$ip]\n$orig\n\n");
fclose($tfd);
usleep(500000);
fwrite($sd, "\xFF\xFF\xFF\xFFrcon $rcon clientkick $num");
flock($lfd, LOCK_UN);
fclose($lfd);
return;
}
$a = mysql_fetch_assoc($r);
$player = htmlspecialchars($a["username"]);
if ($n == 0)
{
$output .= "\n";
$output .= "| # | Player | Score | Ping | \n";
}
++$n;
$output .= "| $n | $player | $score | $ping | \n";
}
if ($n > 0) $output .= " ";
}
if ($n == 0)
$output .= "----- No players ----- \n";
}
$fd = @fopen(".cod-$host.cache", "w");
if ($fd)
{
fwrite($fd, $output);
fclose($fd);
}
flock($lfd, LOCK_UN);
fclose($lfd);
}
function printserverinfo($host, $port, $rcon)
{
updateserverinfo($host, $port, $rcon);
readfile(".cod-$host.cache");
}
?>
Call of Duty
print("Use your TorrentBits Username to gain access to this server! \n");
printserverinfo("62.212.84.221", 28960, $rconpassword);
print("Please install this patch and these maps before joing! ");
?>
|
Stats
| Registered users | =$registered?> |
| Torrents | =$torrents?> |
if (isset($peers)) { ?>
| Peers | =$peers?> |
| Seeders | =$seeders?> |
| Leechers | =$leechers?> |
| Seeder/leecher ratio (%) | =$ratio?> |
} ?>
|
/*
Server load
$percent = min(100, round(exec('ps ax | grep -c apache') / 256 * 100));
if ($percent <= 70) $pic = "loadbargreen.gif";
elseif ($percent <= 90) $pic = "loadbaryellow.gif";
else $pic = "loadbarred.gif";
$width = $percent * 4;
print(" "); ?>
|
|
*/ ?>
Disclaimer: None of the files shown here are actually hosted on this server. The links are provided solely by this site's users.
The administrator of this site (www.torrentbits.org) cannot be held responsible for what its users post, or any other actions of its users.
You may not use this site to distribute or download any material when you do not have the legal rights to do so.
It is your own responsibility to adhere to these terms.
|