if ($ret['seeds'] === null) {
$ret['seeds'] = -1;
$ret['peers'] = -1;
$ret['downloaded'] = -1;
}
<?php
#============================#
# TorrentTrader v2.08 #
# http://torrenttrader.org #
#----------------------------#
# Modified by NordicWolf #
#============================#
require_once("backend/functions.php");
require_once("backend/BDecode.php");
require_once("backend/parse.php");
require_once("backend/udptscraper.php");
dbconn(false);
loggedinonly();
set_time_limit(0);
$interval = 1200; // Rescrape torrents every 2 hours
$ts = gmtime() - $interval;
$res = SQL_Query_exec("SELECT id, name, info_hash FROM torrents WHERE external = 'yes' ORDER BY last_action ASC LIMIT 1");
$count = get_row_count("torrents", "WHERE external = 'yes' ");
while ($row = mysql_fetch_array($res))
{
$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);
// edit
$seeders = $leechers = $downloaded = 0;
// $seeders = $leechers = $downloaded = null;
echo "<link href='themes/ExYu-Subs/css/ttce.css' rel='stylesheet'> ";
//stdhead();
//begin_frame("Mega Scrape");
echo "<div class='torrent-category-detail clearfix'>
<table width='90%' align='center' border='0' class='account'><td class='css'>Torrent ID:</td><td class='css' colspan='4' align='center'><font color='#00ff00'> $row[id] </font></td> <td class='css-right'><font color=#708090> $row[name]</font></td></tr>
<tr><td class='css' colspan='3'>Info Hash:</td> <td class='css-right' colspan='3'><font color=#00ff00> $row[info_hash]</font></td></tr>";
foreach ($annlist as $ann)
{
$tracker = explode("/", $ann);
$path = array_pop($tracker);
$oldpath = $path;
$path = str_replace("announce", "scrape", $path);
$tracker = implode("/", $tracker)."/".$path;
if ($oldpath == $path)
{
//echo "<tr><td class='css' colspan='3'>$ann :</td><td class='css-right' colspan='3'><font color=#00fff0> Scrape not supported.</font></td></tr>";
continue;
}
// TPB's tracker is dead. Use openbittorrent instead
if ($openbittorrent_done)
continue;
if (preg_match("/thepiratebay.org/i", $tracker) || preg_match("/prq.to/", $tracker))
{
$tracker = "http://tracker.openbittorrent.com/scrape";
$openbittorrent_done = 1;
}
if(preg_match('%udp://([^:/]*)(?::([0-9]*))?(?:/)?%si', $tracker))
{
$udp=true;
try
{
$timeout = 3;
$udp= new udptscraper($timeout);
$stats=$udp->scrape($tracker,$row["info_hash"]);
foreach ($stats as $id=>$scrape)
{
$seeders += $scrape['seeders'];
$leechers += $scrape['leechers'];
$downloaded += $scrape['completed'];
}
}
catch(ScraperException $e)
{
//echo('<tr><td class=css colspan=3>Error:</td><td class=css-right colspan=3><font color=#0000ff> ' . $e->getMessage() . "</font></td></tr>\n");
//echo('<tr><td class=css colspan=3>Connection error:</td><td class=css-right colspan=3><font color=#0000ff> ' . ($e->isConnectionError() ? 'yes' : 'no') . "</font></td></tr>\n");
}
}
else
{
$stats = torrent_scrape_url($tracker, $row["info_hash"]);
}
// edit
if ($stats['seeds'] !== 0)
//if ($stats['seeds'] !== null)
{
$seeders += $stats['seeds'];
$leechers += $stats['peers'];
$downloaded += $stats['downloaded'];
echo "<br><b>$ann</b><br>";
echo "<tr><td class='css' colspan='3'>Seeders:</td> <td class='css-right' colspan='3'> ".($udp?$scrape['seeders']:$stats["seeds"])."</td></tr>";
echo "<tr><td class='css' colspan='3'>Leechers:</td> <td class='css-right' colspan='3'> ".($udp?$scrape['leechers']:$stats["peers"])."</td></tr>";
echo "<tr><td class='css' colspan='3'>Downloaded:</td> <td class='css-right' colspan='3'> ".($udp?$scrape['completed']:$stats["downloaded"])."</td></tr></table>";
// edit
SQL_Query_exec("UPDATE `announce` SET `online` = 'yes', `seeders` = $seeders, `leechers` = $leechers, `times_completed` = $downloaded WHERE `url` = ".sqlesc($ann)." AND `torrent` = $row[id]");
// SQL_Query_exec("UPDATE `announce` SET `online` = 'yes', `seeders` = $stats[seeds], `leechers` = $stats[peers], `times_completed` = $stats[downloaded] WHERE `url` = ".sqlesc($ann)." AND `torrent` = $row[id]");
}
else
{
//echo "<tr><td class='css' colspan='3'> $ann :</td> <td class='css-right' colspan='3'><font color=#ff0000>Tracker timed out.</font></td></tr>";
SQL_Query_exec("UPDATE `announce` SET `online` = 'no' WHERE `url` = ".sqlesc($ann)." AND `torrent` = $row[id]");
}
}
// edit
if ($seeders !== 0)
//if ($seeders !== null)
{
echo "<tr><td class='css-right' colspan='6'>Totals:</td></tr>";
echo "<tr><td class='css' colspan='3'>Seeders:</td> <td class='css-right' colspan='3'><font color='#006699'> $seeders </font></td></tr>";
echo"<tr><td class='css' colspan='3'>Leechers:</td> <td class='css-right' colspan='3'><font color='#00ff00'> $leechers </font></td></tr>";
echo "<tr><td class='css' colspan='3'>Completed:</td> <td class='css-right' colspan='3'><font color='#FF9900'> $downloaded </font></td></tr>";
SQL_Query_exec("UPDATE torrents SET leechers = '".$leechers."', seeders = '".$seeders."', times_completed = '".$downloaded."', last_action = '".get_date_time()."', visible = 'yes' WHERE id = '".$row['id']."'");
}
else
{
echo "<br><b><font color=red>All trackers are timed out.</font></b><br>";
echo "</div>";
//end_frame();
//stdfoot();
SQL_Query_exec("UPDATE torrents SET last_action = '".get_date_time()."' WHERE id = '".$row['id']."'");
}
}
?>
<script language="JavaScript">
//configure refresh interval (in seconds)
<?php if ($count)
echo "var countDownInterval = 1;";
else
echo "var countDownInterval = 1800;"; // No torrents to scrape, refresh in 30 minutes
?>
//configure width of displayed text, in px (applicable only in NS4)
var c_reloadwidth=500
</script>
<!-- <ilayer id="c_reload" width=&{c_reloadwidth}; ><layer id="c_reload2" width=&{c_reloadwidth}; left=0 top=0></layer></ilayer> -->
<script>
var countDownTime=countDownInterval+1;
function countDown(){
countDownTime--;
if (countDownTime <=0){
countDownTime=countDownInterval;
clearTimeout(counter)
window.location.reload()
return
}
if (document.all) //if IE 4+
document.all.countDownText.innerText = countDownTime+" ";
else if (document.getElementById) //else if NS6+
document.getElementById("countDownText").innerHTML=countDownTime+" "
else if (document.layers){ //CHANGE TEXT BELOW TO YOUR OWN
document.c_reload.document.c_reload2.document.write('<tr><td class="css" colspan="3">Next <a href="java script:window.location.reload()">refresh</a> in</td><td class="css-right" colspan="3"> <b id="countDownText">'+countDownTime+' </b> seconds </td></tr>')
document.c_reload.document.c_reload2.document.close()
}
counter=setTimeout("countDown()", 1000);
}
function startit(){
if (document.all||document.getElementById) //CHANGE TEXT BELOW TO YOUR OWN
document.write('<tr><td class="css" colspan="3">Next <a href="java script:window.location.reload()"> refresh </a> in</td><td class="css-right" colspan="3"> <b id="countDownText">'+countDownTime+' </b> seconds </td></tr>')
countDown()
}
if (document.all||document.getElementById)
startit()
else
window.onload=startit
</script>
$seeders = $leechers = $downloaded = 0;$seeders = $leechers = $downloaded = 2; `times_completed` = WHERE $stats[downloaded]$stats[downloaded] = 0;function getexttype($ext = '')
{
$ext = strtolower($ext);
$music = array('mp3', 'wav', 'flac', 'm3u');
$video = array('mp4', 'avi', 'mkv', 'flv', 'wmv');
$file = array('txt', 'pdf', 'doc', 'zip', 'nfo', 'srt', 'exe');
$image = array('jpeg', 'gif', 'png');
if ($ext == false || $ext == '') {
$filetype_icon = " <i class='fa fa-question'></i>";
} else if (in_array($ext, $music)) {
$filetype_icon = " <i class='fa fa-music'></i>";
} else if (in_array($ext, $video)) {
$filetype_icon = " <i class='fa fa-film'></i>";
} else if (in_array($ext, $file)) {
$filetype_icon = " <i class='fa fa-file'></i>";
} else if (in_array($ext, $image)) {
$filetype_icon = " <i class='fa fa-picture-o'></i>";
}
return $filetype_icon;
}while ($frow = mysqli_fetch_assoc($fres)) {
echo "<tr><td class='table_col1'>while ($frow = mysqli_fetch_assoc($fres)) {
$ext = pathinfo($frow['path'], PATHINFO_EXTENSION);
$filetype_icon = getexttype($ext);
echo "<tr><td class='table_col1'>" . $filetype_icon . "</td>$query1 = str_replace(" ", ".", sqlesc("%" . $searchname . "%"));
$genre = str_replace(".", " ", sqlesc("%" . $row['genre'] . "%"));
$r = SQL_Query_exec("SELECT torrents.genre, torrents.id, torrents.name, torrents.genre, torrents.size, torrents.added, torrents.seeders, torrents.leechers, torrents.category, categories.image
FROM torrents
LEFT JOIN categories ON torrents.category = categories.id
WHERE (torrents.genre LIKE {$genre})
LIMIT 10"); // /////ADD genre pulled from the IMDB and put it in the stupid database as genre
if ($row["genre"]='NULL'){
SQL_Query_exec("UPDATE `torrents` SET `genre` = '".mysqli_real_escape_string ($GLOBALS["DBconnector"],$_data->Genre). "' WHERE `id` = $id");
}
/////END genre// /////ADD genre pulled from the IMDB and put it in the stupid database as genre
if ($row["genre"]='NULL'){
$str = strstr($_data->Genre, ',', true);
SQL_Query_exec("UPDATE `torrents` SET `genre` = '".mysqli_real_escape_string ($GLOBALS["DBconnector"],$str). "' WHERE `id` = $id");
}
/////END genre $query1 = str_replace(" ", ".", sqlesc("%" . $searchname . "%"));
$genre = str_replace(".", " ", sqlesc("%" . $row['genre'] . "%"));
$r = SQL_Query_exec("SELECT torrents.genre, torrents.id, torrents.name, torrents.genre, torrents.size, torrents.added, torrents.seeders, torrents.leechers, torrents.category, categories.image
FROM torrents
LEFT JOIN categories ON torrents.category = categories.id
WHERE (torrents.name
LIKE {$query1})
OR (torrents.genre LIKE {$genre})
LIMIT 10"); $query1 = str_replace(" ", ".", sqlesc("%" . $searchname . "%"));
$query2 = str_replace(".", " ", sqlesc("%" . $searchname . "%"));
$catid = str_replace(".", " ", sqlesc("%" . $row['category'] . "%"));
$genre = str_replace(".", " ", sqlesc("%" . $row['genre'] . "%"));
$r = SQL_Query_exec("SELECT torrents.id, torrents.name, torrents.genre, torrents.size, torrents.added, torrents.seeders, torrents.leechers, torrents.category, categories.image
FROM torrents
LEFT JOIN categories ON torrents.category = categories.id
WHERE (torrents.name
LIKE {$query1})
OR (torrents.category LIKE {$catid})
OR (torrents.name LIKE {$query2})
OR (torrents.gener LIKE {$genre})
LIMIT 10");CREATE TABLE `tmdbfilm` (
`id` int(10) NOT NULL AUTO_INCREMENT,
`id_tmdb` int(10) NOT NULL DEFAULT 0,
`title` varchar(255) DEFAULT NULL,
`duration` varchar(100) DEFAULT NULL,
`producer` varchar(255) DEFAULT NULL,
`genre` varchar(255) DEFAULT NULL,
`plot` text DEFAULT NULL,
`actor` longtext DEFAULT NULL,
`trailer` varchar(100) DEFAULT NULL,
`date` datetime DEFAULT NULL,
`image` varchar(50) DEFAULT NULL,
UNIQUE KEY `id` (`id`)
) ENGINE=MyISAM;
<b><?php echo T_("IMDB_LINK"); ?></b><br /> <a href="<?php echo $row['imdb']; ?>" target="_blank"><?php echo htmlspecialchars($row['imdb']); ?></a><br /><br />
<b><?php echo T_("IMDB_RATED"); ?></b><br /> <?php echo $TTIMDB->getRated( $_data->Rated ); ?><br /><br />
<b><?php echo T_("IMDB_ALIAS"); ?></b><br /> <?php echo $_data->Alias; ?><br /><br />
<b><?php echo T_("IMDB_RELEASED"); ?></b><br /> <?php echo $TTIMDB->getReleased($_data->Released); ?><br /><br />
<b><?php echo T_("IMDB_YEAR"); ?></b><br /> <?php echo $_data->Year; ?><br /><br />
<b><?php echo T_("IMDB_RUNTIME"); ?></b><br /> <?php echo $_data->Runtime; ?><br /><br />
<b><?php echo T_("IMDB_GENRE"); ?></b><br /> <?php echo $_data->Genre; ?><br /><br />
<b><?php echo T_("IMDB_DIRECTOR"); ?></b><br /> <?php echo $_data->Director; ?><br /><br />
<b><?php echo T_("IMDB_WRITER"); ?></b><br /> <?php echo $_data->Writer; ?><br /><br />
<b><?php echo T_("IMDB_ACTORS"); ?></b><br /> <?php echo $_data->Actors; ?><br /><br />
<b><?php echo T_("IMDB_PLOT"); ?></b><br /> <?php echo $_data->Plot; ?>SQL_Query_exec("INSERT INTO `imdb` (`genre`, `plot`, `url`) VALUES ('$_data->Genre', '$_data->Plot', $row[imdb])");"SELECT torrents.id, torrents.name, torrents.size, torrents.added, torrents.seeders, torrents.leechers, torrents.category, categories.image, torrents.imdb
FROM torrents
LEFT JOIN categories ON torrents.category = categories.id
LEFT JOIN imdb ON torrents.imdb = imdb.url
WHERE (torrents.name
LIKE {$query1})
OR (torrents.category LIKE {$catid})
OR (torrents.name LIKE {$query2})
LIMIT 10" $query1 = str_replace(" ", ".", sqlesc("%" . $searchname . "%"));
$query2 = str_replace(".", " ", sqlesc("%" . $searchname . "%"));
$r = SQL_Query_exec("SELECT torrents.id, torrents.name, torrents.size, torrents.added, torrents.seeders, torrents.leechers, torrents.category, categories.image FROM torrents LEFT JOIN categories ON (categories.id = torrents.category) WHERE (torrents.name LIKE {$query1} AND seeders > '0' AND torrents.id <> '$id') OR (torrents.name LIKE {$query2} AND seeders > '0' AND torrents.id <> '$id') ORDER BY seeders DESC LIMIT 10"); $query1 = str_replace(" ", ".", sqlesc("%" . $searchname . "%"));
$query2 = str_replace(".", " ", sqlesc("%" . $searchname . "%"));
$catid = str_replace(".", " ", sqlesc("%" . $row['category'] . "%"));
$r = SQL_Query_exec("SELECT torrents.id, torrents.name, torrents.size, torrents.added, torrents.seeders, torrents.leechers, torrents.category, categories.image
FROM torrents
LEFT JOIN categories ON torrents.category = categories.id
WHERE (torrents.name
LIKE {$query1})
OR (torrents.category LIKE {$catid})
OR (torrents.name LIKE {$query2})
LIMIT 10"); <?php
require_once "backend/functions.php";
dbconn();
loggedinonly();
$search = $_GET['search'] ?? '';
$url = "?";
if ($search != '') {
$keys = explode(" ", $search);
foreach ($keys as $k) {
$ssa[] = " torrents.name LIKE '%$k%' ";
}
$query = '(' . implode(' OR ', $ssa) . ')';
$url .= "search=" . urlencode($search);
} else {
// haha letter t
$letter = $_GET["letter"] ?? 't';
if (strlen($letter) > 1) {
die;
}
if ($letter == "" || strpos("abcdefghijklmnopqrstuvwxyz", $letter) === false) {
// haha letter t
$letter = "t";
}
$query = "torrents.name LIKE '$letter%'";
$url = "?letter=$letter";
}
$result = SQL_Query_exec("SELECT count(id) FROM torrents WHERE $query AND visible != 'no'");
$count = mysqli_num_rows($result);
list($pagertop, $pagerbottom, $limit) = pager(28, $count, $site_config["SITEURL"] . "/catalog$url&");
$stmt = SQL_Query_exec("SELECT torrents.anon, torrents.seeders, torrents.banned, torrents.leechers, torrents.info_hash, torrents.filename, torrents.nfo, torrents.last_action, torrents.numratings, torrents.name, torrents.owner, torrents.save_as, torrents.descr, torrents.visible, torrents.size, torrents.added, torrents.views, torrents.hits, torrents.times_completed, torrents.id, torrents.type, torrents.external, torrents.image1, torrents.image2, torrents.announce, torrents.numfiles, torrents.freeleech,
IF(torrents.numratings < 2, NULL, ROUND(torrents.ratingsum / torrents.numratings, 1)) AS rating, torrents.numratings,
categories.name AS cat_name,
torrentlang.name AS lang_name,
torrentlang.image AS lang_image,
categories.parent_cat as cat_parent,
users.username, users.donated, users.warned, users.privacy, snatched.tid, snatched.uid, snatched.uload, snatched.dload, snatched.stime, snatched.utime, snatched.ltime
FROM torrents
LEFT JOIN categories ON torrents.category = categories.id
LEFT JOIN torrentlang ON torrents.torrentlang = torrentlang.id
LEFT JOIN users ON torrents.owner = users.id
LEFT JOIN snatched ON users.id = snatched.uid
WHERE $query AND visible != 'no'
ORDER BY name ASC $limit");
$res = mysqli_fetch_all($stmt);
stdhead(T_("test"));
begin_frame(T_("test"));
foreach ($res as $arr) {
var_dump($arr);
echo "<br>################<br>";
}
end_frame();
stdfoot(); $vip = 4;
$user['class'] > $VIP ? 0 : max(0, $downloaded - $self["downloaded"]); if ($_GET["bump"]) {
SQL_Query_exec("UPDATE torrents SET added = '".get_date_time()."' WHERE id='".$id."' ");
autolink(torrents-details.php?id=$id", T_("Bumped Torrent"));
} <form action='torrents-details.php?id=$id&bump=1' method='post'>
<button type='submit' value=''>Bump Torrent</button>
</form><br>ORDER BY torrents.added DESC