
CREATE TABLE IF NOT EXISTS `bookmarks` (
`id` int(10) unsigned NOT NULL auto_increment,
`userid` int(10) unsigned NOT NULL default '0',
`torrentid` int(10) unsigned NOT NULL default '0',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
case 'name':
$char1 = 35; //cut name length
$smallname = htmlspecialchars(CutName($row["name"], $char1));
$dispname = "<b>".$smallname."</b>";
$last_access = $CURUSER["last_browse"];
$time_now = gmtime();
if ($last_access > $time_now || !is_numeric($last_access))
$last_access = $time_now;
if (sql_timestamp_to_unix_timestamp($row["added"]) >= $last_access)
$dispname .= "<b><font color='#ff0000'> - (".T_("NEW")."!)</font></b>";
if ($row["freeleech"] == 1)
$dispname .= " <img src='images/free.gif' border='0' alt='' />";
print("<td class='ttable_col$x' nowrap='nowrap'>".(count($expandrows)?"<a href="javascript: klappe_torrent('t".$row['id']."')"><img border="0" src="".$site_config["SITEURL"]."/images/plus.gif" id="pict".$row['id']."" alt="Show/Hide" class="showthecross" /></a>":"")." <a title="".$row["name"]."" href="torrents-details.php?id=$id&hit=1">$dispname</a></td>");
break;
case 'name':
$char1 = 35; //cut name length
$smallname = htmlspecialchars(CutName($row["name"], $char1));
$dispname = "<b>".$smallname."</b>";
$last_access = $CURUSER["last_browse"];
$time_now = gmtime();
if ($last_access > $time_now || !is_numeric($last_access))
$last_access = $time_now;
if (sql_timestamp_to_unix_timestamp($row["added"]) >= $last_access) {
$new = "<img src='images/t_new.png' border='0' title='New Torrent'>";
} else {
$new = "";
}
if ($row["freeleech"] == 1) {
$freeleech = "<img src='images/free.gif' border='0' title='Free Leech'>";
} else {
$freeleech = "";
}
$bookt = SQL_Query_exec("SELECT torrentid FROM bookmarks WHERE torrentid = $id AND userid = $CURUSER[id]");
if (mysql_num_rows($bookt) > 0) {
$bookmark = "<a href='bookmark.php'><img src='images/bookmarked.png' border='0' title='Bookmarked'></a>";
} else {
$bookmark = "<a href='bookmarks.php?torrent=$id'><img src='images/bookmark.png' border='0' title='Bookmark this Torrent'></a>";
}
print("<td class='ttable_col$x' nowrap='nowrap'>".(count($expandrows)?"<a href="javascript: klappe_torrent('t".$row['id']."')"><img border="0" src="".$site_config["SITEURL"]."/images/plus.gif" id="pict".$row['id']."" alt="Show/Hide" class="showthecross" /></a>":"")." $bookmark <a title="".$row["name"]."" href="torrents-details.php?id=$id&hit=1">$dispname</a> $freeleech $new</td>");
break;
print ("<b>".T_("LAST_CHECKED").": </b>" . date("d-m-Y H:i:s", utc_to_tz_time($row["last_action"])) . "<br /></td>");
print ("<b>".T_("LAST_CHECKED").": </b>" . date("d-M-Y H:i:s", utc_to_tz_time($row["last_action"])) . "");
//===| Start Bookmarks
$bookt = SQL_Query_exec("SELECT torrentid FROM bookmarks WHERE torrentid = $row[id] AND userid = $CURUSER[id]");
if (mysql_num_rows($bookt) > 0)
print("<div style='margin-top:3px'><font color='#0080FF'><b>Bookmark</b></font>: <font color='#FF2200'><b>This torrent is already into</b></font> <a href='bookmark.php'><b>Your Bookmarks</b></a>. [<a href='takedelbookmark.php?bookmarkid=".$row[id]."'><b>Delete it from the list</b></a>]</div>");
else
print("<div style='margin-top:3px'><font color='#0080FF'><b>Bookmark</b></font>: <a href='bookmarks.php?torrent=$row[id]'><b>Add this torrent</b></a> to <a href='bookmark.php'><b>Your Bookmarks</b></a></div>");
//===| End Bookmarks
print("</td>");
<?php print("<a href='mailbox.php'><font color="#FEFEFE"><b>".T_("YOUR_MESSAGES")."</b></font></a>");?>
|
<?php print("<a href=bookmark.php><font color="#FEFEFE"><b>Your Bookmarks</b></font></a>");?>
SQL_Query_exec("INSERT INTO `messages`//===| Start Blocked Users
$blocked = SQL_Query_exec("SELECT id FROM blocked WHERE userid=$sendto AND blockid=$CURUSER[id]");
$show = mysql_num_rows($blocked);
if ($show != 0 && $CURUSER["control_panel"] != "yes")
show_error_msg("Error", "<div style='margin-top:10px; margin-bottom:10px' align='center'><font size=2 color=#FF2000><b>You're blocked by this member and you can not send messages to him!</b></font></div>", 1);
//===| End Blocked Users<?php echo T_("AGE"); ?><!--| Start Friends |-->
<div style="margin-bottom:10px">
<?php
If ($CURUSER["id"] != $user["id"])
{
$r = mysql_query("SELECT id FROM friends WHERE userid=$CURUSER[id] AND friendid=$id");
$friend = mysql_num_rows($r);
$r = mysql_query("SELECT id FROM blocked WHERE userid=$CURUSER[id] AND blockid=$id");
$block = mysql_num_rows($r);
if ($friend)
print("[<a href=friends.php?action=delete&type=friend&targetid=$id>Remove from Friends</a>]n");
elseif($block)
print(" [<a href=friends.php?action=delete&type=block&targetid=$id>Remove from Blocked</a>]n");
else
{
print("[<a href=friends.php?action=add&type=friend&targetid=$id><b>Add to Friends</b></a>] ");
print(" [<a href=friends.php?action=add&type=block&targetid=$id><b>Add to Blocked</b></a>]n");
}
}
?>
</div>
<!--| End Friends |-->show_error_msg(T_("ERROR"), T_("NO_ACCESS_ACCOUNT_DISABLED"), 1);//===| Start Blocked Users
$blocked = SQL_Query_exec("SELECT id FROM blocked WHERE userid=$user[id] AND blockid=$CURUSER[id]");
$show = mysql_num_rows($blocked);
if ($show != 0 && $CURUSER["control_panel"] != "yes")
show_error_msg("Error", "<div style='margin-top:10px; margin-bottom:10px' align='center'><font size=2 color=#FF2000><b>You're blocked by this member and you can not see his profile!</b></font></div>", 1);
//===| End Blocked Users<?php print("<a href='mailbox.php'><b>".T_("YOUR_MESSAGES")."</b></a>");?> |
<?php print("<a href='friends.php'><b>Your Friends</b></a>");?>
// BitBucket
$site_config["MAX_UPLOAD_FILESIZE"] = 512 * 1024; // Max file size
$site_config["MAX_BITBUCKET_SIZE_USER"] = 1 * 1024 * 1024; // Max space for users
$site_config["MAX_BITBUCKET_SIZE_UPLOADER"] = 10 * 1024 * 1024; // Max space for uploaders
$site_config["BITBUCKET_DIR"] = "bitbucket"; // BitBucket images directory
$site_config["LOADBAR_IMG"] = "images/loadbar/"; // Loadbar images location<td align="center"><a href="bitbucket-gallery.php"><img src="images/admin/bitbucket.png" border="0" width="32" height="32"><br />Bitbucket Gallery</a><br /></td><?php print("<a href='mailbox.php'><b>".T_("YOUR_MESSAGES")."</b></a>");?> |
<?php print("<a href='bitbucket.php'><b>BitBucket</b></a>");?>

#======================================================================#
# Warned Users - Updated by BigMax (25-Mar-2013)
#======================================================================#
if ($action == "warned") {
if ($do == "delete") {
if ($_POST["removeall"]) {
$res = SQL_Query_exec("SELECT `id` FROM `users` WHERE `enabled` = 'yes' AND `status` = 'confirmed' AND `warned` = 'yes'");
while ($row = mysql_fetch_assoc($res)) {
SQL_Query_exec("DELETE FROM `warnings` WHERE `active` = 'yes' AND `userid` = '$row[id]'");
SQL_Query_exec("UPDATE `users` SET `warned` = 'no' WHERE `id` = '$row[id]'");
}
} else {
if (!@count($_POST['warned']))
show_error_msg("Error", "Nothing selected", 1);
$ids = array_map("intval", $_POST["warned"]);
$ids = implode(", ", $ids);
SQL_Query_exec("DELETE FROM `warnings` WHERE `active` = 'yes' AND `userid` IN ($ids)");
SQL_Query_exec("UPDATE `users` SET `warned` = 'no' WHERE `id` IN ($ids)");
}
autolink("admincp.php?action=warned", "Entries Confirmed");
}
$perpage = 50;
$count = get_row_count("users", "WHERE enabled = 'yes' AND status = 'confirmed' AND warned = 'yes'");
list($pagertop, $pagerbottom, $limit) = pager($perpage, $count, 'admincp.php?action=warned&');
$res = SQL_Query_exec("SELECT `id`, `username`, `class`, `added`, `last_access`, `downloaded`, `uploaded` FROM `users` WHERE `enabled` = 'yes' AND `status` = 'confirmed' AND `warned` = 'yes' ORDER BY `added` DESC $limit");
stdhead("Warned Users");
navmenu();
begin_frame("Warned Users");
$warnedusers = number_format($count);
?>
<div style="margin-top:10px; margin-bottom:10px" align="center"><font size="2">
This page displays all users which are enabled and have active warnings<? if (get_user_class() == 10) { ?>, they can be mass deleted or deleted per user<br />
Please note that if you delete a warning which was for poor ratio, then this is extending the time user has left to expire<? } ?>
<div style="margin-top:10px" align="center">We have <font color="#FF2200"><b><?php echo $warnedusers; ?></b></font> warned user<?php echo ($warnedusers != 1 ? "s" : ""); ?></div></font></div>
<?php If ($count > $perpage) {
print($pagertop);
}
?>
<?php if ($count > 0): ?>
<form id="warned" method="post" action="admincp.php?action=warned&do=delete">
<table border="0" cellpadding="4" cellspacing="0" width="100%" align="center" class="table_table">
<tr>
<th class="table_head" align="left">Username</th>
<th class="table_head" align="left">Class</th>
<th class="table_head" align="left">Uploaded</th>
<th class="table_head" align="left">Downloaded</th>
<th class="table_head" align="left">Ratio</th>
<th class="table_head">Added</th>
<th class="table_head">Last Access</th>
<th class="table_head">Warnings</th>
<th class="table_head"><font color="#FF2200"><b>H</b><small>&</small><b>R</b></font></th>
<? if (get_user_class() >= 6) { ?>
<th class="table_head"><input type="checkbox" name="checkall" onclick="checkAll(this.form.id);" /></th>
<?php } ?>
</tr>
<?php
while ($row = mysql_fetch_assoc($res)):
$qry = SQL_Query_exec("SELECT COUNT(`hnr`) FROM `snatched` WHERE `uid` = '".$row["id"]."' AND `hnr` = 'yes'");
$res2 = mysql_fetch_row($qry);
If ($res2[0] > 0) {
$hnr = "<font style="background-color:B50000" color="#FEFEFE"><b> ".$res2[0]." </b></font>";
} else {
$hnr = "<font color=limegreen><b>No</b></font>";
}
$addeded = date("d-M-Y H:i", utc_to_tz_time($row["added"]));
$joined = ("".get_elapsed_time(sql_timestamp_to_unix_timestamp($row["added"]))." ago");
$lastaccess = (($row["last_access"] == "0000-00-00 00:00:00") ? "Never logged" : "".date("d-M-Y H:i", utc_to_tz_time($row["last_access"]))."");
$lastseen = (($row["last_access"] == "0000-00-00 00:00:00") ? "---" : "".get_elapsed_time(sql_timestamp_to_unix_timestamp($row["last_access"]))." ago" );
$downloaded = "<font color=#FF2200><b>".mksize($row["downloaded"])."</b></font>";
$uploaded = "<font color=limegreen><b>".mksize($row["uploaded"])."</b></font>";
if($row["downloaded"] != 0) {
$ratio = number_format($row["uploaded"] / $row["downloaded"], 2);
} else {
$ratio = "---";
}
$ratio = "<font color=".get_ratio_color($ratio)."><b>$ratio</b></font>";
?>
<tr>
<td class="table_col1"><a href="account-details.php?id=<?php echo $row["id"]; ?>"><b><?php echo class_user($row["username"]); ?></b></a></td>
<td class="table_col2"><?php echo get_user_class_name($row["class"]); ?></td>
<td class="table_col1"><?php echo $uploaded; ?></td>
<td class="table_col2"><?php echo $downloaded; ?></td>
<td class="table_col1"><?php echo $ratio; ?></td>
<td class="table_col2" align="center"><?php echo "".$addeded."<br />".$joined.""; ?></td>
<td class="table_col1" align="center"><?php echo "".$lastaccess."<br />".$lastseen.""; ?></td>
<td class="table_col1" align="center"><font color="#FF2200"><b>Active</b></font>: [<a href="account-details.php?id=<?php echo $row["id"]; ?>#warnings"><b><?php echo number_format(get_row_count("warnings", "WHERE userid = '$row[id]' AND active = 'yes'")); ?></b></a>]
<div style="margin-top:4px"><font color="limegreen"><b>Expired</b></font>: [<a href="account-details.php?id=<?php echo $row["id"]; ?>#warnings"><b><?php echo number_format(get_row_count("warnings", "WHERE userid = '$row[id]' AND active != 'yes'")); ?></b></a>]</div></td>
<td class="table_col1" align="center"><?php echo $hnr; ?></td>
<?php if (get_user_class() >= 6) { ?>
<td class="table_col2" align="center"><input type="checkbox" name="warned[]" value="<?php echo $row["id"]; ?>" /></td>
<?php } ?>
</tr>
<?php endwhile; ?>
<?php if (get_user_class() >= 6) { ?>
<tr>
<td colspan="10" align="right">
<input type="submit" value="Remove Checked" />
<input type="submit" name="removeall" value="Remove All" />
</td>
</tr>
<?php } ?>
</table>
</form>
<?php else: ?>
<center><font size="2"><b>No Warned Users!</b></font></center>
<?php
endif;
If ($count > $perpage) {
print($pagerbottom);
} else {
print("<br />");
}
end_frame();
stdfoot();
}
<?php
require_once("backend/functions.php");
dbconn();
if ($CURUSER["control_panel"] != "yes") { show_error_msg(T_("ERROR"), T_("SORRY_NO_RIGHTS_TO_ACCESS"), 1); }
$page = (int) $_GET["page"];
$perpage = 50;
$res2 = SQL_Query_exec("SELECT COUNT(*) FROM torrents WHERE banned = 'no' AND external = 'yes' AND seeders < 1");
$row2 = mysql_fetch_array($res2);
$count = $row2[0];
list($pagertop, $pagerbottom, $limit) = pager($perpage, $count, "torrents-dead.php?id=$id&");
$res = SQL_Query_exec("SELECT torrents.id, torrents.name, torrents.owner, torrents.external, torrents.size, torrents.seeders, torrents.leechers, torrents.times_completed, torrents.added, torrents.last_action, users.username FROM torrents LEFT JOIN users ON torrents.owner = users.id WHERE torrents.banned = 'no' AND torrents.external = 'yes' AND torrents.seeders < 1 ORDER BY torrents.added DESC $limit");
if ($_POST["do"] == "delete") {
if (!@count($_POST["torrentids"]))
show_error_msg("Error", "<div style='margin-top:10px; margin-bottom:10px' align='center'>You must select at least one torrent. [<a href='torrents-dead.php'><b>Go Back</b></a>]</div>", 1);
foreach ($_POST["torrentids"] as $id) {
deletetorrent(intval($id));
write_log("<a href=account-details.php?id=$CURUSER[id]><b>$CURUSER[username]</b></a> has deleted external torrent ID: [<b>$id</b>] from the page: <i><b>Dead External Torrents</b></i>");
}
autolink("torrents-dead.php", "Selected torrent(s) was deleted successfully.");
}
stdhead("Dead Extrnal Torrents");
if ($count < 1) show_error_msg("".T_("NOTHING")."", "<div style='margin-top:10px; margin-bottom:10px' align='center'><font size='2'>".T_("NO_DEAD_EX_TOR")."</font></div>", 1);
begin_frame("Dead Extrnal Torrents");
echo "<div style='margin-top:10px' align='center'><font size='2'>List of external torrents without seeders, ordered by upload date</font></div>";
echo "<div style='margin-top:10px; margin-bottom:20px' align='center'><font size='2'>We have <font color='red'><b>$count</b></font> dead external torrent".($count != 1 ? "s" : "")."</font></div>";
If ($count > $perpage) { print($pagertop); }
?>
<form id="myform" method='post' action='torrents-dead.php'>
<input type='hidden' name='do' value='delete' />
<table cellpadding="5" cellspacing="0" class="table_table" align="center" width="100%">
<tr>
<th class="table_head" align="left"><?php echo T_("TORRENT_NAME"); ?></th>
<th class="table_head" align="left"><?php echo T_("UPLOADER"); ?></th>
<th class="table_head"><?php echo T_("SIZE"); ?></th>
<th class="table_head"><img src="images/seed.gif" border="0" title="Seeders"></th>
<th class="table_head"><img src="images/leech.gif" border="0" title="Leechers"></th>
<th class="table_head"><img src="images/ready.png" border="0" title="Completed"></th>
<th class="table_head" width="1%"><?php echo T_("ADDED"); ?></th>
<th class="table_head" width="1%">Last Action</th>
<?php if (get_user_class() >= 6) { ?>
<th class='table_head'><input type='checkbox' name='checkall' onclick='checkAll(this.form.id);' /></th>
<?php } ?>
</tr>
<?php
while ($row = mysql_fetch_assoc($res))
{
if ($row["username"]) $owner = "<a href='account-details.php?id=".$row["owner"]."'><b>".$row["username"]."</b></a>";
else $owner = T_("UNKNOWN_USER");
?>
<tr>
<td class="table_col1"><a href="torrents-details.php?id=<?php echo $row["id"]; ?>"><?php echo CutName(htmlspecialchars($row["name"]), 50) ?></a></td>
<td class="table_col2"><?php echo $owner; ?></td>
<td class="table_col2" align="center"><?php echo mksize($row["size"]); ?></td>
<td class="table_col1" align="center"><font color="limegreen"><b><?php echo number_format($row["seeders"]); ?></b></font></td>
<td class="table_col2" align="center"><font color="red"><b><?php echo number_format($row["leechers"]); ?></b></font></td>
<td class="table_col1" align="center"><font color="#0080FF"><b><?php echo number_format($row["times_completed"]); ?></b></font></td>
<td class="table_col2" align="center"><?php echo date("d.M.Y H:i", utc_to_tz_time($row["added"])) ?></td>
<td class="table_col2" align="center"><?php echo date("d.M.Y H:i", utc_to_tz_time($row["last_action"])) ?></td>
<?php if (get_user_class() >= 6) { ?>
<td class='table_col2' align='center'><input type='checkbox' name='torrentids[]' value='<?php echo $row["id"]; ?>' /></td>
<?php } ?>
</tr>
<?php
}
?>
</table>
<?php if (get_user_class() >= 6) { ?>
<div style='margin-top:3px' align='right'><input type='submit' value='Delete Checked' /></div>
<?php } ?>
</form>
<?php
If ($count > $perpage) { print($pagerbottom); } else { print("<br />"); }
end_frame();
stdfoot();
?>
function get_ratio_color($ratio) {
if ($ratio < 0.1) return "#AD1400";
if ($ratio < 0.2) return "#CB1800";
if ($ratio < 0.3) return "#EC1C00";
if ($ratio < 0.4) return "#D26200";
if ($ratio < 0.5) return "#9D9B00";
if ($ratio < 0.6) return "#C1B500";
if ($ratio < 0.7) return "#A1BE00";
if ($ratio < 0.8) return "#94C500";
if ($ratio < 0.9) return "#7ECC00";
if ($ratio < 1) return "#6FDD00";
return "#2DDF00";
}
<?php
require "backend/functions.php";
dbconn(false);
loggedinonly();
if (get_user_class() < 2)
show_error_msg("Acces denied", "You must be at least Power User!", 1);
function usertable($res, $frame_caption) {
global $CURUSER;
begin_frame($frame_caption, true);
?>
<table class=table_table width=100% align=center border=0 cellpadding=4>
<tr style="font:bold">
<td class=table_head align=center width=10%>Rank</td>
<td class=table_head align=left width=20%>User</td>
<td class=table_head align=left width=10%>Uploaded</td>
<td class=table_head align=left width=10%>UL speed</td>
<td class=table_head align=left width=10%>Downloaded</td>
<td class=table_head align=left width=10%>DL speed</td>
<td class=table_head align=center width=10%>Ratio</td>
<td class=table_head align=center width=20%>Joined</td>
</tr>
<?php
$num = 0;
while ($a = mysql_fetch_assoc($res)) {
++$num;
$highlight = $CURUSER["id"] == $a["userid"] ? " bgcolor=#1B2B1F" : "";
if ($a["downloaded"]) {
$ratio = $a["uploaded"] / $a["downloaded"];
$color = get_ratio_color($ratio);
$ratio = number_format($ratio, 2);
if ($color)
$ratio = "<font color=$color>$ratio</font>";
} else
$ratio = "Inf.";
print("<tr$highlight>
<td class=table_col1 align=center>$num</td>
<td class=table_col2 align=left$highlight><a href=account-details.php?id=" .$a["userid"] . "><b>" . $a["username"] . "</b>" ."</td>
<td class=table_col1 align=left$highlight><font color=limegreen>" . mksize($a["uploaded"]) . "</font></td>
<td class=table_col2 align=left$highlight><font color=limegreen>" . mksize($a["upspeed"]) . "/s" ."</font></td>
<td class=table_col1 align=left$highlight><font color=#FF2400>" . mksize($a["downloaded"]) . "</font></td>
<td class=table_col2 align=left$highlight><font color=#FF2400>" . mksize($a["downspeed"]) . "/s" . "</font></td>
<td class=table_col1 align=center$highlight>" . $ratio ."</td>
<td class=table_col2 align=center>" . gmdate("d-M-Y",strtotime($a["added"])) . " (" .get_elapsed_time(sql_timestamp_to_unix_timestamp($a["added"])) . " ago)</td>
</tr>");
}
print("</table>");
end_frame();
}
function _torrenttable($res, $frame_caption) {
begin_frame($frame_caption, true);
?>
<table class=table_table width=100% align=center border=0 cellpadding=4>
<tr style="font:bold">
<td class=table_head align=center>Rank</td>
<td class=table_head align=left>Name</td>
<td class=table_head align=center><img src="images/ready.png" border=0 title=Completed></td>
<td class=table_head align=right>Traffic</td>
<td class=table_head align=right><img src="images/seed.gif" border=0 title=Seeders></td></td>
<td class=table_head align=right><img src="images/leech.gif" border=0 title=Leechers></td></td>
<td class=table_head align=right>Total</td>
<td class=table_head align=right>Ratio</td>
</tr>
<?php
$num = 0;
while ($a = mysql_fetch_assoc($res)) {
++$num;
if ($a["leechers"]) {
$r = $a["seeders"] / $a["leechers"];
$ratio = "<font color=" . get_ratio_color($r) . ">" . number_format($r, 2) . "</font>";
} else
$ratio = "Inf.";
print("<tr>
<td align=center class=table_col1>$num</td>
<td align=left class=table_col2><a href=torrents-details.php?id=" . $a["id"] . "&hit=1><b>" . $a["name"] . "</b></a></td>
<td align=center class=table_col1><font color=#0080FF><b>" . number_format($a["times_completed"]) . "</b></font></td>
<td align=right class=table_col2>" . mksize($a["data"]) . "</td>
<td align=right class=table_col1><font color=limegreen><b>" . number_format($a["seeders"]) . "</b></font></td>
<td align=right class=table_col2><font color=red><b>" . number_format($a["leechers"]) . "</b></font></td>
<td align=right class=table_col1>" . ($a["leechers"] + $a["seeders"]) . "</td>
<td align=right class=table_col2>$ratio</td>
</tr>\n");
}
print("</table>");
end_frame();
}
function countriestable($res, $frame_caption, $what) {
global $CURUSER;
begin_frame($frame_caption, true);
?>
<table class=table_table width=50% align=center border=0 cellpadding=4>
<tr style="font:bold">
<td class=table_head align=center>Rank</td>
<td class=table_head align=center>Country Flag</td>
<td class=table_head align=left>Country Name</td>
<td class=table_head align=right><?=$what?></td>
</tr>
<?php
$num = 0;
while ($a = mysql_fetch_assoc($res)) {
++$num;
if ($what == "Users")
$value = number_format($a["num"]);
elseif ($what == "Uploaded")
$value = mksize($a["ul"]);
elseif ($what == "Average")
$value = mksize($a["ul_avg"]);
elseif ($what == "Ratio")
$value = number_format($a["r"],2);
if ($a[flagpic]) {
$flag = "<img align=center src=images/countries/$a[flagpic]>";
} else {
$flag = "<img align=center src=images/countries/unknown.gif>";
}
if ($a[name]) {
$name = "<b>$a[name]</b>";
} else {
$name = "<b>Land of Homeless!</b>";
}
print("<tr>
<td align=center class=table_col1>$num</td>
<td align=center class=table_col2>" . "$flag</td>
<td class=table_col1>$name</td>" . "
<td align=right class=table_col2>$value</td>
</tr>\n");
}
print("</table>");
end_frame();
}
stdhead("Top 10");
begin_frame("..:: Top Ten ::..");
$type = isset($_GET["type"]) ? 0 + $_GET["type"] : 0;
if (!in_array($type,array(1,2,3)))
$type = 1;
$limit = isset($_GET["lim"]) ? 0 + $_GET["lim"] : false;
$subtype = isset($_GET["subtype"]) ? $_GET["subtype"] : false;
print("<div style='font: bold 12px Verdana; margin-top:10px; margin-bottom:15px' align=center>" .
($type == 1 && !$limit ? "Users" : "<a href=topten.php?type=1>Users</a>") . " | " .
($type == 2 && !$limit ? "Torrents" : "<a href=topten.php?type=2>Torrents</a>") . " | " .
($type == 3 && !$limit ? "Countries" : "<a href=topten.php?type=3>Countries</a>") . "
</div>\n");
$pu = get_user_class($CURUSER) >= 3;
if (!$pu)
$limit = 10;
if ($type == 1) {
$mainquery = "SELECT id as userid, username, added, uploaded, downloaded, uploaded / (UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(added)) AS upspeed, downloaded / (UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(added)) AS downspeed FROM users WHERE enabled = 'yes'";
if (!$limit || $limit > 250)
$limit = 10;
if ($limit == 10 || $subtype == "ul") {
$order = "uploaded DESC";
$r = SQL_Query_exec($mainquery . " ORDER BY $order " . " LIMIT $limit");
usertable($r, "Top $limit Uploaders" . ($limit == 10 && $pu ? " <font class=small> -
[<a href=topten.php?type=1&lim=100&subtype=ul>Top 100</a>] - [<a href=topten.php?type=1&lim=250&subtype=ul>Top 250</a>]</font>" : ""));
}
if ($limit == 10 || $subtype == "dl") {
$order = "downloaded DESC";
$r = SQL_Query_exec($mainquery . " ORDER BY $order " . " LIMIT $limit");
usertable($r, "Top $limit Downloaders" . ($limit == 10 && $pu ? " <font class=small> -
[<a href=topten.php?type=1&lim=100&subtype=dl>Top 100</a>] - [<a href=topten.php?type=1&lim=250&subtype=dl>Top 250</a>]</font>" : ""));
}
if ($limit == 10 || $subtype == "uls") {
$order = "upspeed DESC";
$r = SQL_Query_exec($mainquery . " ORDER BY $order " . " LIMIT $limit");
usertable($r, "Top $limit Fastest Uploaders <font class=small>(average, includes inactive time)</font>" .
($limit == 10 && $pu ? " <font class=small> - [<a href=topten.php?type=1&lim=100&subtype=uls>Top 100</a>] -
[<a href=topten.php?type=1&lim=250&subtype=uls>Top 250</a>]</font>" : ""));
}
if ($limit == 10 || $subtype == "dls") {
$order = "downspeed DESC";
$r = SQL_Query_exec($mainquery . " ORDER BY $order " . " LIMIT $limit");
usertable($r, "Top $limit Fastest Downloaders <font class=small>(average, includes inactive time)</font>" . ($limit == 10 && $pu ? " <font class=small> - [<a href=topten.php?type=1&lim=100&subtype=dls>Top 100</a>] - [<a href=topten.php?type=1&lim=250&subtype=dls>Top 250</a>]</font>" : ""));
}
if ($limit == 10 || $subtype == "bsh") {
$order = "uploaded / downloaded DESC";
$extrawhere = " AND downloaded > 1073741824";
$r = SQL_Query_exec($mainquery . $extrawhere . " ORDER BY $order " . " LIMIT $limit");
usertable($r, "Top $limit Best Sharers <font class=small>(with minimum 1 GB downloaded)</font>" . ($limit == 10 && $pu ? " <font class=small> - [<a href=topten.php?type=1&lim=100&subtype=bsh>Top 100</a>] - [<a href=topten.php?type=1&lim=250&subtype=bsh>Top 250</a>]</font>" : ""));
}
if ($limit == 10 || $subtype == "wsh") {
$order = "uploaded / downloaded ASC, downloaded DESC";
$extrawhere = " AND downloaded > 1073741824";
$r = SQL_Query_exec($mainquery . $extrawhere . " ORDER BY $order " . " LIMIT $limit");
usertable($r, "Top $limit Worst Sharers <font class=small>(with minimum 1 GB downloaded)</font>" . ($limit == 10 && $pu ? " <font class=small> - [<a href=topten.php?type=1&lim=100&subtype=wsh>Top 100</a>] - [<a href=topten.php?type=1&lim=250&subtype=wsh>Top 250</a>]</font>" : ""));
}
}
elseif ($type == 2)
{
if (!$limit || $limit > 50)
$limit = 10;
if ($limit == 10 || $subtype == "act") {
$r = SQL_Query_exec("SELECT t.*, (t.size * t.times_completed + SUM(p.downloaded)) AS data FROM torrents AS t LEFT JOIN peers AS p ON t.id = p.torrent WHERE p.seeder = 'no' GROUP BY t.id ORDER BY seeders + leechers DESC, seeders DESC, added ASC LIMIT $limit");
_torrenttable($r, "Top $limit Most Active Torrents" . ($limit == 10 && $pu ? " <font class=small> - [<a href=topten.php?type=2&lim=25&subtype=act>Top 25</a>] - [<a href=topten.php?type=2&lim=50&subtype=act>Top 50</a>]</font>" : ""));
}
if ($limit == 10 || $subtype == "sna") {
$r = SQL_Query_exec("SELECT t.*, (t.size * t.times_completed + SUM(p.downloaded)) AS data FROM torrents AS t LEFT JOIN peers AS p ON t.id = p.torrent WHERE p.seeder = 'no' GROUP BY t.id ORDER BY times_completed DESC LIMIT $limit");
_torrenttable($r, "Top $limit Most Snatched Torrents" . ($limit == 10 && $pu ? " <font class=small> - [<a href=topten.php?type=2&lim=25&subtype=sna>Top 25</a>] - [<a href=topten.php?type=2&lim=50&subtype=sna>Top 50</a>]</font>" : ""));
}
if ($limit == 10 || $subtype == "mdt") {
$r = SQL_Query_exec("SELECT t.*, (t.size * t.times_completed + SUM(p.downloaded)) AS data FROM torrents AS t LEFT JOIN peers AS p ON t.id = p.torrent WHERE p.seeder = 'no' AND leechers >= 5 AND times_completed > 0 GROUP BY t.id ORDER BY data DESC, added ASC LIMIT $limit");
_torrenttable($r, "Top $limit Most Data Transferred Torrents" . ($limit == 10 && $pu ? " <font class=small> - [<a href=topten.php?type=2&lim=25&subtype=mdt>Top 25</a>] - [<a href=topten.php?type=2&lim=50&subtype=mdt>Top 50</a>]</font>" : ""));
}
if ($limit == 10 || $subtype == "bse") {
$r = SQL_Query_exec("SELECT t.*, (t.size * t.times_completed + SUM(p.downloaded)) AS data FROM torrents AS t LEFT JOIN peers AS p ON t.id = p.torrent WHERE p.seeder = 'no' AND seeders >= 5 GROUP BY t.id ORDER BY seeders / leechers DESC, seeders DESC, added ASC LIMIT $limit");
_torrenttable($r, "Top $limit Best Seeded Torrents <font class=small>(with minimum 5 seeders)</font>" . ($limit == 10 && $pu ? " <font class=small> - [<a href=topten.php?type=2&lim=25&subtype=bse>Top 25</a>] - [<a href=topten.php?type=2&lim=50&subtype=bse>Top 50</a>]</font>" : ""));
}
if ($limit == 10 || $subtype == "wse") {
$r = SQL_Query_exec("SELECT t.*, (t.size * t.times_completed + SUM(p.downloaded)) AS data FROM torrents AS t LEFT JOIN peers AS p ON t.id = p.torrent WHERE p.seeder = 'no' AND leechers >= 5 AND times_completed > 0 GROUP BY t.id ORDER BY seeders / leechers ASC, leechers DESC LIMIT $limit");
_torrenttable($r, "Top $limit Worst Seeded Torrents <font class=small>(with minimum 5 leechers, excluding unsnatched torrents)</font>" . ($limit == 10 && $pu ? " <font class=small> - [<a href=topten.php?type=2&lim=25&subtype=wse>Top 25</a>] - [<a href=topten.php?type=2&lim=50&subtype=wse>Top 50</a>]</font>" : ""));
}
}
elseif ($type == 3)
{
if (!$limit || $limit > 25)
$limit = 10;
if ($limit == 10 || $subtype == "us") {
$r = SQL_Query_exec("SELECT name, flagpic, COUNT(users.country) as num FROM countries LEFT JOIN users ON users.country = countries.id GROUP BY name ORDER BY num DESC LIMIT $limit");
countriestable($r, "Top $limit Countries<font class=small> (users)</font>" . ($limit == 10 && $pu ? " <font class=small> - [<a href=topten.php?type=3&lim=25&subtype=us>Top 25</a>]</font>" : ""),"Users");
}
if ($limit == 10 || $subtype == "ul") {
$r = SQL_Query_exec("SELECT c.name, c.flagpic, sum(u.uploaded) AS ul FROM users AS u LEFT JOIN countries AS c ON u.country = c.id WHERE u.enabled = 'yes' GROUP BY c.name ORDER BY ul DESC LIMIT $limit");
countriestable($r, "Top $limit Countries<font class=small> (total uploaded)</font>" . ($limit == 10 && $pu ? " <font class=small> - [<a href=topten.php?type=3&lim=25&subtype=ul>Top 25</a>]</font>" : ""),"Uploaded");
}
if ($limit == 10 || $subtype == "avg") {
$r = SQL_Query_exec("SELECT c.name, c.flagpic, sum(u.uploaded)/count(u.id) AS ul_avg FROM users AS u LEFT JOIN countries AS c ON u.country = c.id WHERE u.enabled = 'yes' GROUP BY c.name HAVING sum(u.uploaded) > 1099511627776 AND count(u.id) >= 100 ORDER BY ul_avg DESC LIMIT $limit");
countriestable($r, "Top $limit Countries<font class=small> (average total uploaded per user, with minimum 1TB uploaded and 100 users)</font>" . ($limit == 10 && $pu ? " <font class=small> -
[<a href=topten.php?type=3&lim=25&subtype=avg>Top 25</a>]</font>" : ""),"Average");
}
if ($limit == 10 || $subtype == "r") {
$r = SQL_Query_exec("SELECT c.name, c.flagpic, sum(u.uploaded)/sum(u.downloaded) AS r FROM users AS u LEFT JOIN countries AS c ON u.country = c.id WHERE u.enabled = 'yes' GROUP BY c.name HAVING sum(u.uploaded) > 1099511627776 AND sum(u.downloaded) > 1099511627776 AND count(u.id) >= 100 ORDER BY r DESC LIMIT $limit");
countriestable($r, "Top $limit Countries<font class=small> (ratio, with minimum 1TB uploaded, 1TB downloaded and 100 users)</font>" . ($limit == 10 && $pu ? " <font class=small> -
[<a href=topten.php?type=3&lim=25&subtype=r>Top 25</a>]</font>" : ""),"Ratio");
}
}
end_frame();
stdfoot();
?>
<?php
require_once("backend/functions.php");
dbconn(false);
loggedinonly();
$res12 = SQL_Query_exec("SELECT client, peer_id FROM peers GROUP BY client");
stdhead("All Clients");
begin_frame("All Clients");
print("<br /><table class=tabla_table align=center border=0 cellspacing=0 cellpadding=5>n");
print("<tr><th class=table_head>Client</th><th class=table_head>Peer ID</th></tr>n");
while($arr12 = mysql_fetch_assoc($res12))
{
print("<tr><td class=table_col1> $arr12[client] </td><td class=table_col2> $arr12[peer_id] </td></tr>n");
}
print("</table><br />n");
end_frame();
stdfoot();
?>
if ($event == "stopped") { // UPDATE "STOPPED" EVENT
I added this new line:
SQL_Query_exec("UPDATE LOW_PRIORITY `snatched` SET `ltime` = `ltime` - '".$site_config['announce_interval']."' WHERE `tid` = '$torrentid' AND `uid` = '$userid'");
}else{
$elapsed = ($self['seeder'] == 'yes') ? (gmtime() - $self['ez']) : 0;
$upthis = max(0, $uploaded - $self["uploaded"]);
$downthis = max(0, $downloaded - $self["downloaded"]);
if (($upthis > 0 || $downthis > 0 || $elapsed > 0) && is_valid_id($userid)){ // LIVE STATS!)
$elapsed = ($self['seeder'] == 'yes') ? $site_config['announce_interval'] - floor(($self['ez'] - time()) / 60) : 0;