예제 #1
0
         }
         $inames[] = $ifilename;
     }
 }
 //end upload images
 // Make torrent private
 if ($external == "no") {
     require_once "backend/BDecode.php";
     require_once "backend/BEncode.php";
     $dict = BDecode(file_get_contents("{$torrent_dir}/{$fname}"));
     $dict["info"]["private"] = 1;
     $fs = fopen("{$torrent_dir}/{$fname}", "w");
     fwrite($fs, BEncode($dict));
     fclose($fs);
     $TorrentInfo = array();
     $TorrentInfo = ParseTorrent("{$torrent_dir}/{$fname}");
     $infohash = $TorrentInfo[1];
 }
 // End add make torrent private
 //anonymous upload
 $anonyupload = $_POST["anonycheck"];
 if ($anonyupload == "yes") {
     $anon = "yes";
 } else {
     $anon = "no";
 }
 $ret = SQL_Query_exec("INSERT INTO torrents (filename, owner, name, descr, image1, image2, category, added, info_hash, size, numfiles, save_as, announce, external, nfo, torrentlang, anon, last_action) VALUES (" . sqlesc($fname) . ", '" . $CURUSER['id'] . "', " . sqlesc($name) . ", " . sqlesc($descr) . ", '" . $inames[0] . "', '" . $inames[1] . "', '" . $catid . "', '" . get_date_time() . "', '" . $infohash . "', '" . $torrentsize . "', '" . $filecount . "', " . sqlesc($fname) . ", '" . $announce . "', '" . $external . "', '" . $nfo . "', '" . $langid . "','{$anon}', '" . get_date_time() . "')");
 $id = mysql_insert_id();
 if (mysql_errno() == 1062) {
     show_error_msg(T_("UPLOAD_FAILED"), T_("UPLOAD_ALREADY_UPLOADED"), 1);
 }
예제 #2
0
// Last Updated: 11/march/2014 @ 14:02 by serph
require_once "backend/functions.php";
require_once "backend/BDecode.php";
require_once "backend/parse.php";
require_once "backend/udptscraper.php";
dbconn(false);
set_time_limit(5);
$interval = 172800;
// Rescrape torrents every x seconds. (Default: 2 days)
$ts = gmtime() - $interval;
$res = mysql_query("SELECT id, info_hash FROM torrents WHERE external = 'yes'  AND torrents.seeders = '0'  ORDER BY torrents.id DESC LIMIT 10");
$count = get_row_count("torrents", "WHERE external = 'yes' AND last_action <= FROM_UNIXTIME({$ts})");
while ($row = mysql_fetch_array($res)) {
    echo "<B>ID: {$row['id']}</B><BR>";
    //echo "<B>NAME: $row[name]</B><BR>";
    $TorrentInfo = ParseTorrent("{$site_config['torrent_dir']}/{$row['id']}.torrent");
    $ann = $TorrentInfo[0];
    $annlist = array();
    if ($TorrentInfo[6]) {
        foreach ($TorrentInfo[6] as $ann) {
            $annlist[] = $ann[0];
        }
    } else {
        $annlist = array($ann);
    }
    $seeders = $leechers = $downloaded = null;
    //echo "Info_Hash: $row[info_hash]<BR>";
    foreach ($annlist as $ann) {
        $tracker = explode("/", $ann);
        $path = array_pop($tracker);
        $oldpath = $path;