Login
Username: Password:
Remember me

[Sign Up] / [Recover Password]

Theme / Language

Popular
New Torrents
new name
Size: 18.40 MB
Most active
new name
S: 74 L: 3
New Posters
announce no working torrents ?
Controls ·  Search New posts · Mark unread

You are in: Forum / Forum / Torrent Trader / v3 Support

2025-09-20 15:32:33
Can someone check it and tell me why it doesn't say that the tracker is working and showing the sharers? Instead it says that the tracker is sending incorrect data. How is this fixed with the modified versions?
announce.php
Download
2025-09-20 19:42:31
want to try mine? Also be mindful of mysql strict mode unless you fixed any issues related to that
<?php
// TTv3 Micro Edition - HTTP Tracker
// Please Note: Languages should not be implemented here...
error_reporting(E_ALL ^ E_NOTICE);
require_once "backend/mysql.php";
require_once "backend/config.php";
require_once "backend/mysql.class.php";
require_once "backend/cache.php";
require_once "backend/BEncode.php"; // Include BEncode

// Database connection
$GLOBALS["DBconnector"] = mysqli_connect($mysql_host, $mysql_user, $mysql_pass) or err('dbconn: mysqli_connect: ' . mysqli_connect_error());
mysqli_select_db($GLOBALS["DBconnector"], $mysql_db) or err('dbconn: mysqli_select_db: ' . mysqli_error($GLOBALS["DBconnector"]));

// Site config
$MEMBERSONLY = $site_config["MEMBERSONLY"];
$MEMBERSONLY_WAIT = $site_config["MEMBERSONLY_WAIT"];

// Process GET parameters
$_GET = array_map_recursive("unesc", $_GET);

// START FUNCTIONS
function array_map_recursive($callback, $array) {
   $ret = [];
   if (!is_array($array)) {
       return $callback($array);
   }
   foreach ($array as $key => $val) {
       $ret[$key] = array_map_recursive($callback, $val);
   }
   return $ret;
}

function unesc($x) {
   return $x;
}

function is_valid_id($id) {
   return is_numeric($id) && ($id > 0) && (floor($id) == $id);
}

function sqlesc($x) {
   if (is_null($x)) {
       return "NULL";
   }
   if (is_numeric($x)) {
       return $x;
   }
   return "'" . mysqli_real_escape_string($GLOBALS["DBconnector"], $x) . "'";
}

function err($msg) {
   SQL_Query_exec("INSERT INTO announce_log (message, added) VALUES ('$msg', NOW())");
   $response = ["failure reason" => $msg];
   benc_resp_raw(BEncode($response));
}

function benc_resp_raw($x) {
   header("Content-Type: text/plain");
   header("Pragma: no-cache");
   if (extension_loaded('zlib') && !ini_get('zlib.output_compression') && $_SERVER["HTTP_ACCEPT_ENCODING"] == "gzip") {
       header("Content-Encoding: gzip");
       echo gzencode($x, 9, FORCE_GZIP);
   } else {
       print($x);
   }
   exit();
}

function gmtime() {
   return strtotime(get_date_time());
}

function get_date_time($timestamp = 0) {
   return $timestamp ? date("Y-m-d H:i:s", $timestamp) : gmdate("Y-m-d H:i:s");
}

function portblacklisted($port) {
   if (($port >= 411 && $port <= 413) || $port == 1214 || ($port >= 6346 && $port <= 6347) || $port == 4662 || $port == 6699) {
       return true;
   }
   return false;
}

// BLOCK ACCESS WITH WEB BROWSERS
$agent = $_SERVER["HTTP_USER_AGENT"];
if (preg_match("/^Mozilla|^Opera|^Links|^Lynx/i", $agent)) {
   die("NO go joe");
}

// GET DETAILS OF PEERS ANNOUNCE
$passkey = $_GET["passkey"] ?? null;
$info_hash = $_GET["info_hash"] ?? null;
$peer_id = $_GET["peer_id"] ?? null;
$ip = $_GET["ip"] ?? $_SERVER["REMOTE_ADDR"];
$event = $_GET["event"] ?? "";
$port = (int)($_GET["port"] ?? 0);
$downloaded = (int)($_GET["downloaded"] ?? 0);
$uploaded = (int)($_GET["uploaded"] ?? 0);
$left = (int)($_GET["left"] ?? 0);

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);
   $_GET[$tmpname] = $tmpvalue;
}

// Validation
foreach (["info_hash", "peer_id", "port", "downloaded", "uploaded", "left"] as $x) {
   if (!isset($_GET[$x])) {
       err("Missing key: $x");
   }
}
if ($MEMBERSONLY && !$passkey) {
   err("Missing key: passkey");
}
if (strlen($peer_id) != 20) {
   err("Invalid peer_id");
}
$no_peer_id = (int)($_GET["no_peer_id"] ?? 0);
if (strlen($info_hash) == 20) {
   $info_hash = bin2hex($info_hash);
} elseif (strlen($info_hash) != 40) {
   mysqli_close($GLOBALS["DBconnector"]);
   err("Invalid info hash value.");
}
$info_hash = strtolower($info_hash);
if ($MEMBERSONLY && strlen($passkey) != 32) {
   mysqli_close($GLOBALS["DBconnector"]);
   err("Invalid passkey (" . strlen($passkey) . " - $passkey)");
}
if (!$port || $port > 0xffff) {
   mysqli_close($GLOBALS["DBconnector"]);
   err("invalid port");
}

// Agent Ban
$agentarray = array_map("trim", explode(",", $site_config["BANNED_AGENTS"]));
$useragent = substr($peer_id, 0, 8);
foreach ($agentarray as $bannedclient) {
   if (@strpos($useragent, $bannedclient) !== false) {
       mysqli_close($GLOBALS["DBconnector"]);
       err("Client is banned");
   }
}
if (portblacklisted($port)) {
   mysqli_close($GLOBALS["DBconnector"]);
   err("Port $port is blacklisted.");
}

// Database queries
$userfields = "u.id, u.class, u.uploaded, u.downloaded, u.ip, u.passkey, g.can_download";
$peerfields = "seeder, UNIX_TIMESTAMP(last_action) AS ez, peer_id, ip, port, uploaded, downloaded, userid, passkey";
$torrentfields = "id, info_hash, banned, freeleech, seeders + leechers AS numpeers, UNIX_TIMESTAMP(added) AS ts, seeders, leechers, times_completed, size";

$userid = 0;
if ($MEMBERSONLY) {
   $res = SQL_Query_exec("SELECT $userfields FROM users u INNER JOIN groups g ON u.class = g.group_id WHERE u.passkey=" . sqlesc($passkey) . " AND u.enabled = 'yes' AND u.status = 'confirmed' LIMIT 1") or err("Cannot Get User Details");
   $user = mysqli_fetch_array($res);
   if (!$user) {
       mysqli_close($GLOBALS["DBconnector"]);
       err("Cannot locate a user with that passkey!");
   }
   $userid = $user["id"];
}

$res = SQL_Query_exec("SELECT $torrentfields FROM torrents WHERE info_hash=" . sqlesc($info_hash));
$torrent = mysqli_fetch_array($res);
if (!$torrent) {
   mysqli_close($GLOBALS["DBconnector"]);
   err("Torrent not found on this tracker - hash = " . $info_hash);
}
if ($torrent["banned"] == 'yes') {
   mysqli_close($GLOBALS["DBconnector"]);
   err("Torrent has been banned - hash = " . $info_hash);
}
$torrentid = $torrent["id"];
$tsize = $torrent["size"];

$peerlimit = 50;
$numpeers = $torrent["numpeers"];
$limit = ($numpeers > $peerlimit) ? "ORDER BY RAND() LIMIT $peerlimit" : "";
$rows = $site_config["cache_peers"]
   ? SQL_Query_exec_cached("SELECT $peerfields FROM peers WHERE torrent = $torrentid $limit", $site_config["cache_peers_time"])
   : mysqli_fetch_all(SQL_Query_exec("SELECT $peerfields FROM peers WHERE torrent = $torrentid $limit"), MYSQLI_ASSOC);

// Build peers list
$peers_list = [];
$self = null;
foreach ($rows as $row) {
   if ($row["peer_id"] === $peer_id) {
       $self = $row;
       continue;
   }
   $peer = ["ip" => $row["ip"], "port" => (int)$row["port"]];
   if (!$no_peer_id) {
       $peer["peer id"] = $row["peer_id"];
   }
   $peers_list[] = $peer;
}

// Self handling
$seeder = ($left == 0) ? "yes" : "no";
$selfwhere = "torrent = $torrentid AND peer_id = " . sqlesc($peer_id);

if (!$self) {
   if ($MEMBERSONLY) {
       $valid = @mysqli_fetch_row(@SQL_Query_exec("SELECT COUNT(*) FROM peers WHERE torrent=$torrentid AND passkey=" . sqlesc($passkey)));
       if ($valid[0] >= 1 && $seeder == 'no') {
           mysqli_close($GLOBALS["DBconnector"]);
           err("Connection limit exceeded! You may only leech from one location at a time.");
       }
       if ($valid[0] >= 3 && $seeder == 'yes') {
           mysqli_close($GLOBALS["DBconnector"]);
           err("Connection limit exceeded!");
       }
   }
   $res = SQL_Query_exec("SELECT $peerfields FROM peers WHERE $selfwhere");
   $self = mysqli_fetch_assoc($res) ?: null;
}

if (!$self && $MEMBERSONLY_WAIT && $MEMBERSONLY && $left > 0 && in_array($user["class"], explode(",", $site_config["WAIT_CLASS"]))) {
   $gigs = $user["uploaded"] / (1024 * 1024 * 1024);
   $elapsed = floor((gmtime() - $torrent["ts"]) / 3600);
   $ratio = ($user["downloaded"] > 0) ? ($user["uploaded"] / $user["downloaded"]) : 1;
   $wait = 0;
   if ($ratio == 0 && $gigs == 0) $wait = $site_config["WAITA"];
   elseif ($ratio < $site_config["RATIOA"] || $gigs < $site_config["GIGSA"]) $wait = $site_config["WAITA"];
   elseif ($ratio < $site_config["RATIOB"] || $gigs < $site_config["GIGSB"]) $wait = $site_config["WAITB"];
   elseif ($ratio < $site_config["RATIOC"] || $gigs < $site_config["GIGSC"]) $wait = $site_config["WAITC"];
   elseif ($ratio < $site_config["RATIOD"] || $gigs < $site_config["GIGSD"]) $wait = $site_config["WAITD"];
   if ($elapsed < $wait) {
       mysqli_close($GLOBALS["DBconnector"]);
       err("Wait Time (" . ($wait - $elapsed) . " hours) - Visit " . $site_config["SITEURL"] . " for more info");
   }
}

$connectable = "no";
if (!$self) {
   $sockres = @fsockopen($ip, $port, $errno, $errstr, 5);
   if ($sockres) {
       $connectable = "yes";
       @fclose($sockres);
   }
} else {
   $elapsed = ($self['seeder'] == 'yes') ? $site_config['announce_interval'] - floor(($self['ez'] - time()) / 60) : 0;
   $upthis = max(0, $uploaded - $self["uploaded"]);
   $downthis = max(0, $downloaded - $self["downloaded"]);
   if (($upthis > 0 || $downthis > 0 || $elapsed > 0) && is_valid_id($userid)) {
       if ($torrent["freeleech"] == 1) {
           SQL_Query_exec("UPDATE users SET uploaded = uploaded + $upthis WHERE id=$userid");
       } else {
           SQL_Query_exec("UPDATE users SET uploaded = uploaded + $upthis, downloaded = downloaded + $downthis WHERE id=$userid") or err("Tracker error: Unable to update stats");
       }
       SQL_Query_exec("UPDATE LOW_PRIORITY `snatched` SET `uload` = `uload` + '$upthis', `dload` = `dload` + '$downthis', `utime` = '" . gmtime() . "', `ltime` = `ltime` + '$elapsed' WHERE `tid` = '$torrentid' AND `uid` = '$userid'");
   }
}

// Tracker event updates
$updateset = [];
if ($event == "stopped") {
   SQL_Query_exec("DELETE FROM peers WHERE $selfwhere");
   if (mysqli_affected_rows($GLOBALS["DBconnector"])) {
       $updateset[] = ($self["seeder"] == "yes")
           ? "seeders = (CASE WHEN (seeders < 1) THEN 0 ELSE (seeders - 1) END)"
           : "leechers = (CASE WHEN (leechers < 1) THEN 0 ELSE (leechers - 1) END)";
   }
}
if ($event == "completed") {
   $updateset[] = "times_completed = times_completed + 1";
   if ($MEMBERSONLY) {
       SQL_Query_exec("INSERT INTO completed (userid, torrentid, date) VALUES ($userid, $torrentid, '" . get_date_time() . "')");
       SQL_Query_exec("UPDATE LOW_PRIORITY `snatched` SET `completed` = '1' WHERE `tid` = '$torrentid' AND `uid` = '$userid' AND `utime` = '" . gmtime() . "'");
   }
}

if ($self) {
   SQL_Query_exec("UPDATE peers SET ip = " . sqlesc($ip) . ", passkey = " . sqlesc($passkey) . ", port = $port, uploaded = $uploaded, downloaded = $downloaded, to_go = $left, last_action = '" . get_date_time() . "', client = " . sqlesc($agent) . ", seeder = '$seeder' WHERE $selfwhere");
   if (mysqli_affected_rows($GLOBALS["DBconnector"]) && $self["seeder"] != $seeder) {
       $updateset[] = $seeder == "yes" ? "seeders = seeders + 1" : "seeders = (CASE WHEN (seeders < 1) THEN 0 ELSE (seeders - 1) END)";
       $updateset[] = $seeder == "yes" ? "leechers = (CASE WHEN (leechers < 1) THEN 0 ELSE (leechers - 1) END)" : "leechers = leechers + 1";
   }
} else {
   $ret = SQL_Query_exec("INSERT INTO peers (connectable, torrent, peer_id, ip, passkey, port, uploaded, downloaded, to_go, started, last_action, seeder, userid, client) VALUES ('$connectable', $torrentid, " . sqlesc($peer_id) . ", " . sqlesc($ip) . ", " . sqlesc($passkey) . ", $port, $uploaded, $downloaded, $left, '" . get_date_time() . "', '" . get_date_time() . "', '$seeder', '$userid', " . sqlesc($agent) . ")");
   if ($MEMBERSONLY && $seeder == 'no') {
       SQL_Query_exec("INSERT DELAYED INTO `snatched` (`uid`, `tid`, `stime`, `utime`) VALUES ('$userid', '$torrentid', '" . gmtime() . "', '" . gmtime() . "') ON DUPLICATE KEY UPDATE `utime` = '" . gmtime() . "'");
   } else {
       SQL_Query_exec("INSERT DELAYED INTO `snatched` (`uid`, `tid`, `stime`, `utime`, `dload`, `completed`) VALUES ('$userid', '$torrentid', '" . gmtime() . "', '" . gmtime() . "', '" . $tsize . "', '1') ON DUPLICATE KEY UPDATE `utime` = '" . gmtime() . "'");
   }
   if ($ret) {
       $updateset[] = ($seeder == "yes") ? "seeders = seeders + 1" : "leechers = leechers + 1";
   }
}

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

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

// Send response
$response = [
   "complete" => (int)$torrent["seeders"],
   "downloaded" => (int)$torrent["times_completed"],
   "incomplete" => (int)$torrent["leechers"],
   "interval" => $site_config["announce_interval"],
   "min interval" => 300,
   "peers" => $peers_list
];
benc_resp_raw(BEncode($response));

mysqli_close($GLOBALS["DBconnector"]);
?>

TTv3 Micro Edition
Ubuntu 20.04.6 LTS Server
Mysql Version: 10.3.39-MariaDB-0ubuntu0.20.04.2
PHP Version: 7.4.3-4ubuntu2.20
Apache Version: Apache/2.4.59 (Ubuntu)
Last edited by MicroMonkey on 2025-09-20 21:01:54
2025-09-21 06:20:26
I have installed yours and will test it if it works. We talked about this script over here:
https://mega.nz/file/d6VB0STb#ZBWqfP...W00g4AdRCE2CUk
2025-09-21 06:25:09




Could you make a correction to the script for me because I don't know what is causing this problem?
Last edited by soneigr on 2025-09-21 06:26:02
2025-09-30 09:05:19
https://prnt.sc/UxrpE5p48FQS




www.exyusubs.com
TorrentTrader V3.8.3 (SE)
OS: AlmaLinux 9.9 (BC)
Apache version: 2.4.71
PHP version: 8.5.13 (PHP-FPM)
MySQL version: 10.11.18-MariaDB
Last edited by Botanicar on 2025-09-30 09:08:09
2025-10-07 05:50:38
This is an external torrent and not an internal one. I am interested in the internal torrent.
2025-10-10 21:16:47
Internal torrents have always worked in TT, I don't see where your problem is
2025-10-10 21:18:44
Sorry Coco, we are having problems with announce on PHP8... been trying to solve this problem for the past few weeks


www.exyusubs.com
TorrentTrader V3.8.3 (SE)
OS: AlmaLinux 9.9 (BC)
Apache version: 2.4.71
PHP version: 8.5.13 (PHP-FPM)
MySQL version: 10.11.18-MariaDB
2025-10-11 19:34:55
announce.php for testing php8.4

Test it and let me know.

Regards
announce.zip
Download

Last edited by coco on 2025-10-11 19:35:25
2025-10-12 18:57:02
Tested it here too, we'll see it as a gang! [php v8.0]
announce.zip
Download

Last edited by spiritblue on 2025-10-16 01:33:33
2025-10-13 19:32:50
is working 100% on torrent trader my version this is download link up ?  https://mega.nz/file/d6VB0STb#ZBWqfP...W00g4AdRCE2CUk
i am use php 5.6
Last edited by soneigr on 2025-10-13 19:33:23
2025-10-15 08:27:07
TT for PHP 5.6 has long been out of development so the best one right now is the one developed for PHP 7+... we are working hard to adapt it for PHP 8+... right now we have small problems with some parts of the transcoding but as I said we all have our private lives and jobs to fix it.
The development is progressing on our test trackers and it looks bright...

PS
The link you provide to us requires the key so to download it find some other way so we can accept your problem


www.exyusubs.com
TorrentTrader V3.8.3 (SE)
OS: AlmaLinux 9.9 (BC)
Apache version: 2.4.71
PHP version: 8.5.13 (PHP-FPM)
MySQL version: 10.11.18-MariaDB
2025-10-17 12:59:01
As long as it looks good. The progress with the development (on a live server) is going well right now.
I want to thank everyone involved in this project...
Give us a couple more days to finish the testing and we'll get back to you ASAP














www.exyusubs.com
TorrentTrader V3.8.3 (SE)
OS: AlmaLinux 9.9 (BC)
Apache version: 2.4.71
PHP version: 8.5.13 (PHP-FPM)
MySQL version: 10.11.18-MariaDB
2025-10-18 14:34:37
Cool ! Botanicar en php v8.3  ðŸ‘Œ tres bonne nouvelle !   💣
2025-10-21 12:47:22
Will it be available to the public anytime soon? Will it have all the mods in it?
Users online

No users online

Search



Statistics

    Torrents

  • Tracking: 3
  • Todays torrents: 0
  • Seeders: 0
  • Leechers: 0
  • Peers: 0
  • Downloaded: 89.96 GB
  • Uploaded: 9.86 GB

  • Members

  • We have: 838
  • New today: 0
  • Guest today: 9

  • Online

  • Total online: 4
  • Members: 0
  • Guests online: 4
  • Comments: 3
  • Messages: 1,728