コード例 #1
0
ファイル: Bcode.php プロジェクト: KasaiDot/TorrentCaching
 /**
  * Info
  * @param type $d
  */
 static function benc_resp($d)
 {
     Bcode::benc_resp_raw(Bcode::benc(array('type' => 'dictionary', 'value' => $d)));
 }
コード例 #2
0
ファイル: announce.php プロジェクト: thefkboss/openTracker
            $db->ip = $data['ip'];
            $db->port = $data['port'];
            $db->uploaded = 0;
            $db->downloaded = 0;
            $db->to_go = $data['left'];
            $db->seeder = $data['seeder'];
            $db->started = time();
            $db->last_action = time();
            $db->passkey = $data['passkey'];
            $db->connectable = $data['connectable'];
            $db->insert();
            if ($data['seeder']) {
                $torrent_query[] = "torrent_seeders = torrent_seeders + 1";
            } else {
                $torrent_query[] = "torrent_leechers = torrent_leechers + 1";
            }
        }
    }
    if ($data['seeder']) {
        $torrent_query[] = "torrent_visible = 1";
        $torrent_query[] = "torrent_last_action = '" . time() . "'";
    }
    $db = new DB();
    if (count($torrent_query)) {
        $db->query("UPDATE {PREFIX}torrents SET " . implode(", ", $torrent_query) . " WHERE torrent_id = '{$torrent_id}'");
    }
    Bcode::benc_resp_raw(implode("", $callback));
} catch (Exception $e) {
    Bcode::benc_resp(array('failure reason' => array('type' => 'string', 'value' => $e->getMessage())));
    exit;
}