$annlist = array(array($announce)); } foreach ($annlist as $ann) { foreach ($ann as $val) { if (strtolower(substr($val, 0, 4)) != "udp:") { SQL_Query_exec("INSERT INTO `announce` (`torrent`, `url`) VALUES({$id}, " . sqlesc($val) . ")"); } } } if ($nfo == 'yes') { move_uploaded_file($nfofilename, "{$nfo_dir}/{$id}.nfo"); } //EXTERNAL SCRAPE if ($external == 'yes' && $site_config['UPLOADSCRAPE']) { $tracker = str_replace("/announce", "/scrape", $announce); $stats = torrent_scrape_url($tracker, $infohash); $seeders = (int) strip_tags($stats['seeds']); $leechers = (int) strip_tags($stats['peers']); $downloaded = (int) strip_tags($stats['downloaded']); SQL_Query_exec("UPDATE torrents SET leechers='" . $leechers . "', seeders='" . $seeders . "',times_completed='" . $downloaded . "',last_action= '" . get_date_time() . "',visible='yes' WHERE id='" . $id . "'"); } //END SCRAPE write_log(sprintf(T_("TORRENT_UPLOADED"), htmlspecialchars($name), $CURUSER["username"])); //Uploaded ok message (update later) if ($external == 'no') { $message = sprintf(T_("TORRENT_UPLOAD_LOCAL"), $name, $id, $id); } else { $message = sprintf(T_("TORRENT_UPLOAD_EXTERNAL"), $name, $id); } show_error_msg(T_("UPLOAD_COMPLETE"), $message, 1); die;
$udp = true; try { $timeout = 5; $udp = new udptscraper($timeout); $stats = $udp->scrape($tracker, $row["info_hash"]); foreach ($stats as $id => $scrape) { $seeders += $scrape['seeders']; $leechers += $scrape['leechers']; $downloaded += $scrape['completed']; } } catch (ScraperException $e) { echo 'Error: ' . $e->getMessage() . "\n"; //echo('Connection error: ' . ($e->isConnectionError() ? 'yes' : 'no') . "\n"); } } else { $stats = torrent_scrape_url($tracker, $row["info_hash"]); } if ($stats['seeds'] != -1) { $seeders += $stats['seeds']; $leechers += $stats['peers']; $downloaded += $stats['downloaded']; echo "<BR><B>{$ann}</B><BR>"; echo "Seeders: " . ($udp ? $scrape['seeders'] : $stats["seeds"]) . "<BR>"; echo "Leechers: " . ($udp ? $scrape['leechers'] : $stats["peers"]) . "<BR>"; echo "Downloaded: " . ($udp ? $scrape['completed'] : $stats["downloaded"]) . "<BR>"; } else { echo "<BR><B>{$ann}</B>: Tracker timeout.<BR>"; } } if ($seeders !== null) { //echo "<BR><B>Totals:</B><BR>";