fix rss download link + migrate bencode to rhilip/bencode

This commit is contained in:
xiaomlove
2021-06-09 02:23:09 +08:00
parent bf49c8c298
commit 5c4c2ccf8f
9 changed files with 185 additions and 329 deletions

View File

@@ -1,6 +1,6 @@
<?php
require_once('../include/bittorrent_announce.php');
require_once('../include/benc.php');
//require_once('../include/benc.php');
dbconn_announce();
// BLOCK ACCESS WITH WEB BROWSERS AND CHEATS!
@@ -24,13 +24,14 @@ if (mysql_num_rows($res) < 1){
err("Torrent not registered with this tracker.");
}
$torrent_details = [];
while ($row = mysql_fetch_assoc($res)) {
$r .= "20:" . hash_pad($row["info_hash"]) . "d" .
benc_str("complete") . "i" . $row["seeders"] . "e" .
benc_str("downloaded") . "i" . $row["times_completed"] . "e" .
benc_str("incomplete") . "i" . $row["leechers"] . "e" .
"e";
$torrent_details[$row['info_hash']] = [
'complete' => (int)$row['seeders'],
'downloaded' => (int)$row['times_completed'],
'incomplete' => (int)$row['leechers']
];
}
$r .= "ee";
benc_resp_raw($r);
$d = ['files' => $torrent_details];
benc_resp($d);