-
Notifications
You must be signed in to change notification settings - Fork 0
/
stats-hash-table.php
41 lines (36 loc) · 1.18 KB
/
stats-hash-table.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<?php
require('functions.php');
$address = upstreamAddress('HASH');
$handle = FALSE;
if (! isset($_REQUEST['hash'])) {
http_response_code(400);
echo "Missing 'hash' param";
die();
}
$handle = jsonGet($address, json_encode(array('hash' => $_REQUEST['hash'])));
if ( !$handle ) {
http_response_code(500);
echo "Error";
die();
} else {
$torrent = json_decode(stream_get_contents($handle));
}
?>
<!DOCTYPE html>
<html lang="en">
<?php require('head.php'); ?>
<body>
<h1>Torrent Health Tracker</h1>
<h2>Updated: <?php echo (new \DateTime())->format('Y-m-d H:i:s e'); ?></h2>
<h3>
<p>Infohash: <?= $torrent->_id; ?></p>
<p>Name: <?= $torrent->name; ?></p>
<p>Link: <?= $torrent->link; ?></p>
<p>Queued: <span class="js-is-queued" data-info-hash="<?= $torrent->_id; ?>"></span></p>
<p>Created: <?= $torrent->created_unix; ?></p>
<p>Size: <?= formatBytes($torrent->size_bytes); ?></p>
<p>Type: <?= $torrent->type ?></p>
</h3>
<?php require('table-trackers.php'); ?>
</body>
</html>