Polish Bittorrent Tracker Support

  • Maj 18, 2012, 04:03:17
  • Witamy, Gość
Zaloguj się lub zarejestruj.

Zaloguj się podając nazwę użytkownika, hasło i długość sesji
Szukanie zaawansowane  

Aktualności:

Autor Wątek: vip=freeleech how  (Przeczytany 652 razy)

0 użytkowników i 1 Gość przegląda ten wątek.

nicky

  • Zaawansowany
  • *****
  • Reputacja 3
  • Offline Offline
  • Wiadomości: 135
vip=freeleech how
« dnia: Styczeń 04, 2008, 04:56:56 »

How is that vip is all the torrents freeleech
thank's
Zapisane

nicky

  • Zaawansowany
  • *****
  • Reputacja 3
  • Offline Offline
  • Wiadomości: 135
Odp: vip=freeleech how
« Odpowiedź #1 dnia: Styczeń 04, 2008, 05:47:04 »

thank's piter you help me for change and sorry for bad section

my announce

<?

/*ob_start("ob_gzhandler");*/

require_once("include/bittorrent.php");
require_once("include/benc.php");
/*anti cheat*/
if (isset($_SERVER['HTTP_COOKIE']) || isset($_SERVER['HTTP_ACCEPT_LANGUAGE']) || isset($_SERVER['HTTP_ACCEPT_CHARSET']))
{if (isset($_GET['info_hash']) || isset($_GET['uploaded']) || isset($_GET['downloaded']) || isset($_GET['event']))
die("Anti-Cheater= You cannot use this agent!");
};
/*end anti cheat*/



function err($msg)
{
benc_resp(array("failure reason" => array(type => "string", value => $msg)));
exit();
}

function benc_resp($d)
{
benc_resp_raw(benc(array(type => "dictionary", value => $d)));
}

function benc_resp_raw($x)
{
header("Content-Type: text/plain");
header("Pragma: no-cache");
print($x);
}

foreach (array("passkey","info_hash","peer_id","ip","event") as $x)

if (ini_get('magic_quotes_gpc') == 0)
$GLOBALS[$x] = $_GET[$x];
else
$GLOBALS[$x] = stripslashes($_GET[$x]);

foreach (array("port","downloaded","uploaded","left") as $x)

$GLOBALS[$x] = 0 + $_GET[$x];
if (strpos($passkey, "?")) {

 $tmp = substr($passkey, strpos($passkey, "?"));

$passkey = substr($passkey, 0, strpos($passkey, "?"));

$tmpname = substr($tmp, 1, strpos($tmp, "=")-1);

$tmpvalue = substr($tmp, strpos($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)");

//if (empty($ip) || !preg_match('/^(d{1,3}.){3}d{1,3}$/s', $ip))

$ip = getip();

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

$agent = $_SERVER["HTTP_USER_AGENT"];

// Deny access made with a browser...
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";

dbconn(false);
$valid = @mysql_fetch_row(@mysql_query("SELECT COUNT(*) FROM users WHERE passkey=" . sqlesc($passkey)));

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


$res = mysql_query("SELECT id, name, category, banned, free, 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, last_action, peer_id, ip, port, uploaded, downloaded, userid, UNIX_TIMESTAMP(last_action) AS ts";

$numpeers = $torrent["numpeers"];
$limit = "";
if ($numpeers > $rsize)
$limit = "ORDER BY RAND() LIMIT $rsize";
$res = mysql_query("SELECT $fields FROM peers WHERE torrent = $torrentid AND connectable = 'yes' $limit");

$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;
}

$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;
}
}

//// Up/down stats ////////////////////////////////////////////////////////////

if (!isset($self))

{

$valid = @mysql_fetch_row(@mysql_query("SELECT COUNT(*) FROM peers WHERE torrent=$torrentid AND passkey=" . sqlesc($passkey)));

//if ($valid[0] >= 1 && $seeder == 'no') err("Connection limit exceeded! You may only leech from one location at a time.");

//if ($valid[0] >= 3 && $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 && mysql_num_rows($rz) == 0)

err("Unknown passkey. Please redownload the torrent from $BASEURL.");
$az = mysql_fetch_assoc($rz);
$userid = $az["id"];

// if ($left > 0 && $az["class"] < UC_VIP)
if ($az["class"] < UC_USER)
{
$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 = 0;
elseif ($ratio < 0.65 || $gigs < 6.5) $wait = 0;
elseif ($ratio < 0.8 || $gigs < 8) $wait = 0;
elseif ($ratio < 0.95 || $gigs < 9.5) $wait = 0;
else $wait = 0;
if ($elapsed < $wait)
err("Not authorized (" . ($wait - $elapsed) . "h) - READ THE FAQ!");
}
}
else
{
$start = $self["ts"];  //last_action
$end = time();  //now time
if ($end - $start < 30)  //~30 sec for local connection, ~60 sec for internet connection
   err("Sorry, minimum announce interval = 30 sec.");
   // Get the last uploaded amount from user account for reference and store it in $last_up
    $rst = mysql_query("SELECT class, uploaded FROM users WHERE id = $userid") or err("Tracker error 5");
    $art = mysql_fetch_array($rst);
    $last_up = $art["uploaded"];
    $class = $art["class"];
$upthis = max(0, $uploaded - $self["uploaded"]);
$downthis = max(0, $downloaded - $self["downloaded"]);

if ($upthis > 0 || $downthis > 0)
// Initial sanity check xMB/s for 1 second
    if($upthis > 2097152)
    {
        //Work out time difference
        $endtime = time();
        $starttime = $self['ts'];
        $diff = ($endtime - $starttime);
        //Normalise to prevent divide by zero.
        $rate = ($upthis / ($diff + 1));
        //Currently 2MB/s. Increase to 5MB/s once finished testing.
        if ($rate > 2097152)
        {
            if ($class < UC_MODERATOR)
            {
                $rate = mksize($rate);
                $client = $agent;
                $userip = getip();

                auto_enter_cheater($userid, $rate, $upthis, $diff, $torrentid, $client, $userip, $last_up);
            }
        }
    }
    mysql_query("UPDATE users SET uploaded = uploaded + $upthis". ($torrent['free']=='no'?", downloaded = downloaded + $downthis ":' '). "WHERE id=$userid") or err("Tracker error 3");
}

///////////////////////////////////////////////////////////////////////////////

$dt = gmtime() - 180;
$dt = sqlesc(get_date_time($dt));
if ("text/html, */*" == $_SERVER["HTTP_ACCEPT"] || "Close" == $_SERVER["HTTP_CONNECTION"] && "gzip, deflate" != $_SERVER["HTTP_ACCEPT_ENCODING"])
{
$u = mysql_fetch_assoc(mysql_query("SELECT id, username FROM users WHERE id=".$userid));
$subject = sqlesc("Cheat - ".$u["username"]."");
$body = sqlesc("[url=userdetails.php?id=".$userid."]".$u["username"]."[/url] used RatioMaker.\n UserAgent: ".$agent."\n PeerID: ".substr($peer_id,0,7));

auto_post( $subject , $body );
benc_resp_raw("Anti-Cheater= You cannot use this agent!");
}
function portblacklisted($port)
{
// direct connect
if ($port >= 411 && $port <= 413) return true;

// bittorrent
if ($port >= 6881 && $port <= 6889) return true;

// kazaa
if ($port == 1214) return true;

// gnutella
if ($port >= 6346 && $port <= 6347) return true;

// emule
if ($port == 4662) return true;

// winmx
if ($port == 6699) return true;

return false;
}

$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 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 = @fsockopen($ip, $port, $errno, $errstr, 5);
  if (!$sockres)
    $connectable = "no";
  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");
mysql_query("UPDATE peers SET uploaded = $uploaded, downloaded = $downloaded, to_go = $left, last_action = NOW(), 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 = @fsockopen($ip, $port, $errno, $errstr, 5);
if (!$sockres)
$connectable = "no";
else
{
$connectable = "yes";
@fclose($sockres);
}
}

//Start ban client//
if(ereg("^BitTorrent\\/S-", $agent)) err("Shadow's Experimental Client is Banned."); //also earlier versions of ABC
        if(ereg("^ABC\\/ABC", $agent)) err ("ABC Client is Banned.");
        if(ereg("^Python-urllib\\/2.4", $agent)) err ("Client is Banned."); //G3 Torrent, maybe a few others
        if(ereg("^0P3R4H", $httpagent)) err ("IBrowser Opera is not a cool BT client.");
        if(substr($peer_id, 0, 5) == "-UT11") err("ľTorrent 1.1 Client is Banned.");
        if(substr($peer_id, 0, 5) == "-UT12") err("ľTorrent 1.2 Client is Banned.");
        if(substr($peer_id, 0, 5) == "-UT13") err("ľTorrent 1.3 Client is Banned.");
        if(substr($peer_id, 0, 5) == "-UT14") err("ľTorrent 1.4 is Banned, Use ľTorrent 1.6.1");
        if(substr($peer_id, 0, 5) == "-UT15") err("ľTorrent 1.5 is Banned, Use ľTorrent 1.6.1");
        if(substr($peer_id, 0, 7) == "-UT161B") err("ľTorrent 1.6.1 Beta is Banned, Use ľTorrent 1.6.1");//hacked uTorrent client
        if(substr($peer_id, 0, 6) == "exbc\08") err("BitComet 0.56 Client is Banned.");
        if(substr($peer_id, 0, 6) == "-BC0056-") err("BitComet 0.56 Client is Banned.");
        if(substr($peer_id, 0, 4) == "FUTB") err("FUTB? Fuck You Too."); //patched version of BitComet 0.57 (FUTB- Fuck U TorrentBits)
        if(substr($peer_id, 0, 6) == "exbc\09") err("BitComet 0.57 Client is Banned.");
        if(substr($peer_id, 0, 6) == "-BC0057-") err("BitComet 0.57 Client is Banned.");
        if(substr($peer_id, 0, 6) == "exbc\0:") err("BitComet 0.58 Client is Banned.");
        if(substr($peer_id, 0, 6) == "-BC0058-") err("BitComet 0.58 Client is Banned.");
        if(substr($peer_id, 0, 8) == "-BC0059-") err("BitComet 0.59 Client is Banned.");
        if(substr($peer_id, 0, 8) == "-BC0060-") err("BitComet 0.60 Client is Banned.");
if(substr($peer_id, 0, 8) == "-BC0061-") err("BitComet 0.61 Client is Banned.");
        if(substr($peer_id, 0, 8) == "-BC0062-") err("BitComet 0.62 Client is Banned.");
        if(substr($peer_id, 0, 8) == "-BC0063-") err("BitComet 0.63 Client is Banned.");
        if(substr($peer_id, 0, 8) == "-BC0064-") err("BitComet 0.64 Client is Banned.");
        if(substr($peer_id, 0, 8) == "-BC0065-") err("BitComet 0.65 Client is Banned.");
        if(substr($peer_id, 0, 8) == "-BC0066-") err("BitComet 0.66 Client is Banned.");
        if(substr($peer_id, 0, 8) == "-BC0067-") err("BitComet 0.67 Client is Banned.");
        if(substr($peer_id, 0, 8) == "-BC0068-") err("BitComet 0.68 Client is Banned.");
        if(substr($peer_id, 0, 8) == "-BC0069-") err("BitComet 0.69 Client is Banned.");
        if(substr($peer_id, 0, 8) == "-BC0070-") err("BitComet 0.70 Client is Banned.");
        if(substr($peer_id, 0, 8) == "-BC0071-") err("BitComet 0.71 Client is Banned.");
        if(substr($peer_id, 0, 8) == "-BC0072-") err("BitComet 0.72 Client is Banned.");
        if(substr($peer_id, 0, 8) == "-BC0073-") err("BitComet 0.73 Client is Banned.");
        if(substr($peer_id, 0, 8) == "-BC0074-") err("BitComet 0.74 Client is Banned.");
        if(substr($peer_id, 0, 8) == "-BC0075-") err("BitComet 0.75 Client is Banned.");
        if(substr($peer_id, 0, 8) == "-BC0076-") err("BitComet 0.76 Client is Banned.");
if(substr($peer_id, 0, 7) == "exbc\0L") err("BitLord 1.0 Client is Banned.");
        if(substr($peer_id, 0, 8) == "exbcLORD") err ("BitLord Client is Banned.");
        if(substr($peer_id, 0, 2) == "BS") err ("BitSpirit Client is Banned.");
        if(substr($peer_id, 0, 3) == "-TS") err ("TorrentStorm Client is Banned.");
        if(substr($peer_id, 0, 5) == "Mbrst") err ("Burst! Client is Banned.");
        if(substr($peer_id, 0, 3) == "-BB") err ("BitBuddy iClient is Banned.");
        if(substr($peer_id, 0, 3) == "-SZ") err("Shareaza Client is Banned.");
        if(substr($peer_id, 0, 3) == "XBT") err ("XBT Client is Banned.");
        if(substr($peer_id, 0, 5) == "turbo") err ("TurboBT Client is Banned.");
        if(preg_match("/^RAZA (.+)$/", $httpagent, $matches)) err ("Shareaza Client is Banned.");
        if(preg_match("/MLDonkey\/([0-9]+).([0-9]+).([0-9]+)*/", $httpagent, $matches)) err ("MLDonkey is not a BT client.");
        if(preg_match("/ed2k_plugin v([0-9]+\\.[0-9]+).*/", $httpagent, $matches)) err ("eDonkey is not a BT client.");
        if(preg_match("/^Python-urllib\\/([0-9]+\\.[0-9]+(\\.[0-9]+)*)/", $httpagent, $matches)) err ("G3 Client is Banned.");
        if(preg_match("/Rufus\/([0-9]+\.[0-9]+\.[0-9]+)/", $httpagent, $matches)) err ("Rufus Client is Banned.");
        if(preg_match("/CT([0-9]+)([0-9]+)([0-9]+)([0-9]+)/", $peer_id, $matches)) err ("cTorrent Client is Banned.");
//End ban client//

$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");

benc_resp_raw($resp);


?>
Zapisane

nicky

  • Zaawansowany
  • *****
  • Reputacja 3
  • Offline Offline
  • Wiadomości: 135
Odp: vip=freeleech how
« Odpowiedź #2 dnia: Styczeń 04, 2008, 05:52:12 »

piter not see

mysql_query("UPDATE users SET uploaded = uploaded + $upthis, downloaded = downloaded + $downthis WHERE id=$userid")
in my announce

mysql_query("UPDATE users SET uploaded = uploaded + $upthis". ($torrent['free']=='no'?", downloaded = downloaded + $downthis ":' '). "WHERE id=$userid") or err("Tracker error 3");
Zapisane

nicky

  • Zaawansowany
  • *****
  • Reputacja 3
  • Offline Offline
  • Wiadomości: 135
Odp: vip=freeleech how
« Odpowiedź #3 dnia: Styczeń 04, 2008, 06:08:51 »

Again thank's piter for help
Zapisane

Dario87

  • Użytkownik
  • Reputacja 0
  • Offline Offline
  • Wiadomości: 1
Odp: vip=freeleech how
« Odpowiedź #4 dnia: Październik 25, 2008, 12:48:12 »

o fuc* sory i missed that ;]

change:
mysql_query("UPDATE users SET uploaded = uploaded + $upthis". ($torrent['free']=='no'?", downloaded = downloaded + $downthis ":' '). "WHERE id=$userid") or err("Tracker error 3");

to that:
mysql_query("UPDATE users SET uploaded = uploaded + $upthis". ($torrent['free']=='yes' || $class == UC_VIP ? ' ' : ", downloaded = downloaded + $downthis "). "WHERE id=$userid") or err("Tracker error 3");

Witam !
Mam pytanie czy przy tej konfiguracji co napisał Piter free leech noralnie bedzie działac tylko dodatkowo ranga VIP bedzie miala freelecha na wszystko? Czy inaczej?
Bo mecze sie z tym by zrobic dla jednej klasy np vipa  freelecha na wszystko obojetnie czy torrent jest darmowy czy nie, natomiast dla innych klas już nie tak jak vip tylko normalnie torrent free wyznaczany przez załoge.
« Ostatnia zmiana: Październik 25, 2008, 12:57:55 wysłana przez Dario87 »
Zapisane
 

Strona wygenerowana w 0.173 sekund z 23 zapytaniami.