SuffeRiNG64
Писатель
- Регистрация
- 21 Сен 2009
- Сообщения
- 2
- Реакции
- 7
- Автор темы
- #1
Народ кто может выложить рабочию версию этого мода у меня есть но не дописанный
Follow along with the video below to see how to install our site as a web app on your home screen.
Примечание: This feature may not be available in some browsers.
За 10 баксов могу дать Мультитрекер от qwertzuiop
ALTER TABLE `torrents` ADD `external` enum('yes','no') NOT NULL default 'no';
ALTER TABLE `torrents` ADD `leechers-net` int(10) NOT NULL;
ALTER TABLE `torrents` ADD `seeders-net` int(10) NOT NULL;
ALTER TABLE `torrents` ADD `seeders_net` text NOT NULL;
ALTER TABLE `torrents` ADD `leechers_net` text NOT NULL;
ALTER TABLE `torrents` ADD `announce_url` text NOT NULL;
ALTER TABLE `torrents` ADD `active_trackers` text NOT NULL;
ALTER TABLE `torrents` ADD `times_completed_net` text NOT NULL;
/*if (!preg_match(':^/(\d{1,10})/(.+)\.torrent$:', $_SERVER["PATH_INFO"], $matches))
httperr();*/
/*$id = 0 + $matches[1];
if (!$id)
httperr();*/
$res = sql_query("SELECT name FROM torrents WHERE id = ".sqlesc($id)) or sqlerr(__FILE__, __LINE__);
$res = sql_query("SELECT name, external FROM torrents WHERE id = ".sqlesc($id)) or sqlerr(__FILE__, __LINE__);
require_once "include/benc.php";
if (strlen($CURUSER['passkey']) != 32) {
$CURUSER['passkey'] = md5($CURUSER['username'].get_date_time().$CURUSER['passhash']);
sql_query("UPDATE users SET passkey=".sqlesc($CURUSER[passkey])." WHERE id=".sqlesc($CURUSER[id]));
}
require_once ($EXTTOR_FUNC_DIR . "/BDecode.php");
require_once ($EXTTOR_FUNC_DIR . "/BEncode.php");
$fd = fopen($fn, "r") or stderr($tracker_lang['error'], "file-download-error No. 1");
$length=filesize($fn);
if ($length) $alltorrent = fread($fd, $length);
else stderr($tracker_lang['error'], "file-download-error No. 2");
$array = BDecode($alltorrent);
/*if(isset($array["announce"])){
if(preg_match('/$DEFAULTBASEURL/', $array["announce"]))
$array["announce"] = $DEFAULTBASEURL."/announce.php?passkey=".$CURUSER["passkey"]; else{
if(count($array["announce-list"]) > 0){
foreach($array["announce-list"] as $i => $ann){
if(preg_match('/$DEFAULTBASEURL/', $ann[0])){
$array["announce-list"][$i][0] = $DEFAULTBASEURL."/announce.php?passkey=".$CURUSER["passkey"];
$put = true;
break;}}
if(!$put) $array["announce-list"][count($array["announce-list"])][0] = $DEFAULTBASEURL."/announce.php?passkey=".$CURUSER["passkey"];}
else $array["announce-list"][0][0] = $DEFAULTBASEURL."/announce.php?passkey=".$CURUSER["passkey"];
}}
else $array["announce"] = $DEFAULTBASEURL."/announce.php?passkey=".$CURUSER["passkey"];*/
if($row["external"] == "yes")
$array["announce-list"][0][0] = $DEFAULTBASEURL."/announce.php?passkey=".$CURUSER["passkey"];
else
$array["announce"] = $DEFAULTBASEURL."/announce.php?passkey=".$CURUSER["passkey"];
/*
$dict['value']['announce']['strlen'] = strlen($dict['value']['announce']['string']);
*/
Найти:
ob_implicit_flush(true);
После вставить:
print(BEncode($array));
Найти:
print(benc($dict));
Заменить на:
//print(benc($dict));
torrents.leechers,
torrents.seeders_net, torrents.leechers_net, torrents.times_completed_net, torrents.external, torrents.active_trackers, torrents.announce_url,
$coo_ch = $_COOKIE['torrents_vis'];
setcookie("torrents_vis", ($coo_ch ? $coo_ch. "A" .$id : $id));
sql_query("UPDATE torrents SET views = views + 1 WHERE id = $id");
}
if($_GET["update"]){
require_once ($EXTTOR_FUNC_DIR . "/BDecode.php");
require_once ($EXTTOR_FUNC_DIR . "/BEncode.php");
$fd = fopen("torrents/" .$id. ".torrent", "rb");
$length=filesize("torrents/" .$id. ".torrent");
if ($length)
$alltorrent = fread($fd, $length);
$array = BDecode($alltorrent);
$hash = sha1(BEncode($array["info"]));
require_once($EXTTOR_FUNC_DIR . "/getscrape.php");
scrape($row["announce_url"], $hash);
header("Location: $DEFAULTBASEURL/details.php?id=" . $id);}
<b>В раздаче:</b> <img src=\"pic/upload.png\">".$row["seeders"]." Раздают <img src=\"pic/download.png\"> ".$row["leechers"]." Качают <img src=\"pic/tick.png\"> Скачан ".$row["times_completed"]." Раз<br>
<b>В раздаче:</b> <img src=\"pic/upload.png\">".($row["seeders"]+$row["seeders_net"])." Раздают <img src=\"pic/download.png\"> ".($row["leechers"]+$row["leechers_net"])." Качают <img src=\"pic/tick.png\"> Скачан ".($row["times_completed"]+$row["times_completed_net"])." Раз<br>
<div id=\"ss7\" style=\"display: none;\">".$img2." ".$img3." ".$img4."</div>
</td>
</tr>
</table>
</td>");
print("</tr>");
<div id=\"ss7\" style=\"display: none;\">".$img2." ".$img3." ".$img4."</div>
</td>
</tr>");
/*
</table>
</td>
print("</tr>");
*/
$actEx = array();
if($row["external"] == 'yes'){
if($row["active_trackers"] != ""){
$dSLC = array();
$gotInfo = 0;
$trackers = explode("<|>", $row["active_trackers"]);
foreach($trackers as $tr){
$details = explode("---", $tr);
$detailsPeers = explode(",", $details[1]);
if(count($detailsPeers) > 1)
{
$actEx[] = "<li><b>".$details[0]."</b> - сидов: ".$detailsPeers[0].", личеров: ".$detailsPeers[1].", скачано: ".$detailsPeers[2]."</li>";
$dSLC["s"] = $dSLC["s"] + $detailsPeers[0];
$dSLC["l"] = $dSLC["l"] + $detailsPeers[1];
$dSLC["c"] = $dSLC["c"] + $detailsPeers[2];
$gotInfo++;
}
else
$actEx[] = "<li><b>".$details[0]."</b> - ".$detailsPeers[0]."</li>";
}}
?>
<style type="text/css">
.trackers {
margin: 0em;
padding: 0px;
border: 0;
}
.trackers ul {
border-style: none;
}
.trackers li {
border-style: none;
}
</style>
<?
$http_url = preg_replace("/http:\/\//", "", $row["announce_url"]);$site_pos = strpos($http_url, "/");$siteW = substr($http_url, 0, -(strlen($http_url) - $site_pos));$site = preg_replace("/www\./","",$siteW);
print("<tr>
<td style=\"border: 0px; border-left: 3px solid #C4D6DD; background-color: #FFFFFF;\" colspan=\"1\" width=\"25%\">Экстерные трекера<br /><a href='details.php?id=".$id."&update=yes' class='sublink'>[обновить]</a></td><td style=\"border: 0px;\">".$site."</td></tr></table></td></tr>");
}
tr($tracker_lang['downloading']."<br /><a href=\"details.php?id=$id&dllist=1$keepget#seeders\" class=\"sublink\">[".$tracker_lang['open_list']."]</a>", $row["seeders"] . " ".$tracker_lang['seeders_l'].", " . $row["leechers"] . " ".$tracker_lang['leechers_l']." = " . ($row["seeders"] + $row["leechers"]) . " ".$tracker_lang['peers_l'], 1);
elseif ($_GET["incldead"] == 3)
{
$addparam .= "incldead=3&";
$wherea[] = "free = 'yes'";
$wherea[] = "visible = 'yes'";
}
elseif ($_GET["incldead"] == 3)
{
$addparam .= "incldead=3&";
$wherea[] = "free = 'yes'";
}
elseif ($_GET["incldead"] == 4)
{
$addparam .= "incldead=4&";
$wherea[] = "seeders = 0";
$wherea[] = "visible = 'yes'";
}
else
$wherea[] = "visible = 'yes'";
elseif ($_GET["incldead"] == 4)
{
$addparam .= "incldead=4&";
$wherea[] = "seeders = 0";
}
else
$wherea[] = "visible = 'yes' OR external = 'yes'";
torrents.filename,
torrents.seeders_net, torrents.leechers_net, torrents.times_completed_net, torrents.external,
$dict = bdec_file($tmpname, $max_torrent_size);
if (!isset($dict))
bark("Что за хрень ты загружаешь? Это не бинарно-кодированый файл!");
require_once ($EXTTOR_FUNC_DIR . "/BDecode.php");
require_once ($EXTTOR_FUNC_DIR . "/BEncode.php");
if (isset($_FILES["tfile"]))
{
$f = $_FILES["tfile"];
$fname = unesc($f["name"]);
if ($_FILES["tfile"]["error"] != 4)
{
$fd = fopen($_FILES["tfile"]["tmp_name"], "rb") or bark("file-upload-error No. 1");
is_uploaded_file($_FILES["tfile"]["tmp_name"]) or bark("file-upload-error No. 2");
$length=filesize($_FILES["tfile"]["tmp_name"]);
if ($length)
$alltorrent = fread($fd, $length);
else
bark("file-upload-error No. 3");
$array = BDecode($alltorrent);
if (!isset($array))
bark("parser-error");
if (!$array)
bark("parser-error");
if (in_array($array["announce"],$TRACKER_ANNOUNCEURLS) && $DHT_PRIVATE || !$array["announce"])
{
$array["info"]["private"]=1;
$hash=$_FILES["tfile"]["name"];
}
else
$hash = $_FILES["tfile"]["name"];
fclose($fd);
}
if (isset($hash) && $hash) $url = "torrents/" . $hash;
else $url = 0;
if (isset($array["comment"]))
$info = mysql_escape_string(htmlspecialchars($array["comment"]));
else $info = "";
if (isset($array["info"]) && $array["info"]) $upfile=$array["info"];
else $upfile = 0;
if (isset($upfile["length"]))
$size = (float)($upfile["length"]);
else if (isset($upfile["files"]))
{
$size=0;
foreach ($upfile["files"] as $file)
$size+=(float)($file["length"]);
}
else $size = "0";
$announce[] = str_replace(array("\r\n","\r","\n"),"",$array["announce"]);
if($array["announce-list"])
{
foreach($array["announce-list"] as $ky => $va)
{
if($va[0] != $announce[0])
$announce[] = $va[0];
}
}
if (!in_array($announce,$TRACKER_ANNOUNCEURLS) && $EXTERNAL_TORRENTS==false)
{
unlink($_FILES["tfile"]["tmp_name"]);
bark("External torrents are currently not allowed!");
}
if (in_array($announce,$TRACKER_ANNOUNCEURLS) || !$array["announce"]){
$internal=true;
}else
{
$internal=false;
if (isset($array["announce-list"]) && is_array($array["announce-list"]) || !$array["announce"])
{
for ($i=0;$i<count($array["announce-list"]);$i++)
{
if (in_array($array["announce-list"][$i][0],$TRACKER_ANNOUNCEURLS) || !$array["announce"])
{
$internal = true;
continue;
}
}
}
if ($internal) $array["announce"]=$TRACKER_ANNOUNCEURLS[0];
}
$infohash = $info["string"];
$filesArray = $array["info"]["files"];
if(count($filesArray) > 1) $type = 'multi';
else $type = 'single';
$infohash = sha1(BEncode($array["info"]));
} else
bark("Файл не загружен. Пустое имя файла!");
function dict_check($d, $s) {
if ($d["type"] != "dictionary")
bark("not a dictionary");
$a = explode(":", $s);
$dd = $d["value"];
$ret = array();
foreach ($a as $k) {
unset($t);
if (preg_match('/^(.*)\((.*)\)$/', $k, $m)) {
$k = $m[1];
$t = $m[2];
}
if (!isset($dd[$k]))
bark("dictionary is missing key(s)");
if (isset($t)) {
if ($dd[$k]["type"] != $t)
bark("invalid entry in dictionary");
$ret[] = $dd[$k]["value"];
}
else
$ret[] = $dd[$k];
}
return $ret;
}
function dict_get($d, $k, $t) {
if ($d["type"] != "dictionary")
bark("not a dictionary");
$dd = $d["value"];
if (!isset($dd[$k]))
return;
$v = $dd[$k];
if ($v["type"] != $t)
bark("invalid dictionary entry type");
return $v["value"];
}
list($info) = dict_check($dict, "info");
list($dname, $plen, $pieces) = dict_check($info, "name(string):piece length(integer):pieces(string)");
/*if (!in_array($ann, $announce_urls, 1))
bark("Неверный Announce URL! Должен быть ".$announce_urls[0]);*/
if (strlen($pieces) % 20 != 0)
bark("invalid pieces");
$filelist = array();
$totallen = dict_get($info, "length", "integer");
if (isset($totallen)) {
$filelist[] = array($dname, $totallen);
$type = "single";
} else {
$flist = dict_get($info, "files", "list");
if (!isset($flist))
bark("missing both length and files");
if (!count($flist))
bark("no files");
$totallen = 0;
foreach ($flist as $fn) {
list($ll, $ff) = dict_check($fn, "length(integer):path(list)");
$totallen += $ll;
$ffa = array();
foreach ($ff as $ffe) {
if ($ffe["type"] != "string")
bark("filename error");
$ffa[] = $ffe["value"];
}
if (!count($ffa))
bark("filename error");
$ffe = implode("/", $ffa);
$filelist[] = array($ffe, $ll);
if ($ffe == 'Thumbs.db')
{
stderr("Ошибка", "В торрентах запрещено держать файлы Thumbs.db!");
die;
}
}
$type = "multi";
}
$dict['value']['announce']=bdec(benc_str($announce_urls[0])); // change announce url to local
$dict['value']['info']['value']['private']=bdec('i1e'); // add private tracker flag
$dict['value']['info']['value']['source']=bdec(benc_str( "[$DEFAULTBASEURL] $SITENAME")); // add link for bitcomet users
unset($dict['value']['announce-list']); // remove multi-tracker capability
unset($dict['value']['nodes']); // remove cached peers (Bitcomet & Azareus)
unset($dict['value']['info']['value']['crc32']); // remove crc32
unset($dict['value']['info']['value']['ed2k']); // remove ed2k
unset($dict['value']['info']['value']['md5sum']); // remove md5sum
unset($dict['value']['info']['value']['sha1']); // remove sha1
unset($dict['value']['info']['value']['tiger']); // remove tiger
unset($dict['value']['azureus_properties']); // remove azureus properties
$dict=bdec(benc($dict)); // double up on the becoding solves the occassional misgenerated infohash
$dict['value']['comment']=bdec(benc_str( "Торрент создан для '$SITENAME'")); // change torrent comment
$dict['value']['created by']=bdec(benc_str( "$CURUSER[username]")); // change created by
$dict['value']['publisher']=bdec(benc_str( "$CURUSER[username]")); // change publisher
$dict['value']['publisher.utf-8']=bdec(benc_str( "$CURUSER[username]")); // change publisher.utf-8
$dict['value']['publisher-url']=bdec(benc_str( "$DEFAULTBASEURL/userdetails.php?id=$CURUSER[id]")); // change publisher-url
$dict['value']['publisher-url.utf-8']=bdec(benc_str( "$DEFAULTBASEURL/userdetails.php?id=$CURUSER[id]")); // change publisher-url.utf-8
list($info) = dict_check($dict, "info");
$infohash = sha1($info["string"]);
$ret = sql_query("INSERT INTO torrents (search_text, filename, owner, visible, sticky, info_hash, name, size, numfiles, type, descr, ori_descr, free, image1, image2, category, save_as, added, last_action) VALUES (" . implode(",", array_map("sqlesc", array(searchfield("$shortfname $dname $torrent"), $fname, $CURUSER["id"], "no", $sticky, $infohash, $torrent, $totallen, count($filelist), $type, $descr, $descr, $free, $inames[0], $inames[1], 0 + $_POST["type"], $dname))) . ", '" . get_date_time() . "', '" . get_date_time() . "')");
$ret = sql_query("INSERT INTO torrents (search_text, filename, owner, visible, sticky, info_hash, name, size, numfiles, type, descr, ori_descr, free, image1, image2, category, save_as, added, last_action, external, announce_url) VALUES (" . implode(",", array_map("sqlesc", array(searchfield("$shortfname $dname $torrent"), $fname, $CURUSER["id"], "no", $sticky, $infohash, $torrent, $size, count($filesArray), $type, $descr, $descr, $free, $inames[0], $inames[1], 0 + $_POST["type"], $dname))) . ", '" . get_date_time() . "', '" . get_date_time() . "', " .($internal ? "'no'" : "'yes'"). ", '" . implode(" , ", $announce) . "')");
$id = mysql_insert_id();
$mf=@move_uploaded_file($_FILES["tfile"]["tmp_name"] , "torrents/" . $id . ".torrent");
if (!$mf)
{
bark("error by moving the torrent-file");
}
@chmod("torrents/" . $id . ".torrent",0766);
if (!$internal)
{
$hash = sha1(BEncode($array["info"]));
require_once($EXTTOR_FUNC_DIR . "/getscrape.php");
scrape(implode(" , ", $announce), $hash);
$status=2;
}
foreach ($filelist as $file) {
@sql_query("INSERT INTO files (torrent, filename, size) VALUES ($id, ".sqlesc($file[0]).",".$file[1].")");
}
move_uploaded_file($tmpname, "$torrent_dir/$id.torrent");
$fp = fopen("$torrent_dir/$id.torrent", "w");
if ($fp)
{
@fwrite($fp, benc($dict), strlen(benc($dict)));
fclose($fp);
}
if(count($filesArray) > 1)
{
for($i=0;$i<count($filesArray);$i++)
{
@sql_query("INSERT INTO files (torrent, filename, size) VALUES ($id, ".sqlesc($filesArray[$i]["path"][0]).",".$filesArray[$i]["length"].")");
}
}
while ($row = mysql_fetch_assoc($res)) {
$id = $row["id"];
print("<tr".($row["sticky"] == "yes" ? " class=\"highlight\"" : "").">\n");
$row["seeders"] = $row["seeders"] + $row["seeders_net"];
$row["leechers"] = $row["leechers"] + $row["leechers_net"];
$thisisfree = ($row[free]=="yes" ? "<img src=\"pic/freedownload.gif\" title=\"".$tracker_lang['golden']."\" alt=\"".$tracker_lang['golden']."\">" : "");
$isExtern = ($row["external"]=="yes" ? "<img src=\"pic/multi.png\" title=\"Екстерный торрент\" alt=\"Екстерный торрент\"> " : " ");
$autoclean_interval = 900;
$pic_base_url = "./pic/";
$EXTTOR_FUNC_DIR = "include/ext_tor-funcs/";
$TRACKER_ANNOUNCEURLS = array ( $BASEURL."/announce.php" );
$EXTERNAL_TORRENTS = true;
tr($tracker_lang['torrent_file'], "<input type=file name=tfile size=80>\n", 1);
if (get_user_class() >= UC_USER)
tr("Торрент", "<input type=file name=tfile size=60><br/><input type=\"checkbox\" name=\"multi\" value=\"yes\"> Мультитрекерный торрент<br/><small>Отметьте эту галочку, если ваш торрент скачан с другого трекера", 1);
tr($tracker_lang['torrent_file'], "<input type=file name=tfile size=80>\n", 1);
if (get_user_class() >= UC_USER)
tr("Торрент", "<input type=file name=tfile size=60><br/><input type=\"checkbox\" name=\"multi\" value=\"yes\"> Мультитрекерный торрент<br/><small>Отметьте эту галочку, если ваш торрент скачан с другого трекера", 1);
ха, моя кнопка мультитрекерности, стырили с битторрента
ахахахахахахах 10 баксов ахахахахах он НА БИТ_ТОРРЕНТЕ БЕСПЛАТНО ОТ самого же автора ЛОЛЛЛЛЛЛ
скорее нет, по дефолту свое хочется людям.А не проще взять полностью двигу Kinokpk!с мультитрекером защитой и более лучшей оптимизацией!(по дефолту)