PHP Code:
<?php
/*
*-------------------------------phpMyBitTorrent--------------------------------*
*--- The Ultimate BitTorrent Tracker and BMS (Bittorrent Management System) ---*
*-------------- Created By Antonio Anzivino (aka DJ Echelon) --------------*
*------------- http://www.p2pmania.it -------------*
*------------ Based on the Bit Torrent Protocol made by Bram Cohen ------------*
*------------- http://www.bittorrent.com -------------*
*------------------------------------------------------------------------------*
*------------------------------------------------------------------------------*
*-- This program is free software; you can redistribute it and/or modify --*
*-- it under the terms of the GNU General Public License as published by --*
*-- the Free Software Foundation; either version 2 of the License, or --*
*-- (at your option) any later version. --*
*-- --*
*-- This program is distributed in the hope that it will be useful, --*
*-- but WITHOUT ANY WARRANTY; without even the implied warranty of --*
*-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --*
*-- GNU General Public License for more details. --*
*-- --*
*-- You should have received a copy of the GNU General Public License --*
*-- along with this program; if not, write to the Free Software --*
*-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA --*
*-- --*
*------------------------------------------------------------------------------*
*------ 2005 phpMyBitTorrent Development Team ------*
*----------- http://phpmybittorrent.com -----------*
*------------------------------------------------------------------------------*
*/
include("header.php");
////////////////////////////MOD ARCADE/////////////////////
function get_date_time($timestamp = 0)
{
if ($timestamp)
return date("Y-m-d H:i:s", $timestamp);
else
$idcookie = $_COOKIE['uid'];
return gmdate("Y-m-d H:i:s", time());
}
$player = getuserid($btuser);
if($_GET["act"]=="Arcade")
{
if($_POST['gname'] == "asteroids")
{
$game = 1;
$level = 1;
$score = $_POST['score'];
}
if($_POST['gname'] == "breakout")
{
$game = 2;
$level = 1;
$score = $_POST['gscore'];
}
if($_POST['gname'] == "hexxagon")
{
$game = 3;
$level = 1;
$score = $_POST['gscore'];
}
if($_POST['gname'] == "invaders")
{
$game = 4;
$level = 1;
$score = $_POST['score'];
}
if($_POST['gname'] == "moonlander")
{
$game = 5;
$level = 1;
$score = $_POST['gscore'];
}
if($_POST['gname'] == "pacman")
{
$game = 6;
$level = 1;
$score = $_POST['gscore'];
}
if($_POST['gname'] == "psol")
{
$game = 7;
$level = 1;
$score = $_POST['gscore'];
}
if($_POST['gname'] == "simon")
{
$game = 8;
$level = 1;
$score = $_POST['gscore'];
}
if($_POST['gname'] == "snake")
{
$game = 9;
if($_POST['levelName'] == "LEVEL: SLUG")
{
$level = 1;
}
if($_POST['levelName'] == "LEVEL: WORM")
{
$level = 2;
}
if($_POST['levelName'] == "LEVEL: PYTHON")
{
$level = 3;
}
$score = $_POST['score'];
}
if($_POST['gname'] == "tetris")
{
$game = 10;
$level = $_POST['level'];
$score = $_POST['gscore'];
}
mysql_query("INSERT INTO `".$db_prefix."_flashscores` ( `ID` , `game` , `user` , `level` , `score`, `date`) VALUES ( '', '".$game."', '".$player."', '".$level."', '".$score."', '" . get_date_time() . "');") OR DIE(MySQL_ERROR());
$urlc="flashscores.php";
print("<html><head><meta http-equiv=refresh content='0;url=$urlc'></head>\n");
die;
}
include('actb.php');
echo <<<EOF
<script type="text/javascript" language="JavaScript">
function advanced() {
var obj;
var obj2;
obj = document.getElementById("users_simple");
obj.className = 'hide';
obj2 = document.getElementById("users_advanced");
obj2.className = 'show';
}
function simple() {
var obj;
var obj2;
obj2 = document.getElementById("users_advanced");
obj2.className = 'hide';
obj = document.getElementById("users_simple");
obj.className = 'show';
}
</script>
EOF;
if ($has_newpm) {
OpenTable2(_btpm);
echo "<h3>"._btyougotpm."</h3>";
CloseTable2();
}
if ($welcome_message != ""){
OpenTable(_btsitenews);
echo "<table><tr><td>$welcome_message</td></tr></table>";
CloseTable();
}
OpenTable(pic("icon_mini_search.gif")._btsearch);
echo "<form method=\"get\" action=\"search.php\">";
echo "<br>\n";
echo "<table align=\"center\" border=\"0\" cellspacing=\"1\" cellpadding=\"1\">";
echo "<tr><td></td><td><input id=\"actb_textbox\" type=\"text\" name=\"search\" value=\"".searchfield($search)."\" size=\"25\"> ";
echo "<td>";
echo <<<EOF
<SCRIPT>
actb(document.getElementById("actb_textbox"),customarray);
</SCRIPT>
EOF;
echo " <select name=\"cat\">";
echo "<option value=\"0\">"._btalltypes."</option>";
foreach (catlist() as $category) {
echo "<option value=\"".$category["id"]."\" ";
if ($cat == $category["id"]) echo "selected";
echo " >".$category["name"]."</option>";
}
echo "</select>";
echo "</td>";
echo "<td><input type=\"submit\" value=\""._btgo."\"";
echo "</td></tr></table>";
echo "<table align=\"center\" border=\"0\" cellspacing=\"1\" cellpadding=\"1\"><tr><td><p>"._btresfor."</p></td><td> <select name=\"orderby\">\n";
$orders = Array(_btinsdate,_btseeders,_btleechers,_bttotsorc,_btdownloaded,_btvote,_btname,_btdim,_btnfile,);
$i = 0;
foreach ($orders as $order) {
echo "<option value=\"".$i."\" ";
if ($orderby == $i) echo "selected";
echo ">".$order."</option>\n";
$i++;
}
echo "</select></td>\n";
echo "<td><select name=\"ordertype\">".
"<option value=\"DESC\" ";
if ($ordertype == "DESC") echo "selected";
echo " >"._btdesc."</option>".
"<option value=\"ASC\" ";
if ($ordertype == "ASC") echo "selected";
echo " >"._btord."</option>".
"</select></td>";
echo "<td><p><input type=\"checkbox\" name=\"incldead\" ";
if ($incldead == "true") echo "checked";
echo " value=\"true\">"._btitm."";
echo "</td></tr></table>";
echo "</form>";
CloseTable();
#OBT: Add joe's table-head sorting function:
$sort = $_GET["sort"];
$type = $_GET["type"];
$orderby = " ORDER BY ".$db_prefix."_torrents.evidence DESC, ";//
if ($sort == 1) $orderby = " ORDER BY ".$db_prefix."_torrents.name $type, ";//
if ($sort == 2){
$orderby = " ORDER BY ".$db_prefix."_torrents.numfiles $type, ";//
}
if ($sort == 3){
$orderby = " ORDER BY ".$db_prefix."_torrents.comments $type, ";//
}
if ($sort == 4){
$orderby = " ORDER BY ".$db_prefix."_torrents.category $type, ";//
}
if ($sort == 5){
$orderby = " ORDER BY ".$db_prefix."_torrents.size $type, ";
}
if ($sort == 6){
$orderby = " ORDER BY ".$db_prefix."_torrents.times_completed $type, ";
}
if ($sort == 7){
$orderby = " ORDER BY ".$db_prefix."_torrents.seeders $type, ";//
}
if ($sort == 8){
$orderby = " ORDER BY ".$db_prefix."_torrents.leechers $type, ";//
}
if ($onlysearch) {
OpenTable(_btnosearchttl);
echo _btnosearch;
CloseTable();
} else {
if (!isset($page) OR !is_numeric($page) OR $page < 1) $page = 1;
if (!isset($cat)) $cat = "";
if (intval($cat) > 0) $catwhere = " AND ".$db_prefix."_torrents.category = ".intval($cat);
else $catwhere = "";
$passwhere = " AND ".$db_prefix."_torrents.password IS NULL ";
$viswhere = "visible = 'yes' AND banned = 'no'";
if ($user->moderator) $viswhere = "1";
if ($user->premium) $passwhere = "";
$from = ($page - 1) * $torrent_per_page;
$totsql = "SELECT COUNT(*) as tot FROM ".$db_prefix."_torrents WHERE ".$viswhere.$catwhere.$passwhere.";";
$sql = "SELECT ".$db_prefix."_torrents.*, IF(".$db_prefix."_torrents.numratings < '".$minvotes."', NULL, ROUND(".$db_prefix."_torrents.ratingsum / ".$db_prefix."_torrents.numratings, 1)) AS rating, ".$db_prefix."_categories.name AS cat_name, ".$db_prefix."_categories.image AS cat_pic, U.username, IF(U.name IS NULL, U.username, U.name) as user_name, U.level as user_level FROM ".$db_prefix."_torrents LEFT JOIN ".$db_prefix."_categories ON category = ".$db_prefix."_categories.id LEFT JOIN ".$db_prefix."_users U ON ".$db_prefix."_torrents.owner = U.id WHERE ".$viswhere.$catwhere.$passwhere.$orderby.$db_prefix."_torrents.added DESC LIMIT ".$from.",".$torrent_per_page.";";
$res = $db->sql_query($sql) or btsqlerror($sql);
$totres = $db->sql_query($totsql);
if (isset($sort))$sort1= "&sort=".$sort."&type=".$type;
else
$sort1="";
if (isset($sort))$sort2= "?sort=".$sort."&type=".$type;
else
$sort2="";
list ($tot) = $db->sql_fetchrow($totres);
$db->sql_freeresult($totres);
if ($db->sql_numrows($res) > 0) {
$pages = ceil($tot / $torrent_per_page);
if($page < $pages & $cat) {
$next = "<b><a href=\"index.php?page=".($page+1)."&cat=".$cat."\">>>>></a></b>";
} elseif($page < $pages ) {
$next = "<b><a href=\"index.php?page=".($page+1).$sort1."\">>>>></a></b>";
}else{
$next = ">>>>";
}
if($page > 1 & $cat) {
$prev = "<b><a href=\"index.php?page=".($page-1)."&cat=".$cat."\"><<<<</a></b>";
} elseif($page > 1) {
$prev = "<b><a href=\"index.php?page=".($page-1).$sort1."\"><<<<</a></b>";
}else{
$prev = "<<<<";
}
if($cat){
$pager = "<a href=\"index.php?cat=".$cat."\">".(($page == 1) ? "<b>1</b>" : "1")."</a> ";
if (($page - 15) > 1) $pager .= "...";
for ($i = max(2,$page - 15); $i < min($pages, $page + 15); $i++) {
$pager .= "<a href=\"index.php?page=".$i."&cat=".$cat."\">".(($i == $page) ? "<b>".$i."</b>" : $i)."</a> ";
}
if (($page + 15) < $pages) $pager .= "...";
$pager .= "<a href=\"index.php?page=".$pages."&cat=".$cat."\">".(($page == $pages) ? "<b>".$pages."</b>" : $pages)."</a>";
torrenttable($res);
}else {
$pager = "<a href=\"index.php".$sort2."\">".(($page == 1) ? "<b>1</b>" : "1")."</a> ";
if (($page - 15) > 1) $pager .= "...";
for ($i = max(2,$page - 15); $i < min($pages, $page + 15); $i++) {
$pager .= "<a href=\"index.php?page=".$i.$sort1."\">".(($i == $page) ? "<b>".$i."</b>" : $i)."</a> ";
}
if (($page + 15) < $pages) $pager .= "...";
$pager .= "<a href=\"index.php?page=".$pages.$sort1."\">".(($page == $pages) ? "<b>".$pages."</b>" : $pages)."</a>";
torrenttable($res);
} echo "<table border=\"0\" width=\"100%\"><tr><td align=\"left\"><p>".$prev."</p></td><td align=\"center\"><p>".(($pages > 1) ? $pager : "")."</p></td><td align=\"right\"><p>".$next."</p></td></tr></table>";
} else {
OpenTable2();
echo "<h3>"._btnotorrents."</h3>";
CloseTable2();
}
}
//echo "<a name=\"infotracker\">";
OpenTable(_btinfotracker);
$sql = "SELECT O.id AS id, O.page AS page, UNIX_TIMESTAMP(O.logged_in) AS logged_in, IF(U.name IS NULL, U.username, U.name) as name, U.warned AS warned, U.level AS level, U.uploaded as uploaded, U.downloaded AS downloaded FROM ".$db_prefix."_online_users O LEFT JOIN ".$db_prefix."_users U ON O.id = U.id WHERE UNIX_TIMESTAMP(NOW()-last_action) < 600;";
$res = $db->sql_query($sql);
$tot = $db->sql_numrows($res);
$i = 1;
$simple = "<p>";
$advanced = "<table border=\"1\" width=\"100%\" cellpadding=\"0\" cellspacing=\"0\">\n";
$advanced .= "<thead><tr><td><p align=\"center\"><b>"._btusername."</b></p></td><td><p align=\"center\"><b>"._btratio."</b></p></td><td><p align=\"center\"><b>"._btpagename."</b></p></td><td><p align=\"center\"><b>"._btloggedinfor."</b></p></td></tr></thead>\n<tbody>\n";
if ($db->sql_numrows($res) == 0) $simple .= _btnouseronline;
else {
while ($row = $db->sql_fetchrow($res)) {
$simple .= "<a href=\"user.php?op=profile&id=".$row["id"]."\"><span class=".$row['level'].">";
$simple .= htmlspecialchars($row["name"])."</span></a>";
if ($row["level"] == "premium") $simple .= pic("icon_premium.gif");
elseif ($row["level"] == "moderator") $simple .= pic("icon_moderator.gif");
elseif ($row["level"] == "admin") $simple .= pic("icon_admin.gif");
if($row["warned"] == "1") $simple .= '<img src="http://bvlist.com/images/warning.gif" alt="warned" />';
if ($i < $tot) $simple .= ", ";
$i++;
$advanced .= "<tr>";
$advanced .= "<td><p><a href=\"user.php?op=profile&id=".$row["id"]."\"><span class=".$row['level'].">";
$advanced .= htmlspecialchars($row["name"])."</span></a>";
if ($row["level"] == "premium") $advanced .= pic("icon_premium.gif");
elseif ($row["level"] == "moderator") $advanced .= pic("icon_moderator.gif");
elseif ($row["level"] == "admin") $advanced .= pic("icon_admin.gif");
if($row["warned"] == "1") $advanced .= '<img src="http://bvlist.com/images/warning.gif" alt="warned" />';
$advanced .= "</p></td>";
if ($row["uploaded"] == 0 AND $row["downloaded"] == 0) $ratio = "---";
elseif ($row["downloaded"] == 0) $ratio = "∞";
else {
$ratio = $row["uploaded"]/$row["downloaded"];
if ($ratio < 0.1) $ratio = "<font color=\"#ff0000\">" . number_format($ratio, 2) . "</font>";
elseif ($ratio < 0.2) $ratio = "<font color=\"#ee0000\">" . number_format($ratio, 2) . "</font>";
elseif ($ratio < 0.3) $ratio = "<font color=\"#dd0000\">" . number_format($ratio, 2) . "</font>";
elseif ($ratio < 0.4) $ratio = "<font color=\"#cc0000\">" . number_format($ratio, 2) . "</font>";
elseif ($ratio < 0.5) $ratio = "<font color=\"#bb0000\">" . number_format($ratio, 2) . "</font>";
elseif ($ratio < 0.6) $ratio = "<font color=\"#aa0000\">" . number_format($ratio, 2) . "</font>";
elseif ($ratio < 0.7) $ratio = "<font color=\"#990000\">" . number_format($ratio, 2) . "</font>";
elseif ($ratio < 0.8) $ratio = "<font color=\"#880000\">" . number_format($ratio, 2) . "</font>";
elseif ($ratio < 0.9) $ratio = "<font color=\"#770000\">" . number_format($ratio, 2) . "</font>";
elseif ($ratio < 1) $ratio = "<font color=\"#660000\">" . number_format($ratio, 2) . "</font>";
else $ratio = "<font color=\"#00FF00\">". number_format($ratio, 2) . "</font>";
}
$advanced .= "<td><p>".$ratio."</p></td>";
$advanced .= "<td><p>";
if (defined("_btpage_".$row["page"])) $advanced .= constant("_btpage_".$row["page"]);
$advanced .= "</p></td>";
$advanced .= "<td><p>".mkprettytime(time()-$row["logged_in"])."</p></td>";
$advanced .= "</tr>\n";
}
$simple .="<br><br><p>Legend: <span class=admin>Admin</span> <img src=themes/".$theme."/pics/icon_admin.gif>, <span class=moderator>Moderator</span><img src=themes/".$theme."/pics/icon_moderator.gif>, <span class=premium>Premium</span><img src=themes/".$theme."/pics/icon_premium.gif> </p><div style='font-size: 8pt;' align=\"center\"><a href=\"javascript:advanced();\">"._btadvancedmode."</a></div>";
$simple .= "";
}
$advanced .= "</tbody></table>\n";
$db->sql_freeresult($res);
//Simple mode
echo "<div id=\"users_simple\" class=\"show\">";
echo $simple;
echo "</div>";
//Advanced mode
echo "<div id=\"users_advanced\" class=\"hide\">";
echo $advanced;
echo "<br><p>Legend: Admin <img src=themes/".$theme."/pics/icon_admin.gif>, Moderator<img src=themes/".$theme."/pics/icon_moderator.gif>, Premium<img src=themes/".$theme."/pics/icon_premium.gif> </p><div style='font-size: 8pt;' align=\"center\"><a href=\"javascript:simple();\">"._btsimplemode."</a></div>";
echo "</div>";
CloseTable();
if ($btuser) include("poll.php");
include("footer.php");
?>