canDownload($sUserInfo); if($dCanDownload !== '') { http_response_code(403); switch($dCanDownload) { case 'inactive': die('This download is inactive.'); case 'private': die('You must be logged in for this download.'); case 'pending': die('This download is pending approval.'); default: die($dCanDownload); } } $trackerUrl = SERIA_ANNOUNCE_URL_ANON; if($sUserInfo->isLoggedIn()) $trackerUrl = sprintf(SERIA_ANNOUNCE_URL, $sUserInfo->getPassKey($pdo)); header('Content-Type: application/x-bittorrent'); header('Content-Disposition: inline; filename="' . htmlspecialchars($dTorrentInfo->getName()) . '.torrent"'); echo $dTorrentInfo->encode($trackerUrl);