My Snatches

Started by sharpie, September 20, 2013, 02:03:09 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

MelvinMeow

Find:
$res = mysql_query("SELECT COUNT(id) FROM snatched WHERE userid=".$CURUSER["id"]." AND finished='yes'") or sqlerr();

Notice the portion: finished='yes'

Remove that section or you could change it to 'no' if you wanted to show incomplete snatches.

Hope this helps. :)
I tried explaining it so you can edit it on your own to your liking.

sharpie

#1
This code displays Snatches from the snatch list what members have recently snatched but for some reason it only shows if member finished=yes i want it to show all snatches if anyone can help out Thanks in advance



<?

require_once("include/bittorrent.php");

loggedinorreturn();
stdhead();


$where = "WHERE userid = ".get_user_id()." AND finished='yes'";
$res = mysql_query("SELECT COUNT(id) FROM snatched WHERE userid=".$CURUSER["id"]." AND finished='yes'") or sqlerr();
$row = mysql_fetch_array($res);
$count = $row[0];

//print ("<h1 align=\"center\" style='margin:0px'>$CURUSER[username]'s torrents</h1>\n");


if (!$count) {
?>
<center>
<h1>No torrents</h1>
<p>You haven't snatched any torrents yet, so there's nothing in this page.</p>

<?
}
else {
//  sorting by MarkoStamcar
if ($addparam != "") {
if ($pagerlink != "") {
if ($addparam{strlen($addparam)-1} != ";") { // & = &amp;
$addparam = $addparam . "&" . $pagerlink;
} else {
$addparam = $addparam . $pagerlink;
}
}
} else {
$addparam = $pagerlink;
}
// end of sorting by MarkoStamcar
    list($pagertop, $pagerbottom, $limit) = pager(30, $count, "mysnatches.php?" . $addparam);
//// complex snatchlist mod by rightthere, oink and thebrass recreated by cue ////
$r = mysql_query("SELECT snatched.torrentid, snatched.uploaded, snatched.userid, snatched.downloaded,snatched.agent, snatched.complete_date, snatched.last_action, snatched.finished, snatched.start_date,torrents.tags,torrents.filename, torrents.seeders, torrents.leechers, UNIX_TIMESTAMP(snatched.start_date) AS st, UNIX_TIMESTAMP(snatched.last_action) AS lt, UNIX_TIMESTAMP(snatched.complete_date) AS ct, snatched.start_date FROM snatched JOIN torrents ON torrents.id = snatched.torrentid WHERE userid=".$CURUSER["id"]." AND snatched.finished='yes' ORDER BY snatched.complete_date DESC $limit") or sqlerr();
$complete = mysql_num_rows($r);

$completed = "<table align=center width=100% class=row3 border=1 cellspacing=0 cellpadding=3>\n" .
"<tr>\n" .
"<td class=colhead align=center>Name/Year</td>\n" .
"<td class=colhead width=8% align=center>Activity</td>\n" .
"<td class=colhead width=1% align=center>Seeding</td>\n" .
"<td class=colhead width=8% align=center>Client</td>\n" .
"</tr>\n";
while ($a = mysql_fetch_assoc($r)) {
$res3 = mysql_query("SELECT * FROM peers WHERE torrent=$a[torrentid] AND userid=$a[userid]") or sqlerr(__FILE__, __LINE__);
$arr3 = mysql_fetch_assoc($res3);
$r1 = mysql_query("SELECT * FROM torrents WHERE id = ". $a[torrentid] ."") or sqlerr(__FILE__, __LINE__);
$a1 = mysql_fetch_assoc($r1);
$r2 = mysql_query("SELECT name, image FROM categories WHERE id = ". $a1[category] ."") or sqlerr(__FILE__, __LINE__);
$a2 = mysql_fetch_assoc($r2);
if ($a["downloaded"] > 0) {
$ratio = number_format($a["uploaded"] / $a["downloaded"], 2);
$ratio = "<font color=" . get_ratio_color($ratio) . ">$ratio</font>";
}
else
if ($a["uploaded"] > 0)
$ratio = "Inf.";
else
$ratio = "---";
$uploaded =mksize($a["uploaded"]);
$downloaded = mksize($a["downloaded"]);
$agent = ($a["agent"]);
$cat = "<img src=\"/pic/categorypics/$a2[image]\" tilte=\"$a2[name]\" alt=\"$a2[name]\">";
$starttime = $a['start_date'];
$endtime = $a['complete_date'];
//$last_action = $a['last_action'];
$last_action = "" . get_elapsed_times(sql_timestamp_to_unix_timestamp($a["last_action"])) . " ago";
$finished = $a['finished'];
$leechtime = mkprettytime($a[ct] - $a[st]);
$seedtime = mkprettytime($a[lt] - $a[ct]);
$td = mysql_query("SELECT * FROM torrents WHERE id = ". $a[torrentid] ."");
while ($tdl = mysql_fetch_assoc($td)) {
$timesdownloaded = $a["downloaded"] / $tdl["size"];
}
/// smallname completed torrents
$smallname3 =substr(htmlspecialchars($a1["name"]) , 0, 100);
if ($smallname3 != htmlspecialchars($a1["name"])) {
$smallname3 .= '...';
}
#$smallname3 = htmlspecialchars($a1["name"]);
// smallname completed torrents end
$completed .= "<tr class=browse>\n" .
"<td><a href=details.php?id=". $a[torrentid] ."><b>$smallname3</b></a></td>\n" .
"<td align=center>$last_action</td>\n" .
"<td align=center>" . ($arr3["seeder"] == "yes" ? "<font color=green><b>Yes</b></font>" : "<font color=red><b>No</b></font>") . "</td>\n" .
"<td align=center>$agent</td>\n" .

"</tr>\n";
}
$completed .= "</table>";
//// end ////}
print($pagertop);

print("<tr valign=top><td>$completed</div></td></tr>\n");

//print($pagerbottom);
}
stdfoot();

?>