What is with this snatched.php? the 'pager' isn't showing but the number of snatches are limited, 'Completed' with time issues and others...
Well, I must to correct it eventually because I see that no one has noticed these problems
[size=14px]OK, I'm back with a new snatched.php corrected file. See the attached archive.[/size]
--------------------------------------------------
I make a mistake here, sorry by that...
[size=18px]
I updated the attached archive[/size]
<?php
#================================#
# TorrentTrader 2.08 #
#
http://www.torrenttrader.org #
#--------------------------------#
# Modified by BigMax #
#================================#
error_reporting(E_ALL ^ E_NOTICE);
error_reporting(1);
require_once('backend/functions.php');
dbconn();
loggedinonly();
$tid = ( int ) $_GET['tid'];
$uid = ( int ) $_GET['uid'];
$id = ( int ) $_GET['id'];
if ($id != 0)
$uid = ( int ) $_GET['id'];
if ($tid == 0 && $uid == 0)
$uid = ( int ) $CURUSER['id'];
if ($tid > 0) {
$count_tid = get_row_count('snatched', 'WHERE `tid` = '' . $tid . ''');
$type = "torrent";
$count_uid = 0;
} else {
$count_uid = get_row_count('snatched', 'WHERE `uid` = '' . $uid . ''');
$type = "user";
$count_tid = 0;
}
//===| for debug...
$debug = 0;
if ($debug) {
$title1 = sprintf(T_("SNATCHLIST_FOR"), " Debug");
stdhead($title1);
begin_frame($title1);
$qry1 = "SELECT
users.id,
users.username,
users.class,
snatched.uid as uid,
snatched.tid as tid,
snatched.uload,
snatched.dload,
snatched.stime,
snatched.utime,
snatched.ltime,
snatched.completed,
completed.date,
(
SELECT seeder
FROM peers
WHERE torrent = tid AND userid = uid LIMIT 1
) AS seeding
FROM
snatched
INNER JOIN users ON snatched.uid = users.id
INNER JOIN torrents ON snatched.tid = torrents.id
LEFT JOIN completed ON snatched.tid = completed.torrentid AND snatched.uid = completed.userid
WHERE
users.enabled = 'yes' AND users.status = 'confirmed' AND
torrents.banned = 'no' AND snatched.tid = '$tid' $limit";
?>
<div align="center"><b>Type: <?php echo $type; ?></b></div>
<div align="center"><b>Torrent ID: <?php echo $tid; ?></b></div>
<div align="center"><b>UserID: <?php echo $uid; ?></b></div>
<div align="center"><b>Torrent Count: <?php echo $count_tid; ?></b></div>
<div align="center"><b>User Count: <?php echo $count_uid; ?></b></div>
<div align="left"><b>Query: </b><?php echo $qry1; ?></div>
<?php
end_frame();
}
//===| Start Torrents Snatched
if ($type == 'torrent') {
if ($count_tid > 0) {
$torrent = SQL_Query_exec("SELECT `name` FROM `torrents` WHERE `id` = '$tid'");
$torrents = mysql_fetch_row($torrent);
$title = sprintf(T_("SNATCHLIST_FOR"), htmlspecialchars($torrents[0]));
stdhead($title);
begin_frame($title);
$perpage = 50;
list($pagertop, $pagerbottom, $limit) = pager($perpage, $count_tid, 'snatched.php?tid='.$tid.' &');
$qry = "SELECT
users.id,
users.username,
users.class,
snatched.uid as uid,
snatched.tid as tid,
snatched.uload,
snatched.dload,
snatched.stime,
snatched.utime,
snatched.ltime,
snatched.completed,
snatched.hnr,
(
SELECT seeder
FROM peers
WHERE torrent = tid AND userid = uid LIMIT 1
) AS seeding
FROM
snatched
INNER JOIN users ON snatched.uid = users.id
INNER JOIN torrents ON snatched.tid = torrents.id
WHERE
users.enabled = 'yes' AND users.status = 'confirmed' AND
torrents.banned = 'no' AND snatched.tid = '$tid'
ORDER BY stime DESC $limit";
$res = SQL_Query_exec($qry);
print("<div style='margin-top:10px; margin-bottom:5px'>[<a href=torrents-details.php?id=$tid><b>Back to Torrent</b></a>]</div>");
if ($count_tid > $perpage) {
echo ($pagertop);
}
if (mysql_num_rows($res) > 0):
?>
<table border="0" class="table_table" cellpadding="4" cellspacing="0" width="100%">
<tr>
<th class="table_head" align="left"><?php echo T_("USERNAME"); ?></th>
<th class="table_head" align="left"><?php echo T_("UPLOADED"); ?></th>
<th class="table_head" align="left"><?php echo T_("DOWNLOADED"); ?></th>
<th class="table_head"><?php echo T_("STARTED"); ?></th>
<th class="table_head"><?php echo T_("LAST_ACTION"); ?></th>
<th class="table_head" colspan="2"><?php echo T_("COMPLETED"); ?></th>
<th class="table_head"><?php echo T_("SEEDING"); ?></th>
<th class="table_head"><?php echo T_("SEED_TIME"); ?></th>
<th class="table_head"> H&R </th>
</tr>
<?php
while ($row = mysql_fetch_row($res)):
$startdate = utc_to_tz(get_date_time($row[7]));
$lastaction = utc_to_tz(get_date_time($row[8]));
$a = SQL_Query_exec("SELECT date FROM completed WHERE userid = $row[0] AND torrentid = $row[4]");
$b = mysql_fetch_row($a);
$comtime = utc_to_tz($b[0]);
if ($row[10] != "0") {
$ctime = date('d.M.Y H:i', sql_timestamp_to_unix_timestamp($comtime));
} else {
$ctime = "---";
}
if ($row[11] != "yes") {
$hnr = "No";
} else {
$hnr = "<font color=#FF1200><b>Yes</b></font>";
}
if ($row[12] != "yes") {
$seed = "No";
} else {
$seed = "<font color=#27B500><b>Yes</b></font>";
}
?>
<tr align="center">
<td class="table_col1" align="left"><a href="account-details.php?id=<?php echo $row[0]; ?>"><b><?php echo class_user($row[1]); ?></b></a></td>
<td class="table_col2" align="left"><font color="#27B500"><?php echo mksize($row[5]); ?></font></td>
<td class="table_col1" align="left"><font color="#FF1200"><?php echo mksize($row[6]); ?></font></td>
<td class="table_col2"><?php echo date('d.M.Y H:i', sql_timestamp_to_unix_timestamp($startdate)); ?></td>
<td class="table_col1"><?php echo date('d.M.Y H:i', sql_timestamp_to_unix_timestamp($lastaction)); ?></td>
<td class="table_col2"><?php echo ($row[10]) ? "<font color=#0080FF><b>".T_("YES")."</b></font>" : "".T_("NO").""; ?></td>
<td class="table_col1"><?php echo $ctime; ?></td>
<td class="table_col2"><?php echo $seed; ?></td>
<td class="table_col1"><?php echo ($row[9]) ? mkprettytime($row[9]) : '---'; ?></td>
<td class="table_col2"><?php echo $hnr; ?></td>
</tr>
<?php
endwhile;
?>
</table>
<?php
if ($count_tid > $perpage) {
echo ($pagerbottom);
}
print("<div style='margin-top:5px; margin-bottom:10px' align='right'>[<a href=torrents-details.php?id=$tid><b>Back to Torrent</b></a>]</div>");
endif;
end_frame();
stdfoot();
die;
} else {
if ($tid >= 1) {
$torrent = SQL_Query_exec("SELECT `name` FROM `torrents` WHERE `id` = '$tid'");
$torrents = mysql_fetch_row($torrent);
$ttitle = sprintf(T_("SNATCHLIST_FOR"), htmlspecialchars($torrents[0]));
if ($torrents[0] == '') {
$ttitle = sprintf("There is no torrent with ID: $tid");
}
stdhead($ttitle);
begin_frame($ttitle);
?>
<div style="margin-top:10px; margin-bottom:10px" align="center"><font size="2"><?php echo T_("WAITING_FOR_STATS");?></font></div>
<div style="margin-bottom:10px" align="center">[<?php echo "<a href=torrents-details.php?id=$tid>";?><b>Back to Torrent</b></a>]</div>
<?php
end_frame();
stdfoot();
die;
}
}
}
//===| End Torrents Snatched
else {
//===| Start Users Snatched
if ($count_uid > 0) {
$user = SQL_Query_exec("SELECT `username` FROM `users` WHERE `id` = '$uid'");
$users = mysql_fetch_row($user);
$title = sprintf(T_("SNATCHLIST_FOR"), htmlspecialchars($users[0]));
$title2 = sprintf(T_("SNATCHLIST_FOR"), class_user($users[0]));
stdhead($title);
begin_frame($title2);
if (($CURUSER["control_panel"] == "no") && $CURUSER["id"] != $uid) {
show_error_msg("No Permission", "You do not have permission to be here.", 0);
end_frame();
stdfoot();
die;
}
$perpage = 50;
list($pagertop, $pagerbottom, $limit) = pager($perpage, $count_uid, 'snatched.php?uid='.$uid.' &');
$qry = "SELECT
snatched.tid as tid,
torrents.name,
snatched.uload,
snatched.dload,
snatched.stime,
snatched.utime,
snatched.ltime,
snatched.completed,
snatched.hnr,
(
SELECT seeder
FROM peers
WHERE torrent = tid AND userid = $uid LIMIT 1
) AS seeding
FROM
snatched
INNER JOIN users ON snatched.uid = users.id
INNER JOIN torrents ON snatched.tid = torrents.id
WHERE
users.enabled = 'yes' AND users.status = 'confirmed' AND
torrents.banned = 'no' AND snatched.uid = '$uid'
ORDER BY stime DESC $limit";
$res = SQL_Query_exec($qry);
if ( $uid == $CURUSER[id] )
print("<div style='margin-top:10px; margin-bottom:5px'>[<a href=account.php><b>Back to Profile</b></a>]</div>");
else
print("<div style='margin-top:10px; margin-bottom:5px'>[<a href=account-details.php?id=$uid><b>Back to Profile</b></a>]</div>");
if ($count_uid > $perpage) {
echo $pagertop;
}
if (mysql_num_rows($res) > 0):
?>
<table border="0" class="table_table" cellpadding="4" cellspacing="0" width="100%">
<tr>
<th class="table_head" align="left"><?php echo T_("NAME"); ?></th>
<th class="table_head" align="left"><?php echo T_("UPLOADED"); ?></th>
<th class="table_head" align="left"><?php echo T_("DOWNLOADED"); ?></th>
<th class="table_head"><?php echo T_("STARTED"); ?></th>
<th class="table_head"><?php echo T_("LAST_ACTION"); ?></th>
<th class="table_head" colspan="2"><?php echo T_("COMPLETED"); ?></th>
<th class="table_head"><?php echo T_("SEEDING"); ?></th>
<th class="table_head"><?php echo T_("SEED_TIME"); ?></th>
<th class="table_head"> H&R </th>
</tr>
<?php
while ($row = mysql_fetch_row($res)):
$startdate = utc_to_tz(get_date_time($row[4]));
$lastaction = utc_to_tz(get_date_time($row[5]));
$a = SQL_Query_exec("SELECT date FROM completed WHERE userid = $uid AND torrentid = $row[0]");
$b = mysql_fetch_row($a);
$comtime = utc_to_tz($b[0]);
if ($row[7] != "0") {
$ctime = date('d.M.Y H:i', sql_timestamp_to_unix_timestamp($comtime));
} else {
$ctime = "---";
}
if ($row[8] != "yes") {
$hnr = "No";
} else {
$hnr = "<font color=#FF1200><b>Yes</b></font>";
}
if ($row[9] != "yes") {
$seed = "No";
} else {
$seed = "<font color=#27B500><b>Yes</b></font>";
}
?>
<tr align="center">
<td class="table_col1" align="left"><a href="torrents-details.php?id=<?php echo $row[0]; ?>"><?php echo $row[1]; ?></a></td>
<td class="table_col2" align="left"><font color="#27B500"><?php echo mksize($row[2]); ?></font></td>
<td class="table_col1" align="left"><font color="#FF1200"><?php echo mksize($row[3]); ?></font></td>
<td class="table_col2"><?php echo date('d.M.Y H:i', sql_timestamp_to_unix_timestamp($startdate)); ?></td>
<td class="table_col1"><?php echo date('d.M.Y H:i', sql_timestamp_to_unix_timestamp($lastaction)); ?></td>
<td class="table_col2"><?php echo ($row[7]) ? "<font color=#0080FF><b>".T_("YES")."</b></font>" : "".T_("NO").""; ?></td>
<td class="table_col1"><?php echo $ctime; ?></td>
<td class="table_col2"><?php echo $seed; ?></td>
<td class="table_col1"><?php echo ($row[6]) ? mkprettytime($row[6]) : '---'; ?></td>
<td class="table_col2"><?php echo $hnr; ?></td>
</tr>
<?php
endwhile;
?>
</table>
<?php
if ($count_uid > $perpage) {
echo $pagerbottom;
}
if ( $uid == $CURUSER[id] )
print("<div style='margin-top:5px; margin-bottom:10px' align='right'>[<a href=account.php><b>Back to Profile</b></a>]</div>");
else
print("<div style='margin-top:5px; margin-bottom:10px' align='right'>[<a href=account-details.php?id=$uid><b>Back to Profile</b></a>]</div>");
endif;
end_frame();
stdfoot();
die;
} else {
$user = SQL_Query_exec("SELECT `username` FROM `users` WHERE `id` = '$uid'");
$users = mysql_fetch_row($user);
$title = sprintf(T_("SNATCHLIST_FOR"), htmlspecialchars($users[0]));
if ($users[0] == '') {
$title = sprintf("There is no user with ID: $uid");
}
$title2 = sprintf(T_("SNATCHLIST_FOR"), class_user($users[0]));
if ($users[0] == '') {
$title2 = sprintf("There is no user with ID: $uid");
}
stdhead($title);
begin_frame($title2);
echo '<div style="margin-top:10px; margin-bottom:10px" align="center"><font size="2">' . T_("WAITING_FOR_STATS") . '</font></div>';
if (mysql_num_rows($user) > 0)
print("<div style='margin-bottom:10px' align='center'>[<a href=account-details.php?id=$uid><b>Back to Profile</b></a>]</div>");
end_frame();
stdfoot();
}
}
?>
[url="
http://devscorner.xyz/applications/core/interface/file/attachment.php?id=6647"]snatched.zip[/url]