} ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>Add Torrent to Tracker</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <link rel="stylesheet" type="text/css" href="./css/style.css" /> </head> <body> <?php $tracker_url = $website_url . substr($_SERVER['REQUEST_URI'], 0, -15) . "announce.php"; if (isset($_FILES["torrent"])) { addTorrent(); } endOutput(); function addTorrent() { require "config.php"; $tracker_url = $website_url . substr($_SERVER['REQUEST_URI'], 0, -15) . "announce.php"; $hash = strtolower($_POST["hash"]); $db = mysql_connect($dbhost, $dbuser, $dbpass) or die(errorMessage() . "Couldn't connect to the database, contact the administrator</p>"); mysql_select_db($database) or die(errorMessage() . "Can't open the database.</p>"); require_once "funcsv2.php"; require_once "BDecode.php"; require_once "BEncode.php"; if ($_FILES["torrent"]["error"] != 4) { $fd = fopen($_FILES["torrent"]["tmp_name"], "rb") or die(errorMessage() . "File upload error 1</p>\n"); is_uploaded_file($_FILES["torrent"]["tmp_name"]) or die(errorMessage() . "File upload error 2</p>\n");
if (isset($args['updateusage'])) { updateDiskUsage(); } if (isset($args['updatefeeds'])) { updateFeeds(); } if (isset($args['addfeed'])) { if (isset($args[$indexCounter])) { addFeed($args[$indexCounter++]); } else { echoError($argv); } } if (isset($args['addtorrent'])) { if (isset($args[$indexCounter]) && isset($args[$indexCounter + 1])) { addTorrent($args[$indexCounter++], $args[$indexCounter++]); } else { echoError($argv); } } exit(0); /* * From: http://pwfisher.com/nucleus/index.php?itemid=45 */ function parseArgs($argv) { array_shift($argv); $o = array(); foreach ($argv as $a) { if (substr($a, 0, 2) == '--') { $eq = strpos($a, '=');
} else { $quality = 0; } if (isset($_GET['from'])) { if ($_GET['from'] == 1) { $from = 1; $season = addslashes($_GET['season']); $id = addslashes($_GET['id']); } } else { $from = 0; } if (mysql_num_rows(mysql_query("SELECT * FROM subscriptions WHERE showid = '{$showid}'")) > 0) { if ($cancel == 1) { mysql_query("DELETE FROM subscriptions WHERE showid = '{$showid}'"); } } else { if ($cancel == 0) { echo "INSERT INTO subscriptions (showid, quality, subtitles) VALUES ('{$showid}', '{$quality}', '{$sublanguage}')"; mysql_query("INSERT INTO subscriptions (showid, quality, subtitles) VALUES ('{$showid}', '{$quality}', '{$sublanguage}')"); if ($from == 1) { $q = mysql_query("SELECT * FROM torrents WHERE quality = '{$quality}' AND showid = '{$showid}' AND ((season = {$season} AND episode >= {$id}) OR (season > {$season})) ORDER BY season, episode"); if (mysql_num_rows($q)) { while ($row = mysql_fetch_array($q, MYSQL_ASSOC)) { addTorrent($row['showid'], $row['season'], $row['id'], $row['torrentlink']); } } } } } echo "<br />\nsubscriptions (showid) VALUES ('{$showid}')";