TBDev Forum
Programming board
Main Page Forum Rules Privacy Policy Members Contact Us
Welcome Guest (Login | Register)
TBDev Forum TBDev.net - Mods & hacks Mods In Progress True User ratio displayed per torrent download

True User ratio displayed per torrent download

2006-08-24 13:40:00
Group: Member
Posts: 70
Topics participated: 33
Topics started: 10
First post: 2006-03-02 22:59:00
Last post: 2006-10-12 12:18:00
Here is a script i have been working on for the last day!
But the code have a litle bug in there!( look on the on the pic.!


Name: kd.GIF

I work on the bug to clean!
Maybe can help me to work this code??? :)
here the code:

open details.php an find this:

$keepget = "";


and add above this:

/////// completed_by hack based on more complex snatched list/////////////

 
2006-08-25 12:55:00
Group: Member
Posts: 6
Topics participated: 4
Topics started: 0
First post: 2006-04-24 01:35:00
Last post: 2007-07-28 20:09:00
which bug do you mean?

welchen Fehler meinst du? ^^
 
2006-08-25 01:17:00
Group: Member
Posts: 70
Topics participated: 33
Topics started: 10
First post: 2006-03-02 22:59:00
Last post: 2006-10-12 12:18:00
look on the leecher list!
This user have dont snatched the torrent but he shows by the last 50 Snatcher!!
This is not ok,but i cant find the bug!!
 
2006-08-25 01:49:00
Group: Member
Posts: 1462
Topics participated: 667
Topics started: 22
First post: 2006-02-25 13:08:00
Last post: 2008-12-29 14:13:00
$snatched_res = mysql_query("SELECT DISTINCT snatched.userid, users.username, users.warned FROM snatched INNER JOIN users ON snatched.userid = users.id INNER JOIN torrents ON snatched.torrentid = torrents.id WHERE snatched.finished='yes' AND snatched.torrentid = $id ORDER BY snatched.id DESC LIMIT 50");


adding in

snatched.finished='yes'

should fix it
 
2006-08-25 13:35:00
Group: Member
Posts: 6
Topics participated: 4
Topics started: 0
First post: 2006-04-24 01:35:00
Last post: 2007-07-28 20:09:00
But i believe thats not a bug. If there are some separate files in thattorrent and a user leech only one sample or nfo file, his client send a "complete" and add him to your snatchlist
 
2006-08-25 14:26:00
Group: Member
Posts: 70
Topics participated: 33
Topics started: 10
First post: 2006-03-02 22:59:00
Last post: 2006-10-12 12:18:00
thx wilba now is working!

Thank you!

Now a Admin can the code post to comepelte mods??
 
2006-08-31 22:22:00
Group: Member
Posts: 162
Topics participated: 70
Topics started: 23
First post: 2006-08-24 12:54:00
Last post: 2008-06-30 21:33:00
hi tnx for this mod.

Only i get this error:

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/torrentwood.be/www/details.php on line 707


can someone help me with this???

greetz
 
2006-09-01 16:16:00
Group: Member
Posts: 70
Topics participated: 33
Topics started: 10
First post: 2006-03-02 22:59:00
Last post: 2006-10-12 12:18:00
post your details.php please
 
\n");
}

//end/////// completed_by hack based on more complex snatched list/////////////
$uprow = (isset($row["username"]) ? ("" . htmlspecialchars($row["username"]) . "") : "Unbekannt");

if ($owned)
$uprow .= " $spacer<$editlink>[Diesen Torrent bearbeiten]";

tr("Hochgeladen von", $uprow, 1);

if ($row["type"] == "multi") {
if (!$_GET["filelist"])
tr("Anzahl Dateien
[Liste anzeigen]", $row["numfiles"] . " Dateien", 1);
else {
tr("Anzahl Dateien", $row["numfiles"] . " Dateien", 1);

$s = "
2006-10-03 08:00:00
Group: Member
Posts: 53
Topics participated: 32
Topics started: 11
First post: 2006-03-10 11:51:00
Last post: 2007-09-26 22:50:00
I got en Error in my details .php

Heres my error


Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/tracker/details.php on line 340

and here my detaisl.php

/*if (!$_GET["snatcher"]) {
tr("Letzte 10
[Alle anzeigen]", $last10users, 1);
} else {
tr("Fertiggestellt
(Benutzer)
[Liste verbergen]", $last10users, 1);
}*/

$keepget = "";
/////// completed_by hack based on more complex snatched list/////////////

if ($row["times_completed"] != 0)
{
echo("
Letzen 20 Downloader");


$snatched_res = mysql_query("SELECT DISTINCT snatched.userid, users.username, users.warned FROM snatched INNER JOIN users ON snatched.userid = users.id INNER JOIN torrents ON snatched.torrentid = torrents.id WHERE snatched.finished='yes' AND snatched.torrentid = $id ORDER BY snatched.id DESC LIMIT 50");
$counter=0;
while ($snatched_row = mysql_fetch_array($snatched_res))
{
$snatch_stats_res = mysql_query("SELECT IF(downloaded <> 0, uploaded/downloaded, 'Inf.') AS ratio FROM snatched WHERE userid=$snatched_row[userid] AND torrentid=" . sqlesc($_GET["id"]));

if (mysql_num_rows($snatch_stats_res) > 0)
$snatch_stats_row = mysql_fetch_array($snatch_stats_res);
else
$snatch_stats_row["ratio"] = "";


if ($snatch_stats_row["ratio"] != "Inf.")

echo("" . $snatched_row["username"] . (($snatch_stats_row["ratio"] != "") ? "(" . number_format($snatch_stats_row["ratio"], 2) . ")" : "") . "" . (($snatched_row["warned"] == "yes") ? "" : "") . "");


else

echo("" . $snatched_row["username"] . (($snatch_stats_row["ratio"] != "") ? "(" . $snatch_stats_row["ratio"] . ")" : "") . (($snatched_row["warned"] == "yes") ? "" : "") . "");
echo " ";
$counter++;



if ($counter==8) {echo"
";$counter=1;}
}
echo ("
\n";
 
2006-12-31 10:43:00
Group: Member
Posts: 122
Topics participated: 39
Topics started: 5
First post: 2006-12-01 18:58:00
Last post: 2007-09-29 19:19:00
Hi can someone help me please

in details
the torrents completed is not showing?

only snached is but cant see who is having the torrent






ob_start("ob_gzhandler");

require_once("include/bittorrent.php");

hit_start();

// get agent
function getagent($httpagent)
{
return ($httpagent != "" ? $httpagent : "---");
}


function dltable($name, $arr, $torrent)
{

global $CURUSER;
$s = "" . count($arr) . " $name\n";
if (!count($arr))
return $s;
$s .= "\n";
$s .= "\n";
$s .= "" .
"".
"".
"".
"" .
"" .
"" .
"" .
"" .
"" .
"\n";
$now = time();
$moderator = (isset($CURUSER) && get_user_class() >= UC_MODERATOR);
$mod = get_user_class() >= UC_MODERATOR;
foreach ($arr as $e) {


// user/ip/port
// check if anyone has this ip
($unr = mysql_query("SELECT username, privacy FROM users WHERE id=$e[userid] ORDER BY last_access DESC LIMIT 1")) or die;
$una = mysql_fetch_array($unr);
if ($una["privacy"] == "strong") continue;
$s .= "\n";
if ($una["username"])
$s .= "\n";
else
$s .= "\n";
$secs = max(1, ($now - $e["st"]) - ($now - $e["la"]));
$revived = $e["revived"] == "yes";
$s .= "\n";
$s .= "\n";
$s .= "\n";
$s .= "\n";
if ($e["seeder"] == "no")
$s .= "\n";
else
$s .= "\n";
if ($e["downloaded"])
{
$ratio = floor(($e["uploaded"] / $e["downloaded"]) * 1000) / 1000;
$s .= "\n";
}
else
if ($e["uploaded"])
$s .= "\n";
else
$s .= "\n";
$s .= "\n";
$s .= "\n";
$s .= "\n";
$s .= "\n";
$s .= "\n";
}
$s .= "
Gebruiker/IPVerbindbaarGeuploadSnelheidGedownloadSnelheidRatioCompleetVerbondenIdleClient
$una[username]" . ($mod ? $e["ip"] : preg_replace('/\.\d+$/', ".xxx", $e["ip"])) . "" . ($e[connectable] == "yes" ? "Ja" : "Nee") . "" . mksize($e["uploaded"]) . "" . mksize(($e["uploaded"] - $e["uploadoffset"]) / $secs) . "/s" . mksize($e["downloaded"]) . "" . mksize(($e["downloaded"] - $e["downloadoffset"]) / $secs) . "/s" . mksize(($e["downloaded"] - $e["downloadoffset"]) / max(1, $e["finishedat"] - $e[st])) . "/s" . number_format($ratio, 3) . "Inf.---" . sprintf("%.2f%%", 100 * (1 - ($e["to_go"] / $torrent["size"]))) . "" . mkprettytime($now - $e["st"]) . "" . mkprettytime($now - $e["la"]) . "" . htmlspecialchars(getagent($e["agent"])) . "
\n";
return $s;
}

dbconn(false);

loggedinorreturn();

hit_count();

$id = $_GET["id"];
$id = 0 + $id;
if (!isset($id) || !$id)
die();

$res = mysql_query("SELECT torrents.seeders, torrents.banned, torrents.leechers, torrents.info_hash, torrents.filename, LENGTH(torrents.nfo) AS nfosz, UNIX_TIMESTAMP() - UNIX_TIMESTAMP(torrents.last_action) AS lastseed, torrents.numratings, torrents.name, torrents.description, IF(torrents.numratings < $minvotes, NULL, ROUND(torrents.ratingsum / torrents.numratings, 1)) AS rating, torrents.owner, torrents.save_as, torrents.descr, torrents.visible, torrents.size, torrents.added, torrents.views, torrents.hits, torrents.times_completed, torrents.id, torrents.type, torrents.numfiles, torrents.nfo, torrents.url, torrents.category, torrents.nlsubs, categories.name AS cat_name, users.username FROM torrents LEFT JOIN categories ON torrents.category = categories.id LEFT JOIN users ON torrents.owner = users.id WHERE torrents.id = $id") or sqlerr();
$row = mysql_fetch_array($res);

$owned = $moderator = 0;
if (get_user_class() >= UC_MODERATOR)
$owned = $moderator = 1;
elseif ($CURUSER["id"] == $row["owner"])
$owned = 1;
//}

if (!$row || ($row["banned"] == "yes" && !$moderator))
stderr("Error", "No torrent with ID $id.");
else {
if ($_GET["hit"]) {
mysql_query("UPDATE torrents SET views = views + 1 WHERE id = $id");
if ($_GET["tocomm"])
header("Location: $BASEURL/details.php?id=$id&page=0#startcomments");
elseif ($_GET["filelist"])
header("Location: $BASEURL/details.php?id=$id&filelist=1#filelist");
elseif ($_GET["toseeders"])
header("Location: $BASEURL/details.php?id=$id&dllist=1#seeders");
elseif ($_GET["todlers"])
header("Location: $BASEURL/details.php?id=$id&dllist=1#leechers");
else
header("Location: $BASEURL/details.php?id=$id");
hit_end();
exit();
}

if (!isset($_GET["page"])) {
stdhead("Details voor Torrent \"" . $row["name"] . "\"");

if ($CURUSER["id"] == $row["owner"] || get_user_class() >= UC_MODERATOR)
$owned = 1;
else
$owned = 0;

$spacer = "       ";

if ($_GET["uploaded"]) {
print("

Met succes Geupload!

\n");
print("

Voordat je kan beginnen met seeden moet je de torrent opnieuw downloaden van de site.

\n");
}
elseif ($_GET["edited"]) {
print("

Successfully edited!

\n");
if (isset($_GET["returnto"]))
print("

Ga terug naar waar je vandaan kwam.

\n");
}
elseif (isset($_GET["searched"])) {
print("

Je zocht voor \"" . htmlspecialchars($_GET["searched"]) . "\" gaf dit resultaat:

\n");
}
elseif ($_GET["rated"])
print("

Stem toegevoegd!

\n");

$s=$row["name"];
$descrs = $row["description"];
print("

$s

\n");
print("\n");

$url = "edit.php?id=" . $row["id"];
if (isset($_GET["returnto"])) {
$addthis = "&returnto=" . urlencode($_GET["returnto"]);
$url .= $addthis;
$keepget .= $addthis;
}
$editlink = "a href=\"$url\" class=\"sublink\"";


$komm = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM comments WHERE user='$CURUSER[id]' AND torrent='$id'"));

if (get_user_class() > UC_UPLOADER)
print("");
else if($komm[0]){
print("");
}else{ print(""); }

tr("Download als", $row["save_as"]);

if (!empty($row["description"]))
print("");

function hex_esc($matches) {
return sprintf("%02x", ord($matches[0]));
}
tr("Info hash", preg_replace_callback('/./s', "hex_esc", hash_pad($row["info_hash"])));


// NL subs Mod
if ($row["nlsubs"] == "Ja")
tr("NL Subs", "", 1);
else if ($row["nlsubs"] == "Nee")
tr("NL Subs", "", 1);
//END NL SUB MOD


if ($row["url"] != "" AND $row["url"] != "Link naar een plaatje")
tr("Plaatje:", "", 1);
else
tr("Plaatje:", "", 1);


if (!empty($row["descr"]))
tr("Beschrijving", format_comment($row["descr"]), 1);


if (get_user_class() >= UC_VIP && $row["nfosz"] > 0)
print("\n");
if ($row["visible"] == "no")
tr("Zichtbaar", "Nee (dood)", 1);
if ($moderator)
tr("Verbannen", $row["banned"]);

if (isset($row["cat_name"]))
tr("Type", $row["cat_name"]);
else
tr("Type", "(Geen geselecteerd)");

tr("Laatste seeder", "Laatste activiteit " . mkprettytime($row["lastseed"]) . " geleden");
tr("Grootte",mksize($row["size"]) . " (" . number_format($row["size"]) . " bytes)");

$s = "";
$s .= "
Download" . htmlspecialchars($row["filename"]) . "
Download" . htmlspecialchars($row["filename"]) . "
DownloadJe hebt geen bedankje neer gezet klik op Voeg commentaar toe om te kunnen downloaden.
Korte beschrijving$descrs
NFOBekijk NFO (" .
mksize($row["nfosz"]) . ")
";
if (!isset($row["rating"])) {
if ($minvotes > 3) {
$s .= "geen geen (Heeft minimaal $minvotes nodig en heeft al ";
if ($row["numratings"])
$s .= "only " . $row["numratings"];
else
$s .= "geen
 

Similar threads

Topic Posts Last post
No Ratio if no Download 1 2007-03-27 21:15:00
Ratio check before you can download 129 2007-11-04 17:54:00
Crap script do so i cant download if my ratio is below XX 1 2008-07-14 16:25:00
upload & download ratio doesn't work 1 2007-01-30 14:47:00
Ratio Per Torrent 1 2006-08-06 22:22:00