Bravo List
Register
Go Back   > Bravo List > Source Code > Archived Trackers > Free Torrent Source
Reply
  #1  
Old 10th February 2010, 19:23
sri sri is offline
Member
 
Join Date: Jan 2010
India
Posts: 11
Default download count problem
Hi i am using f.t.s 1.1. source for my tracker everything goes fine expect the download ratio , it does not show me the downloaded amount for any user i even check the free leech for user group and torrent but nothing helped so can any one help me in making the ratio work for me pls
Reply With Quote
  #2  
Old 10th February 2010, 19:24
Phogo's Avatar
Phogo Phogo is offline
VIP
 
Join Date: Jan 2008
United Kingdom
Posts: 902
Default
What version are you using, cos one uses cache system that works and one doesn't
Reply With Quote
  #3  
Old 10th February 2010, 19:27
sri sri is offline
Member
 
Join Date: Jan 2010
India
Posts: 11
Default
fts_1.1 is the one i use

thanks for the reply
Reply With Quote
  #4  
Old 10th February 2010, 19:28
Phogo's Avatar
Phogo Phogo is offline
VIP
 
Join Date: Jan 2008
United Kingdom
Posts: 902
Default
The cache system doesn't work it might be that, try applying the fix posted by Benjamin
Reply With Quote
  #5  
Old 10th February 2010, 19:29
sri sri is offline
Member
 
Join Date: Jan 2010
India
Posts: 11
Default
can u pls post the link to that fix pls

thanks
Reply With Quote
  #6  
Old 10th February 2010, 19:43
Phogo's Avatar
Phogo Phogo is offline
VIP
 
Join Date: Jan 2008
United Kingdom
Posts: 902
Default
http://bvlist.com/free-torrent-sourc...gs-usable.html
Reply With Quote
  #7  
Old 10th February 2010, 19:49
sri sri is offline
Member
 
Join Date: Jan 2010
India
Posts: 11
Default
i tried that but still i get the same cache time

"This content has been last updated 2010-02-10 17:48:02. Cached every 0:00:00 "it didnt change to 0.10.00 as mentioned in the fix post

thanks
Reply With Quote
  #8  
Old 10th February 2010, 22:40
Storm6699 Storm6699 is offline
Member
 
Join Date: Dec 2009
Croatia
Posts: 9
Default
I believe that you have enabled freelech for some higher usergroups like Sysop or Owner, disable free for them and everything will be ok

or try with my announce.php with some repairs

PHP Code:
<?php
include ('include/bittorrent_announce.php');
require_once (
'include/benc.php');
function 
err$msg )
{
    
benc_resp( array('failure reason' => array(type => 'string'value => $msg)) ) ;
    exit() ;
}
function 
benc_resp$d )
{
    
benc_resp_rawbenc(array(type => 'dictionary'value => $d)) ) ;
}
function 
benc_resp_raw$x )
{

    
header"Content-Type: text/plain" ) ;
    
header"Pragma: no-cache" ) ;

    if ( 
$_SERVER["HTTP_ACCEPT_ENCODING"] == "gzip" )
    {
        
header"Content-Encoding: gzip" ) ;
        echo 
gzencode$x9FORCE_GZIP ) ;
    }
    else
        echo 
$x ;
}
foreach (array(
"passkey""info_hash""peer_id""event""ip""localip") as $x) {
    if (isset(
$_GET["$x"]))
        
$GLOBALS[$x] = "" $_GET[$x];
}
foreach (array(
"port""downloaded""uploaded""left") as $x) {
    
$GLOBALS[$x] = $_GET[$x];
}

if (
strpos($passkey"?")) {
    
$tmp substr($passkeystrpos($passkey"?"));
    
$passkey substr($passkey0strpos($passkey"?"));
    
$tmpname substr($tmp1strpos($tmp"=") - 1);
    
$tmpvalue substr($tmpstrpos($tmp"=") + 1);
    
$GLOBALS[$tmpname] = $tmpvalue;

}

foreach (array(
"passkey""info_hash""peer_id""port""downloaded",
    
"uploaded""left") as $x)
    if (!isset(
$x))
        
err("Missing key: $x");
foreach (array(
"info_hash""peer_id") as $x)
    if (
strlen($GLOBALS[$x]) != 20)
        
err("Invalid $x (" strlen($GLOBALS[$x]) . " - " urlencode($GLOBALS[$x]) .
            
")");
if (
strlen($passkey) != 32)
    
err("Invalid passkey (" strlen($passkey) . " - $passkey)");
$ip ip::getip();
$rsize 50;

foreach (array(
"num want""numwant""num_want") as $k) {
    if (isset(
$_GET[$k])) {
        
$rsize $_GET[$k];
        break;
    }
}

// BLOCK ACCESS WITH WEB BROWSERS AND CHEATS!

$agent $_SERVER["HTTP_USER_AGENT"];
if (
ereg("^Mozilla\/"$agent) || ereg("^Opera\/"$agent) || ereg("^Links "$agent) ||
    
ereg("^Lynx\/"$agent))
    
err("torrent not registered with this tracker");

if (!
$port || $port 0xffff)
    
err("invalid port");

if (!isset(
$event))
    
$event "";

$seeder = ($left == 0) ? "yes" "no";

$valid = @mysql_query("SELECT COUNT(*) FROM users WHERE passkey=" sqlesc($passkey)) or
    
err(mysql_error());
$valid = @mysql_fetch_row($valid);

if (
$valid[0] != 1)
    
err("Invalid passkey! Re-download the .torrent from $BASEURL");

$res mysql_query("SELECT id, name, category, banned, free, doubleupload, seeders + leechers AS numpeers, UNIX_TIMESTAMP(added) AS ts FROM torrents WHERE " .
    
hash_where("info_hash"$info_hash));

$torrent mysql_fetch_assoc($res);

if (!
$torrent)
    
err("torrent not registered with this tracker");

$torrentid $torrent["id"];
$torrentname $torrent["name"];
$torrentcategory $torrent["category"];
$fields "seeder, peer_id, ip, port, uploaded, downloaded, userid, last_action,  UNIX_TIMESTAMP(NOW()) AS nowts, UNIX_TIMESTAMP(prev_action) AS prevts";
$numpeers $torrent["numpeers"];
$limit "";
if (
$numpeers $rsize)
    
$limit "ORDER BY RAND() LIMIT $rsize";
$res mysql_query("SELECT $fields FROM peers WHERE torrent = $torrentid");
    global 
$announce_interval;
    
$resp "d" benc_str("interval") . "i" $announce_interval "e" benc_str("peers") . "l";
unset(
$self);
while (
$row mysql_fetch_assoc($res)) {
    
$row["peer_id"] = hash_pad($row["peer_id"]);

    if (
$row["peer_id"] === $peer_id) {
        
$userid $row["userid"];
        
$self $row;
        
//continue;
    //} // pomaknuo iza retka $hasfreeleech (jer inace gleda freeleech od zadnjeg peera, a ne usera koji salje announce)
    
$a = @mysql_query("SELECT class FROM users WHERE id = '$userid'");
    
$a = @mysql_fetch_assoc($a);
    
$b = @mysql_query("SELECT hasfreeleech FROM usergroups WHERE id = $a[class]");
    
$b = @mysql_fetch_assoc($b);
    
$hasfreeleech $b['hasfreeleech'];
    continue;
    }


    
$resp .= "d" benc_str("ip") . benc_str($row["ip"]) . benc_str("peer id") .
        
benc_str($row["peer_id"]) . benc_str("port") . "i" $row["port"] . "e" "e";
}

$resp .= "ee";
$selfwhere "torrent = $torrentid AND " hash_where("peer_id"$peer_id);

if (!isset(
$self)) {
    
$res mysql_query("SELECT $fields FROM peers WHERE $selfwhere");
    
$row mysql_fetch_assoc($res);
    if (
$row) {
        
$userid $row["userid"];
        
$self $row;
    }
}

if (
function_exists('getallheaders'))
    
$headers getallheaders();
else
    
$headers emu_getallheaders();

if (isset(
$headers["Cookie"]) || isset($headers["Accept-Language"]) || isset($headers["Accept-Charset"]))
    
err("Anti-Cheater= You cannot use this agent");


$announce_wait 10;
if (isset(
$self) && ($self['prevts'] > ($self['nowts'] - $announce_wait)))
    
err('There is a minimum announce time of ' $announce_wait ' seconds');

if (!isset(
$self)) {
    
$valid = @mysql_fetch_row(@mysql_query("SELECT COUNT(*) FROM peers WHERE torrent=$torrentid AND passkey=" .
        
sqlesc($passkey)));
    if (
$valid[0] >= && $seeder == 'no')
        
err("Connection limit exceeded! You may only leech from one location at a time.");
    if (
$valid[0] >= && $seeder == 'yes')
        
err("Connection limit exceeded!");

    
$rz mysql_query("SELECT id, uploaded, downloaded, class, parked FROM users WHERE passkey=" .
        
sqlesc($passkey) . " AND enabled = 'yes' ORDER BY last_access DESC LIMIT 1") or
        
err("Tracker error 2");
    if (
$MEMBERSONLY == "yes" && mysql_num_rows($rz) == 0)
        
err("Unknown passkey. Please redownload the torrent from $BASEURL. a");
    
$az mysql_fetch_assoc($rz);
    
$userid $az["id"];
    if (
$az["class"] < UC_VIP) {
        if (
$waitsystem == "yes") {
            
$gigs $az["uploaded"] / (1024 1024 1024);
            
$elapsed floor((gmtime() - $torrent["ts"]) / 3600);
            
$ratio = (($az["downloaded"] > 0) ? ($az["uploaded"] / $az["downloaded"]) : 1);
            if (
$ratio 0.5 || $gigs 5)
                
$wait 48;
            elseif (
$ratio 0.65 || $gigs 6.5)
                
$wait 24;
            elseif (
$ratio 0.8 || $gigs 8)
                
$wait 12;
            elseif (
$ratio 0.95 || $gigs 9.5)
                
$wait 6;
            else
                
$wait 0;
            if (
$elapsed $wait)
                
err("Not authorized (" . ($wait $elapsed) . "h) - READ THE FAQ!");
        } 
/*-do tu*/
        
if ($maxdlsystem == "yes") {
            if (
$ratio 0.5 || $gigs 5)
                
$max 1;
            elseif (
$ratio 0.65 || $gigs 6.5)
                
$max 2;
            elseif (
$ratio 0.8 || $gigs 8)
                
$max 3;
            elseif (
$ratio 0.95 || $gigs 9.5)
                
$max 4;
            else
                
$max 0;
            if (
$max 0) {
                
$res mysql_query("SELECT COUNT(*) AS num FROM peers WHERE userid='$userid' AND seeder='no'") or
                    
err("Tracker error 5");
                
$row mysql_fetch_assoc($res);
                if (
$row['num'] >= $max)
                    
err("Not authorized (You are downloading your maximum number of allowed torrents - $max)");
            }
        }
    }
} else {
    
$upthis max(0$uploaded $self["uploaded"]);
    
$downthis max(0$downloaded $self["downloaded"]);
    if (
$hasfreeleech == 'yes')
        
$downthis 0;
    if (
$torrent['free'] == 'yes')
        
$downthis 0;
    if (
$torrent['doubleupload'] == 'yes')
        
$upthis *= 2;
if (
$upthis || $downthis 0)
        
mysql_query("UPDATE users SET uploaded = uploaded + $upthis". ($torrent['free']=='no'?", downloaded = downloaded + $downthis ":' '). "WHERE id=$userid") or err("Tracker error 3");
}

$uagent $_SERVER['HTTP_USER_AGENT'];
$bua mysql_query("SELECT agent FROM banned_agent") or err('Tracker error (1)');
while (
$nea mysql_fetch_array($bua)) {
    
$n $nea['agent'];
    
$nr preg_replace("/\//""\/"$n);
    
$neadle "/\b$nr\b/i";
    if (
preg_match($neadle$uagent))
        
err("Banned Client, Please goto $BASEURL for a list of acceptable clients");
}
if (
ereg("^BitTorrent\/S-"$agent))
    
err("Shadow's Experimental Client is Banned. Please use uTorrent.");
if (
ereg("^ABC\/ABC"$agent))
    
err("ABC is Banned. Please use uTorrent.");
if (
ereg("^Python-urllib\/2.4"$agent))
    
err("Banned Client. Please use uTorrent.");

#getoutofmysite($peer_id);
$dt gmtime() - 180;
$dt sqlesc(get_date_time($dt));

$updateset = array();

if (
$event == "stopped") {
    if (isset(
$self)) {
        
mysql_query("UPDATE snatched SET seeder = 'no', connectable='no' WHERE torrent = $torrentid AND userid = $userid");
        
mysql_query("DELETE FROM peers WHERE $selfwhere");
        if (
mysql_affected_rows()) {
            if (
$self["seeder"] == "yes")
                
$updateset[] = "seeders = seeders - 1";
            else
                
$updateset[] = "leechers = leechers - 1";
        }
    }
} else {
    if (
$event == "completed") {
        
mysql_query("UPDATE torrent_hit SET  completed  = 'yes' WHERE id = $torrentid AND uid = $userid");
        
mysql_query("UPDATE snatched SET  finished  = 'yes', completedat = $dt WHERE torrent = $torrentid AND userid = $userid");
        
$updateset[] = "times_completed = times_completed + 1";

    }

    if (isset(
$self)) {
        
$res mysql_query("SELECT uploaded, downloaded FROM snatched WHERE torrent = $torrentid AND userid = $userid");
        
$row mysql_fetch_array($res);
        
$sockres = @pfsockopen($ip$port$errno$errstr5);
        if (!
$sockres)
            
$connectable "yes";
        else {
            
$connectable "yes";
            @
fclose($sockres);
        }
        
$downloaded2 $downloaded $self["downloaded"];
        
$uploaded2 $uploaded $self["uploaded"];
        
mysql_query("UPDATE snatched SET uploaded = uploaded+$uploaded2, downloaded = downloaded+$downloaded2, port = $port, connectable = '$connectable', agent= " .
            
sqlesc($agent) . ", to_go = $left, last_action = $dt, seeder = '$seeder' WHERE torrent = $torrentid AND userid = $userid");
        
$prev_action sqlesc($self['last_action']);

        
mysql_query("UPDATE peers SET uploaded = $uploaded, downloaded = $downloaded, to_go = $left, last_action = NOW(), prev_action = $prev_action, seeder = '$seeder'" .
            (
$seeder == "yes" && $self["seeder"] != $seeder ", finishedat = " time() :
            
"") . " WHERE $selfwhere");
        if (
mysql_affected_rows() && $self["seeder"] != $seeder) {
            if (
$seeder == "yes") {
                
$updateset[] = "seeders = seeders + 1";
                
$updateset[] = "leechers = leechers - 1";
            } else {
                
$updateset[] = "seeders = seeders - 1";
                
$updateset[] = "leechers = leechers + 1";
            }
        }
    } else {
        if (
$az["parked"] == "yes")
            
err("Error, your account is parked!");

      
#  if (portblacklisted($port))
       #     err("Port $port is blacklisted.");
        
else {
            
$sockres = @pfsockopen($ip$port$errno$errstr5);
            if (!
$sockres) {
                
$connectable "yes";
                if (
$nc == "yes")
                    
err("ERROR - Your client are not connectable! Check your Port-configuration or ask an administartor or search on forums.");
            } else {
                
$connectable "yes";
                @
fclose($sockres);
            }
        }

        
$res mysql_query("SELECT torrent, userid FROM snatched WHERE torrent = $torrentid AND userid = $userid");
        
$check mysql_fetch_assoc($res);
        if (!
$check)
            
mysql_query("INSERT INTO snatched (torrent, torrentid, userid, port, startdat, last_action, agent, torrent_name, torrent_category) VALUES ($torrentid$torrentid$userid$port$dt$dt, " .
                
sqlesc($agent) . ", " sqlesc($torrentname) . ", $torrentcategory)");
        
$ret mysql_query("INSERT INTO peers (connectable, torrent, peer_id, ip, port, uploaded, downloaded, to_go, started, last_action, seeder, userid, agent, uploadoffset, downloadoffset, passkey) VALUES ('$connectable', $torrentid, " .
            
sqlesc($peer_id) . ", " sqlesc($ip) . ", $port$uploaded$downloaded$left, NOW(), NOW(), '$seeder', $userid, " .
            
sqlesc($agent) . ", $uploaded$downloaded, " sqlesc($passkey) . ")");
        if (
$ret) {
            if (
$seeder == "yes")
                
$updateset[] = "seeders = seeders + 1";
            else
                
$updateset[] = "leechers = leechers + 1";
        }
    }
}

if (
$seeder == "yes") {
    if (
$torrent["banned"] != "yes")
        
$updateset[] = "visible = 'yes'";
    
$updateset[] = "last_action = NOW()";
}

if (
count($updateset))
    
mysql_query("UPDATE torrents SET " join(","$updateset) . " WHERE id = $torrentid");

$select_client mysql_query("SELECT * FROM clientselect WHERE name='" $agent .
    
"'");
if (
mysql_num_rows($select_client) == 0) {
    
$insert = @mysql_query("INSERT INTO clientselect (name) VALUES ('" $agent .
        
"')");
    
$client_id mysql_insert_id();
} else {
    
$client_row = @mysql_fetch_array($select_client);
    
$client_id $client_row['id'];
}

$agent_user_add = @mysql_query("UPDATE users SET clientselect='" $client_id .
    
"' where id='" $userid "'");
benc_resp_raw($resp);

if (
$uploaded || $downloaded 0) {
    
$upthis max(0$uploaded - @$self["uploaded"]);
    
$downthis max(0$downloaded - @$self["downloaded"]);
    
mysql_query("UPDATE anti_cheat SET uploaded = uploaded + $upthis, downloaded = downloaded + $downthis WHERE user_id = $userid AND torrent_id = $torrentid");
    if (
mysql_affected_rows() == 0) {
        
mysql_query("INSERT INTO anti_cheat (user_id, torrent_id, uploaded, downloaded ) VALUES ( $userid$torrentid$upthis$downthis )");
    }
}
if(!
function_exists("getallheaders")) {
    function 
emu_getallheaders() {
   foreach(
$_SERVER as $name => $value)
       if(
substr($name05) == 'HTTP_')
           
$headers[substr($name5)] = $value;
   return 
$headers;
}
}
?>
Reply With Quote
  #9  
Old 11th February 2010, 03:32
sri sri is offline
Member
 
Join Date: Jan 2010
India
Posts: 11
Default
thanks i will try that inform u

thanks for the reply

Bump: Storm6699 i tried ur annouce.php and i get this error in my bittorrent client in the tracker status


Error: invalid bencoding of tracker response: "<br />0x10 <b>Warning</b>: Unknown: failed to open stream: Permission denied in <b>Unknown</b> on line <b>0</b><br />0x10 <br />0x10 <b>Fatal error</b>: Unknown: Failed opening required '/var/www/announce.php' (include_path='.:/usr/share/php:/usr/share/pear') in <b>Unknown</b> on line <b>0</b><br />0x10 "
Reply With Quote
Reply

Tags
count , download , problem

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
download problem inthel Community Cafe 0 7th February 2009 14:58
download problem tunad Torrent Strike 8 5th February 2009 18:04
Hard link count is wrong Fynnon Community Cafe 1 4th November 2008 18:55
stats count error trilious Template Shares 2 13th August 2008 22:54
Download problem snakebite TBDev 9 1st July 2008 22:44



All times are GMT +2. The time now is 02:22. vBulletin skin by ForumMonkeys. Powered by vBulletin® Version 3.8.11 Beta 3
Copyright ©2000 - 2024, vBulletin Solutions Inc.