Gazelle/sections/ajax/checkprivate.php

31 lines
792 B
PHP
Raw Normal View History

2012-06-05 08:00:11 +00:00
<?
2013-04-24 08:00:23 +00:00
include(SERVER_ROOT.'/classes/class_bencodetorrent.php');
2012-06-05 08:00:11 +00:00
$TorrentID = $_GET['torrentid'];
if (!is_number($TorrentID)) {
echo('Invalid TorrentID');
die();
}
$DB->query("SELECT File FROM torrents_files WHERE TorrentID='$TorrentID'");
2013-05-05 08:00:31 +00:00
if ($DB->record_count() == 0) {
2012-06-05 08:00:11 +00:00
echo('Torrent not found.');
die();
}
list($Contents) = $DB->next_record(MYSQLI_NUM, array(0));
2013-02-25 21:16:55 +00:00
if (Misc::is_new_torrent($Contents)) {
2013-03-17 08:00:17 +00:00
$Tor = new BencodeTorrent($Contents);
2013-02-25 21:16:55 +00:00
$Private = $Tor->is_private();
} else {
$Tor = new TORRENT(unserialize(base64_decode($Contents)), true); // New TORRENT object
$Private = $Tor->make_private();
}
2012-06-05 08:00:11 +00:00
2013-02-25 21:16:55 +00:00
if ($Private === true) {
2012-06-05 08:00:11 +00:00
echo '<span style="color: #0c0; font-weight: bold;">Private</span>';
} else {
echo '<span style="color: #c00; font-weight: bold;">Public</span>';
}
2013-04-24 08:00:23 +00:00
?>