<?PHP
@ini_set('error_reporting', E_ALL ^
E_WARNING ^
E_NOTICE);
define('DATALIFEENGINE', true);
$member_id = false;
$is_logged = false;
define('ENGINE_DIR', ROOT_DIR
.'/engine');
@include (ENGINE_DIR.'/data/config.php');
require_once ENGINE_DIR.'/classes/mysql.php';
require_once ENGINE_DIR.'/data/dbconfig.php';
require_once ENGINE_DIR.'/modules/functions.php';
function UTF8toCP1251($str)
{
static
$table = array("\xD0\x81" => "\xA8", // Ё "\xD1\x91" => "\xB8", // ё
// украинские символы
"\xD0\x8E" => "\xA1", // Ў (У)
"\xD1\x9E" => "\xA2", // ў (у)
"\xD0\x84" => "\xAA", // Є (Э)
"\xD0\x87" => "\xAF", // Ї (I..)
"\xD0\x86" => "\xB2", // I (I)
"\xD1\x96" => "\xB3", // i (i)
"\xD1\x94" => "\xBA", // є (э)
"\xD1\x97" => "\xBF", // ї (i..)
// чувашские символы
"\xD3\x90" => "\x8C", // Ӑ (А)
"\xD3\x96" => "\x8D", // Ӗ (Е)
"\xD2\xAA" => "\x8E", // Ҫ (С)
"\xD3\xB2" => "\x8F", // Ӳ (У)
"\xD3\x91" => "\x9C", // ӑ (а)
"\xD3\x97" => "\x9D", // ӗ (е)
"\xD2\xAB" => "\x9E", // ҫ (с)
"\xD3\xB3" => "\x9F", // ӳ (у)
);
return preg_replace('#([\xD0-\xD1])([\x80-\xBF])#se', 'isset($table["$0"]) ? $table["$0"] : chr(ord("$2")+("$1" == "\xD0" ? 0x30 : 0x70))
', $str
);
}
function search_torrent($query)
{
$querys = "POST http://rutor.org/search/0/0/100/0/$query HTTP/1.0\r\n".
"Referer: http \r\n".
"User-Agent: Mozilla/4.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20036725 Firefox/2.0.0.1\r\n".
"Host: rutor.org\r\n".
"Accept: text/html;q=0.1\r\n".
"Accept-Language: ru,en;q=0.9\r\n".
"Accept-Charset: windows-1251;q=0.6, *;q=0.1\r\n".
"Proxy-Connection: close\r\n".
"Content-Type: application/x-www-form-urlencoded\r\n".
"Content-Length: "."1"."\r\n\r\n".
$posts."\r\n\r\n";
$socket = fsockopen('rutor.org', 80
, $errno, $errstr, 120
);
}
$result = $s;
$result = UTF8toCP1251($result);
$find2 = "";
$p1 = strpos($result, "<table width=\"100%\"><tr class=\"backgr\">"); $p2 = strpos($result, "</table><b>Страницы"); $result = substr($result, $p1, $p2 - $p1);
preg_match_all('#<a class="downgif" href="http://d.rutor.org/download/(.[0-9]*)"><img src="http://s.rutor.org/i/d.gif" alt="D" /></a>(.*)<a href="/torrent/(.*)">(.*)</a></td>(.*)<td align="right">([0-9]*..?[0-9]+.?) (.[A-Z]*)</td><td align="center"><span class="green"><img src="http://s.rutor.org/t/arrowup.gif" alt="S" /> (.[0-9]*)</span> <img src="http://s.rutor.org/t/arrowdown.gif" alt="L" /><span class="red"> (.[0-9]*)</span></td></tr>#Uis', $result, $find);
$i = -1;
$find2 = "";
while ($i < $count - 1) {
if($is==5)break;
$i++;
$find['2'][$i] = str_replace("http://s.rutor.org/i/m.png", "/magnet.png", $find['2'][$i]); $find['2'][$i] = str_replace("magnet:", "magnet:", $find['2'][$i]); $is = $i + 1;
$find2 .= <<<HTML
<tr>
<th><center>{$is}<center></th>
<th>{$find['4'][$i]} <a href="http://rutor.org/download/{$find['1'][$i]}"><img title="Скачать без регистрации торрент" src="/download.png" alt="Скачать без регистрации торрент"></a> {$find['2'][$i]}</th>
<th>{$find['6'][$i]} {$find['7'][$i]}</th>
<th>{$find['8'][$i]}</th>
<th>{$find['9'][$i]}</th>
</tr>
HTML;
}
// $find2 = $result;
if (!$find2 or $find2 == "") {
$finds = "<br><br><p style=\"text-align: center;\"><span style=\"font-size: medium;\"><strong><span style=\"color: #ff0000;\">Внимание:</span></strong> Не удалось отобразить раздачу! Обновите страницу!</span></p><br><br>";
} else {
$finds = <<<HTML
<style type="text/css">
.restable {
border-left: 1px solid #ebebeb;
border-right: 1px solid #ebebeb;
}
.restable th {
width: 100px;
padding: 6px;
text-align: left;
}
.restable thead tr {
cursor: pointer;
background: #97d234;
border: 1px solid #5ea007;
border-radius: 5px;
color: #fff;
text-shadow: 1px 1px 2px black;
}
.restable a {
text-decoration:none;
}
.restable a:hover {
text-decoration:underline;
}
.restable tr:nth-child(2n) {
background-color:#f7f7f7;
}
.restable tr {
background-color:#fefefe;
}
.restable tbody tr:hover {
background-color:#e7e7e7;
}
.restable td {
padding:6px;
vertical-align:middle;
border-bottom: 1px solid #cccccc;
color: #333333;
font-size:12px;
}
#pselect {
display: inline;
padding: 5px 12px;
background: #ebebeb;
border-bottom: 1px solid rgba(0, 0, 0, 0.251);
cursor: pointer;
border-radius: 5px;
color: #808080;
text-shadow: white 0px 1px 2px;
margin: 3px;
font-size: 15px;
}
#pselect.active, #pselect:hover {
background: #97d234 !important;
border-bottom: 1px solid rgba(0, 0, 0, 0.251);
text-shadow: 1px 1px 2px black;
color: #fff !important;
}
.restable th {
white-space: inherit;
}
.restable th > span {
background: url("/img/nosorted.gif") 0px 50% no-repeat;
padding-left: 8px;
}
.restable .up > span {
background: url("/img/down.gif") 0px 50% no-repeat;
padding-left: 8px;
}
.restable .down > span {
background: url("/img/up.gif") 0px 50% no-repeat;
padding-left: 8px;
}
.restable b {
background: #e4ffb5;
}
.restable a:hover {
color: #5f8f0b;
}
</style>
<table style="width:100%;" class="restable">
<thead>
<tr>
<th style="width:30px;text-align:center;">№<span> </span></th>
<th style="width:500px;">Название торрент раздачи<span> </span></th>
<th style="width:40px;">Размер <span> </span></th>
<th style="width:50px;">Сиды <span> </span></th>
<th style="width:50px;">Пиры <span> </span></th>
</tr>
</thead>
<tbody>
{$find2}
</tbody>
</table>
HTML;
}
return ($finds);
}
@header("Content-type: text/html; charset=".$config['charset']); echo search_torrent($title);