Login
Username: Password:
Remember me

[Sign Up] / [Recover Password]

Theme / Language

Popular
New Torrents
new name
Size: 18.40 MB
Most active
new name
S: 74 L: 3
New Posters
User Posts

Go to Profile

Show webseed — 2013-04-30 23:23:34 in v2 Only Mods Complete
hey all

<?php
//
// TorrentTrader v2.x
// $LastChangedDate: 2011-11-11 16:48:38 +0000 (Fri, 11 Nov 2011) $
// $LastChangedBy: dj-howarth1 $
//
// [url="http://www.torrenttrader.org"]http://www.torrenttrader.org[/url]
//
//
require_once("backend/functions.php");
dbconn();
loggedinonly();

$id = (int) $_REQUEST["id"];
if (!is_valid_id($id)) show_error_msg(T_("ERROR"), T_("INVALID_ID"), 1);
$action = $_REQUEST["action"];

$row = mysql_fetch_assoc(SQL_Query_exec("SELECT `owner` FROM `torrents` WHERE id=$id"));
if($CURUSER["edit_torrents"]=="no" && $CURUSER['id'] != $row['owner'])
show_error_msg(T_("ERROR"), T_("NO_TORRENT_EDIT_PERMISSION"), 1);


function uploadimage($x, $imgname, $tid) {
global $site_config;

$imagesdir = $site_config["torrent_dir"]."/images";

$allowed_types = &$site_config["allowed_image_types"];

if ( !( $_FILES["image$x"]["name"] == "" ) ) {
if ($imgname != "") {
$img = "$imagesdir/$imgname";
$del = unlink($img);
}

$y = $x + 1;

$im = getimagesize($_FILES["image$x"]["tmp_name"]);

if (!$im[2])
show_error_msg("Error", "Invalid Image $y.", 1);

if (!array_key_exists($im['mime'], $allowed_types))
show_error_msg(T_("ERROR"), T_("INVALID_FILETYPE_IMAGE"), 1);

if ($_FILES["image$x"]["size"] > $site_config['image_max_filesize'])
show_error_msg(T_("ERROR"), sprintf(T_("INVAILD_FILE_SIZE_IMAGE"), $y), 1);

$uploaddir = "$imagesdir/";

$ifilename = $tid . $x . $allowed_types[$im['mime']];

$copy = copy($_FILES["image$x"]["tmp_name"], $uploaddir.$ifilename);

if (!$copy)
show_error_msg(T_("ERROR"), sprintf(T_("ERROR_UPLOADING_IMAGE"), $y), 1);

return $ifilename;
}
}//end func


//GET DATA FROM DB
$res = SQL_Query_exec("SELECT * FROM torrents WHERE id = $id");
$row = mysql_fetch_array($res);
if (!$row){
show_error_msg(T_("ERROR"), T_("TORRENT_ID_GONE"), 1);
}

$torrent_dir = $site_config["torrent_dir"];
$nfo_dir = $site_config["nfo_dir"];

//DELETE TORRENT
if ($action=="deleteit"){
$torrentid = (int) $_POST["torrentid"];
$delreason = sqlesc($_POST["delreason"]);
$torrentname = $_POST["torrentname"];

if (!is_valid_id($torrentid))
show_error_msg(T_("FAILED"), T_("INVALID_TORRENT_ID"), 1);

if (!$delreason){
show_error_msg(T_("ERROR"), T_("MISSING_FORM_DATA"), 1);
}

deletetorrent($torrentid);

write_log($CURUSER['username']." has deleted torrent: ID:$torrentid - ".htmlspecialchars($torrentname)." - Reason: ".htmlspecialchars($delreason));
if ($CURUSER['id'] != $row['owner']) {
$delreason = $_POST["delreason"];
SQL_Query_exec("INSERT INTO messages (sender, receiver, added, subject, msg, unread, location) VALUES(0, ".$row['owner'].", '".get_date_time()."', 'Your torrent '$torrentname' has been deleted by ".$CURUSER['username']."', ".sqlesc("'$torrentname' was deleted by ".$CURUSER['username']."nnReason: $delreason").", 'yes', 'in')");
}

show_error_msg(T_("COMPLETED"), htmlspecialchars($torrentname)." ".T_("HAS_BEEN_DEL_DB"),1);
die;
}

//DO THE SAVE TO DB HERE
if ($action=="doedit"){
$updateset = array();

$nfoaction = $_POST['nfoaction'];
if ($nfoaction == "update"){
$nfofile = $_FILES['nfofile'];
if (!$nfofile) die("No data " . var_dump($_FILES));
if ($nfofile['size'] > 65535)
show_error_msg("NFO is too big!", "Max 65,535 bytes.",1);
$nfofilename = $nfofile['tmp_name'];
if (@is_uploaded_file($nfofilename) && @filesize($nfofilename) > 0){
@move_uploaded_file($nfofilename, "$nfo_dir/$id.nfo");
$updateset[] = "nfo = 'yes'";
}//success
}

if (!empty($_POST["name"]))
$updateset[] = "name = " . sqlesc($_POST["name"]);

$updateset[] = "descr = " . sqlesc($_POST["descr"]);
$updateset[] = "category = " . (int) $_POST["type"];
$updateset[] = "torrentlang = " . (int) $_POST["language"];

if ($CURUSER["edit_torrents"] == "yes") {
if ($_POST["banned"]) {
$updateset[] = "banned = 'yes'";
$_POST["visible"] = 0;
} else {
$updateset[] = "banned = 'no'";
}
}

$updateset[] = "visible = '" . ($_POST["visible"] ? "yes" : "no") . "'";

if ($CURUSER["edit_torrents"] == "yes")
$updateset[] = "freeleech = '".$_POST["freeleech"]."'";

$updateset[] = "anon = '" . ($_POST["anon"] ? "yes" : "no") . "'";
//webseed
if ($CURUSER["edit_torrents"] == "yes")
$updateset[] = "webseed = '".$_POST["webseed"]."'";
//
//update images
$img1action = $_POST['img1action'];
if ($img1action == "update")
$updateset[] = "image1 = " .sqlesc(uploadimage(0, $row["image1"], $id));
if ($img1action == "delete") {
if ($row[image1]) {
$del = unlink($site_config["torrent_dir"]."/images/$row[image1]");
$updateset[] = "image1 = ''";
}
}

$img2action = $_POST['img2action'];
if ($img2action == "update")
$updateset[] = "image2 = " .sqlesc(uploadimage(1, $row["image2"], $id));
if ($img2action == "delete") {
if ($row[image2]) {
$del = unlink($site_config["torrent_dir"]."/images/$row[image2]");
$updateset[] = "image2 = ''";
}
}


SQL_Query_exec("UPDATE torrents SET " . join(",", $updateset) . " WHERE id = $id");

$returl = "torrents-edit.php?id=$id&edited=1";
if (isset($_POST["returnto"])){
$returl = $_POST["returnto"];
}

write_log("Torrent $id (".htmlspecialchars($_POST["name"]).") was edited by $CURUSER[username]");

header("Location: $returl");
die();
}//END SAVE TO DB

//UPDATE CATEGORY DROPDOWN
$catdropdown = "<select name="type">n";
$cats = genrelist();
foreach ($cats as $catdropdownubrow) {
$catdropdown .= "<option value="" . $catdropdownubrow["id"] . """;
if ($catdropdownubrow["id"] == $row["category"])
$catdropdown .= " selected="selected"";
$catdropdown .= ">" . htmlspecialchars($catdropdownubrow["parent_cat"]) . ": " . htmlspecialchars($catdropdownubrow["name"]) . "</option>n";
}
$catdropdown .= "</select>n";
//END CATDROPDOWN

//UPDATE TORRENTLANG DROPDOWN
$langdropdown = "<select name="language"><option value='0'>Unknown</option>n";
$lang = langlist();
foreach ($lang as $lang) {
$langdropdown .= "<option value="" . $lang["id"] . """;
if ($lang["id"] == $row["torrentlang"])
$langdropdown .= " selected="selected"";
$langdropdown .= ">" . htmlspecialchars($lang["name"]) . "</option>n";
}
$langdropdown .= "</select>n";
//END TORRENTLANG


$char1 = 55;
$shortname = CutName(htmlspecialchars($row["name"]), $char1);

if ($_GET["edited"]){
show_error_msg("Edited OK", T_("TORRENT_EDITED_OK"), 1);
}

stdhead(T_("EDIT_TORRENT")." "$shortname"");

begin_frame(T_("EDIT_TORRENT")." "$shortname"");

print("<br /><br /><form method='post' name="bbform" enctype="multipart/form-data" action="torrents-edit.php?action=doedit">n");
print("<input type="hidden" name="id" value="$id" />n");

if (isset($_GET["returnto"]))
print("<input type="hidden" name="returnto" value="" . htmlspecialchars($_GET["returnto"]) . "" />n");

print("<table border='0' cellspacing='4' cellpadding='2' width='95%'>n");
echo "<tr><td align='right' width='60'><b>".T_("NAME").": </b></td><td><input type="text" name="name" value="" . htmlspecialchars($row["name"]) . "" size="60" /></td></tr>";
echo "<tr><td align='right'><b>".T_("IMAGE").": </b></td><td><b>".T_("IMAGE")." 1:</b>&nbsp;&nbsp;<input type='radio' name='img1action' value='keep' checked='checked' />".T_("KEEP_IMAGE")."&nbsp;&nbsp;"."<input type='radio' name='img1action' value='delete' />".T_("DELETE_IMAGE")."&nbsp;&nbsp;"."<input type='radio' name='img1action' value='update' />".T_("UPDATE_IMAGE")."<br /><input type='file' name='image0' size='60' /> <br /><br /> <b>".T_("IMAGE")." 2:</b>&nbsp;&nbsp;<input type='radio' name='img2action' value='keep' checked='checked' />".T_("KEEP_IMAGE")."&nbsp;&nbsp;"."<input type='radio' name='img2action' value='delete' />".T_("DELETE_IMAGE")."&nbsp;&nbsp;"."<input type='radio' name='img2action' value='update' />".T_("UPDATE_IMAGE")."<br /><input type='file' name='image1' size='60' /></td></tr>";
echo "<tr><td align='right'><b>".T_("NFO").": </b><br /></td><td><input type='radio' name='nfoaction' value='keep' checked='checked' />Keep NFO &nbsp; <input type='radio' name='nfoaction' value='update' />Update NFO:";
if ($row["nfo"] == "yes"){
echo "&nbsp;&nbsp;<a href='nfo-view.php?id=".$row["id"]."' target='_blank'>[".T_("VIEW_CURRENT_NFO")."]</a>";
} else{
echo "&nbsp;&nbsp;<font color='#ff0000'>".T_("NO_NFO_UPLOADED")."</font>";
}
echo "<br /><input type='file' name='nfofile' size='60' /></td></tr>";

echo "<tr><td align='right'><b>".T_("CATEGORIES").": </b></td><td>".$catdropdown."</td></tr>";

echo "<tr><td align='right'><b>".T_("LANG").": </b></td><td>".$langdropdown."</td></tr>";

if ($CURUSER["edit_torrents"] == "yes")
echo "<tr><td align='right'><b>".T_("BANNED").": </b></td><td><input type="checkbox" name="banned"" . (($row["banned"] == "yes") ? " checked="checked"" : "" ) . " value="1" /> ".T_("BANNED")."?<br /></td></tr>";
echo "<tr><td align='right'><b>".T_("VISIBLE").": </b></td><td><input type="checkbox" name="visible"" . (($row["visible"] == "yes") ? " checked="checked"" : "" ) . " value="1" /> " .T_("VISIBLEONMAIN"). "<br /></td></tr>";

if ($row["external"] != "yes" && $CURUSER["edit_torrents"] == "yes"){
echo "<tr><td align='right'><b>".T_("FREE_LEECH").": </b></td><td><input type="checkbox" name="freeleech"" . (($row["freeleech"] == "1") ? " checked="checked"" : "" ) . " value="1" />".T_("FREE_LEECH_MSG")."<br /></td></tr>";
}

//webseed
if ($row["external"] != "yes" && $CURUSER["edit_torrents"] == "yes"){
echo "<tr><td align=right><B>Webseed: </b></TD><TD><input type="checkbox" name="webseed"" . (($row["webseed"] == "1") ? " checked="checked"" : "" ) . " value="1" />Torrent with Webseed<br>";
}
//
if ($site_config['ANONYMOUSUPLOAD']) {
echo "<tr><td align='right'><b>".T_("ANONYMOUS_UPLOAD").": </b></td><td><input type="checkbox" name="anon"" . (($row["anon"] == "yes") ? " checked="checked"" : "" ) . " value="1" />(".T_("ANONYMOUS_UPLOAD_MSG").")<br /></td></tr>";
}

print ("<tr><td align='center' colspan='2'><b>" .T_("DESCRIPTION"). ":</b></td></tr></table>");
require_once("backend/bbcode.php");
print textbbcode("bbform","descr", htmlspecialchars($row["descr"]));


print("<br /><center><input type="submit" value='".T_("SUBMIT")."' /> <input type='reset' value='".T_("UNDO")."' /></center>n");
print("</form>n");
end_frame();

begin_frame(T_("DELETE_TORRENT"));
print("<center><form method='post' action='torrents-edit.php?action=deleteit&amp;id=$id'>n");
print("<input type='hidden' name='torrentid' value='$id' />n");
print("<input type='hidden' name='torrentname' value='".htmlspecialchars($row["name"])."' />n");
echo "<b>".T_("REASON_FOR_DELETE")."</b><input type='text' size='30' name='delreason' />";
echo "&nbsp;<input type='submit' value='".T_("DELETE_TORRENT")."' /></form></center>";
end_frame();

stdfoot();

?>
only mods can modified webseed in torrent-edit how can the user class 3 the same :]
ps. only upload 4 mod

webseed 4 user class 3 pls :]

greetz
update^^

magnet links works great with deluge 2 deluge thx ArcticWolf :]


<?php
//
// TorrentTrader v2.x
// $LastChangedDate: 2011-11-24 05:42:28 +0000 (Thu, 24 Nov 2011) $
// $LastChangedBy: dj-howarth1 $
//
// [url="http://www.torrenttrader.org"]http://www.torrenttrader.org[/url]
//
//
require_once("backend/functions.php");
require_once("backend/BDecode.php");
dbconn();

$torrent_dir = $site_config["torrent_dir"];
$nfo_dir = $site_config["nfo_dir"];

//check permissions
if ($site_config["MEMBERSONLY"]){
loggedinonly();

if($CURUSER["view_torrents"]=="no")
show_error_msg(T_("ERROR"), T_("NO_TORRENT_VIEW"), 1);
}

//************ DO SOME "GET" STUFF BEFORE PAGE LAYOUT ***************

$id = (int) $_GET["id"];
$scrape = (int)$_GET["scrape"];
if (!is_valid_id($id))
show_error_msg("ERROR", T_("THATS_NOT_A_VALID_ID"), 1);

//GET ALL MYSQL VALUES FOR THIS TORRENT
$res = SQL_Query_exec("SELECT torrents.anon, torrents.seeders, torrents.thanks, 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, torrents.webseed, 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.privacy 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 WHERE torrents.id = $id");
$row = mysql_fetch_assoc($res);

//DECIDE IF TORRENT EXISTS
if (!$row || ($row["banned"] == "yes" && $CURUSER["edit_torrents"] == "no"))
show_error_msg(T_("ERROR"), T_("TORRENT_NOT_FOUND"), 1);

//torrent is availiable so do some stuff

if ($_GET["hit"]) {
SQL_Query_exec("UPDATE torrents SET views = views + 1 WHERE id = $id");
header("Location: torrents-details.php?id=$id");
die;
}

stdhead(T_("DETAILS_FOR_TORRENT")." "" . $row["name"] . """);

if ($CURUSER["id"] == $row["owner"] || $CURUSER["edit_torrents"] == "yes")
$owned = 1;
else
$owned = 0;

//take rating
if ($_GET["takerating"] == 'yes'){
$rating = (int)$_POST['rating'];

if ($rating <= 0 || $rating > 5)
show_error_msg(T_("RATING_ERROR"), T_("INVAILD_RATING"), 1);

$res = SQL_Query_exec("INSERT INTO ratings (torrent, user, rating, added) VALUES ($id, " . $CURUSER["id"] . ", $rating, '".get_date_time()."')");

if (!$res) {
if (mysql_errno() == 1062)
show_error_msg(T_("RATING_ERROR"), T_("YOU_ALREADY_RATED_TORRENT"), 1);
else
show_error_msg(T_("RATING_ERROR"), T_("A_UNKNOWN_ERROR_CONTACT_STAFF"), 1);
}

SQL_Query_exec("UPDATE torrents SET numratings = numratings + 1, ratingsum = ratingsum + $rating WHERE id = $id");
show_error_msg(T_("RATING_ERROR"), T_("RATING_THANK")."<br /><br /><a href='torrents-details.php?id=$id'>" .T_("BACK_TO_TORRENT"). "</a>");
}

//take comment add
if ($_GET["takecomment"] == 'yes'){
loggedinonly();
$body = $_POST['body'];

if (!$body)
show_error_msg(T_("RATING_ERROR"), T_("YOU_DID_NOT_ENTER_ANYTHING"), 1);

SQL_Query_exec("UPDATE torrents SET comments = comments + 1 WHERE id = $id");

SQL_Query_exec("INSERT INTO comments (user, torrent, added, text) VALUES (".$CURUSER["id"].", ".$id.", '" .get_date_time(). "', " . sqlesc($body).")");

if (mysql_affected_rows() == 1)
show_error_msg(T_("COMPLETED"), T_("COMMENT_ADDED"), 0);
else
show_error_msg(T_("ERROR"), T_("UNABLE_TO_ADD_COMMENT"), 0);
}//end insert comment

//START OF PAGE LAYOUT HERE
$char1 = 64; //cut length
$shortname = CutName(htmlspecialchars($row["name"]), $char1);

begin_frame(T_("TORRENT_DETAILS_FOR"). " "" . $shortname . """);

echo "<div align='right'>[<a href='report.php?torrent=$id'><b>" .T_("REPORT_TORRENT"). "</b></a>]&nbsp;";
if ($owned)
echo "[<a href='torrents-edit.php?id=$row[id]&amp;returnto=" . urlencode($_SERVER["REQUEST_URI"]) . "'><b>".T_("EDIT_TORRENT")."</b></a>]";
echo "</div>";

echo "<center><h1>" . $shortname . "</h1></center>";

// Calculate local torrent speed test
if ($row["leechers"] >= 1 && $row["seeders"] >= 1 && $row["external"]!='yes'){
$speedQ = SQL_Query_exec("SELECT (SUM(p.downloaded)) / (UNIX_TIMESTAMP('".get_date_time()."') - UNIX_TIMESTAMP(added)) AS totalspeed FROM torrents AS t LEFT JOIN peers AS p ON t.id = p.torrent WHERE p.seeder = 'no' AND p.torrent = '$id' GROUP BY t.id ORDER BY added ASC LIMIT 15");
$a = mysql_fetch_assoc($speedQ);
$totalspeed = mksize($a["totalspeed"]) . "/s";
}else{
$totalspeed = T_("NO_ACTIVITY");
}

//download box
echo "<center><table border='0' width='100%'><tr><td><div id='downloadbox'>";
if ($row["banned"] == "yes"){
print ("<center><b>" .T_("DOWNLOAD"). ": </b>BANNED!</center>");
}else{
//print ("<table border='0' cellpadding='0' width='100%'><tr><td align='center' valign='middle' width='54'><a href="download.php?id=$id&amp;name=" . rawurlencode($row["filename"]) . ""><img src="".$site_config["SITEURL"]."/images/download_torrent.png" border="0" alt='' /></a></td>");
//print ("<table border=0 cellpadding=0 width=95%><tr><td align=center valign=middle width='204px'><a href="download.php?id=$id&name=" . rawurlencode($row["filename"]) . ""><img src="".$site_config["SITEURL"]."/images/download_torrent.png" border="0"></a><a href="magnet:?xt=urn:btih:" . $row['info_hash'] . "&dn=" . rawurlencode($row['name']) . "&tr=" . $row['announce'] . ""><img src="".$site_config["SITEURL"]."/images/magnet.png" border="0"></a></td>");
//print ("<td valign='top'><a href="download.php?id=$id&amp;name=" . rawurlencode($row["filename"]) . "">".T_("DOWNLOAD_TORRENT")."</a><br />");
//print ("<a href="magnet:?xt=urn:btih:" . $row['info_hash'] . "&dn=" . rawurlencode($row['name']) . "&tr=" . $row['announce'] . ""><font size=4pt>get this torrent per magnet :]</font></a><BR><BR>");
if ($row["external"] == 'yes')
$announce_url2 = $row['announce'];
else
$announce_url2 = sprintf($site_config["PASSKEYURL"], $CURUSER["passkey"]);
print ("<table border=0 cellpadding=0 width=95%><tr><td align=left valign=middle width='204px'><a href="download.php?id=$id&name=" . rawurlencode($row["filename"]) . ""><img src="".$site_config["SITEURL"]."/images/download_torrent.png" border="0"></a><a href="magnet:?xt=urn:btih:" . $row['info_hash'] . "&dn=" . rawurlencode($row['name']) . "&tr=" . $announce_url2 . ""><img src="" .$site_config["SITEURL"]."/images/magnet.png" border="0"></a></td>");


print ("<b>" .T_("HEALTH"). ": </b><img src='".$site_config["SITEURL"]."/images/health/health_".health($row["leechers"], $row["seeders"]).".gif' alt='' /><br />");
print ("<b>" .T_("SEEDS"). ": </b><font color='green'>" . number_format($row["seeders"]) . "</font><br />");
print ("<b>".T_("LEECHERS").": </b><font color='#ff0000'>" . number_format($row["leechers"]) . "</font><br />");

if ($row["external"]!='yes'){
print ("<b>".T_("SPEED").": </b>" . $totalspeed . "<br />");
}

print ("<b>".T_("COMPLETED").":</b> " . number_format($row["times_completed"]) . "&nbsp;");

if ($row["external"] != "yes" && $row["times_completed"] > 0) {
echo("[<a href='torrents-completed.php?id=$id'>" .T_("WHOS_COMPLETED"). "</a>] ");
if ($row["seeders"] <= 1) {
echo("[<a href='torrents-reseed.php?id=$id'>" .T_("REQUEST_A_RE_SEED"). "</a>]");
}
}
echo "<br />";

if ($row["external"]!='yes' && $row["freeleech"]=='1'){
print ("<b>".T_("FREE_LEECH").": </b><font color='#ff0000'>".T_("FREE_LEECH_MSG")."</font><br />");
}
//
if ($row["external"]!='yes' && $row["webseed"]=='1'){
print ("<B>Webseed: </b><font color=red>Seed with ro0t or seedb0x :]</font> &nbsp;<img src="".$site_config["SITEURL"]."/images/webseed.gif" border="0"></a><BR>");
}
//

print ("<b>".T_("LAST_CHECKED").": </b>" . date("d-m-Y H:i:s", utc_to_tz_time($row["last_action"])) . "<br /></td>");

if ($row["external"]=='yes'){

if ($scrape =='1'){
print("<td valign='top' align='right'><b>Tracked: </b>EXTERNAL<br /><br />");
$seeders1 = $leechers1 = $downloaded1 = null;

$tres = SQL_Query_exec("SELECT url FROM announce WHERE torrent=$id");
while ($trow = mysql_fetch_array($tres)) {
$ann = $trow["url"];
$tracker = explode("/", $ann);
$path = array_pop($tracker);
$oldpath = $path;
$path = preg_replace("/^announce/", "scrape", $path);
$tracker = implode("/", $tracker)."/".$path;

if ($oldpath == $path) {
continue; // Scrape not supported, ignored
}

// TPB's tracker is dead. Use openbittorrent instead
if (preg_match("/thepiratebay.org/i", $tracker) || preg_match("/prq.to/", $tracker)) {
$tracker = "[url="http://tracker.openbittorrent.com/scrape"]http://tracker.openbittorrent.com/scrape[/url]";
}

$stats = torrent_scrape_url($tracker, $row["info_hash"]);
if ($stats['seeds'] != -1) {
$seeders1 += $stats['seeds'];
$leechers1 += $stats['peers'];
$downloaded1 += $stats['downloaded'];
SQL_Query_exec("UPDATE `announce` SET `online` = 'yes', `seeders` = $stats[seeds], `leechers` = $stats[peers], `times_completed` = $stats[downloaded] WHERE `url` = ".sqlesc($ann)." AND `torrent` = $id");
} else {
SQL_Query_exec("UPDATE `announce` SET `online` = 'no' WHERE `url` = ".sqlesc($ann)." AND `torrent` = $id");

}
}

if ($seeders1 !== null){ //only update stats if data is received
print ("<b>".T_("LIVE_STATS").": </b><br />");
print ("Seeders: ".number_format($seeders1)."<br />");
print ("Leechers: ".number_format($leechers1)."<br />");
print (T_("COMPLETED").": ".number_format($downloaded1)."<br />");

SQL_Query_exec("UPDATE torrents SET leechers='".$leechers1."', seeders='".$seeders1."', times_completed='".$downloaded1."',last_action= '".get_date_time()."',visible='yes' WHERE id='".$row['id']."'");
}else{
print ("<b>".T_("LIVE_STATS").": </b><br />");
print ("<font color='#ff0000'>Tracker Timeout<br />Please retry later</font><br />");
}

print ("<form action='torrents-details.php?id=$id&amp;scrape=1' method='post'><input type="submit" name="submit" value="Update Stats" /></form></td>");
}else{
print ("<td valign='top' align='right'><b>Tracked:</b> EXTERNAL<br /><br /><form action='torrents-details.php?id=$id&amp;scrape=1' method='post'><input type="submit" name="submit" value="Update Stats" /></form></td>");
}
}

echo "</tr></table>";
}
echo "</div></td></tr></table></center><br /><br />";
//end download box


echo "<fieldset class='download'><legend><b>Details</b></legend>";
echo "<table cellpadding='3' border='0' width='100%'>";
print("<tr><td align='left'><b>".T_("NAME").":</b></td><td>" . $shortname . "</td></tr>n");
print("<tr><td align='left' colspan='2'><b>" .T_("DESCRIPTION"). ":</b><br />" . format_comment($row['descr']) . "</td></tr>n");
print("<tr><td align='left'><b>" .T_("CATEGORY"). ":</b></td><td>" . $row["cat_parent"] . " > " . $row["cat_name"] . "</td></tr>n");

if (empty($row["lang_name"])) $row["lang_name"] = "Unknown/NA";
print("<tr><td align='left'><b>" .T_("LANG"). ":</b></td><td>" . $row["lang_name"] . "n");

if (isset($row["lang_image"]) && $row["lang_image"] != "")
print("&nbsp;<img border="0" src="" . $site_config['SITEURL'] . "/images/languages/" . $row["lang_image"] . "" alt="" . $row["lang_name"] . "" />");

print("</td></tr>");

print("<tr><td align='left'><b>" .T_("TOTAL_SIZE"). ":</b></td><td>" . mksize($row["size"]) . " </td></tr>n");
print("<tr><td align='left'><b>" .T_("INFO_HASH"). ":</b></td><td>" . $row["info_hash"] . "</td></tr>n");
print("");
if ($row["anon"] == "yes" && !$owned)
print("<tr><td align='left'><b>" .T_("ADDED_BY"). ":</b></td><td>Anonymous</td></tr>");

print("<tr><td align='left'><b>" .T_("ADDED_BY"). ":</b></td><td>Unknown</td></tr>");

print("<tr><td align='left'><b>" .T_("DATE_ADDED"). ":</b></td><td>" . date("d-m-Y H:i:s", utc_to_tz_time($row["added"])) . "</td></tr>n");
print("<tr><td align='left'><b>" .T_("VIEWS"). ":</b></td><td>" . number_format($row["views"]) . "</td></tr>n");
print("<tr><td align='left'><b>".T_("HITS").":</b></td><td>" . number_format($row["hits"]) . "</td></tr>n");
$thanksl = explode(",", $row['thanks']);
if ($CURUSER['username'] == $row['username'] || !$CURUSER) $leftthanks = true;
foreach ($thanksl as $u) {
$thanks .= ($i>0)?", $u":$u;
if ($u == $CURUSER['username']) $leftthanks = true;
$i++;
}

if (!$thanks) $thanks = "No one yet.";

print("<tr><td align=left><b>Thanks By:</b></td><td>$thanks</td></tr>n");
if (!$leftthanks) print("<tr><td align=left>&nbsp;</td><td><form action=thanks.php method=POST><input type=hidden name=torrent value=$id><input type=submit value='Thanks 4 th1s torrent dude!'></form></td></tr>n");
echo "</table></fieldset><br /><br />";

// $srating IS RATING VARIABLE
$srating = "";
$srating .= "<table class='f-border' cellspacing="1" cellpadding="4" width='100%'><tr><td class='f-title' width='60'><b>".T_("RATINGS").":</b></td><td class='f-title' valign='middle'>";
if (!isset($row["rating"])) {
$srating .= "Not Yet Rated";
}else{
$rpic = ratingpic($row["rating"]);
if (!isset($rpic))
$srating .= "invalid?";
else
$srating .= "$rpic (" . $row["rating"] . " ".T_("OUT_OF")." 5) " . $row["numratings"] . " ".T_("USERS_HAVE_RATED");
}
$srating .= "n";
if (!isset($CURUSER))
$srating .= "(<a href="account-login.php?returnto=" . urlencode($_SERVER["REQUEST_URI"]) . "&amp;nowarn=1">Log in</a> to rate it)";
else {
$ratings = array(
5 => T_("COOL"),
4 => T_("PRETTY_GOOD"),
3 => T_("DECENT"),
2 => T_("PRETTY_BAD"),
1 => T_("SUCKS")
);
//if (!$owned || $moderator) {
$xres = SQL_Query_exec("SELECT rating, added FROM ratings WHERE torrent = $id AND user = " . $CURUSER["id"]);
$xrow = mysql_fetch_assoc($xres);
if ($xrow)
$srating .= "<br /><i>(".T_("YOU_RATED")." "" . $xrow["rating"] . " - " . $ratings[$xrow["rating"]] . "")</i>";
else {
$srating .= "<form style="display:inline;" method="post" action="torrents-details.php?id=$id&amp;takerating=yes"><input type="hidden" name="id" value="$id" />n";
$srating .= "<select name="rating">n";
$srating .= "<option value="0">(".T_("ADD_RATING").")</option>n";
foreach ($ratings as $k => $v) {
$srating .= "<option value="$k">$k - $v</option>n";
}
$srating .= "</select>n";
$srating .= "<input type="submit" value="".T_("VOTE")."" />";
$srating .= "</form>n";
}
//}
}
$srating .= "</td></tr></table>";

print("<center>". $srating . "</center>");// rating

//END DEFINE RATING VARIABLE

echo "<br />";

if ($row["image1"] != "" OR $row["image2"] != "") {

if ($row["image1"] != "")

$img1 = "<a href=".$site_config["SITEURL"]."/uploads/images/$row[image1] rel=gb_imageset[nice_pics] title=" . $shortname . "><IMG class=glossy src=".$site_config["SITEURL"]."/uploads/images/$row[image1] width=150 border=0></a>";

if ($row["image2"] != "")

$img2 = "<a href=".$site_config["SITEURL"]."/uploads/images/$row[image2] rel=gb_imageset[nice_pics] title=" . $shortname . "><IMG class=glossy src=".$site_config["SITEURL"]."/uploads/images/$row[image2] width=150 border=0></a>";

print("<CENTER>". $img1 . "&nbsp&nbsp" . $img2."</CENTER><BR>");

}

if ($row["external"]=='yes'){
print ("<br /><b>Tracker:</b><br /> ".htmlspecialchars($row['announce'])."<br />");
}

$tres = SQL_Query_exec("SELECT * FROM `announce` WHERE `torrent` = $id");
if (mysql_num_rows($tres) > 1){
echo "<br /><b>".T_("THIS_TORRENT_HAS_BACKUP_TRACKERS")."</b><br />";
echo '<table cellpadding="1" cellspacing="2" class="table_table"><tr>';
echo '<th class="table_head">URL</th><th class="table_head">'.T_("SEEDERS").'</th><th class="table_head">'.T_("LEECHERS").'</th><th class="table_head">'.T_("COMPLETED").'</th></tr>';
$x = 1;
while ($trow = mysql_fetch_assoc($tres)) {
$colour = $trow["online"] == "yes" ? "green" : "red";
echo "<tr class="table_col$x"><td><font color="$colour"><b>".htmlspecialchars($trow['url'])."</b></font></td><td align="center">".number_format($trow["seeders"])."</td><td align="center">".number_format($trow["leechers"])."</td><td align="center">".number_format($trow["times_completed"])."</td></tr>";
$x = $x == 1 ? 2 : 1;
}
echo '</table>';
}

echo "<br /><br /><b>".T_("FILE_LIST").":</b>&nbsp;<img src='images/plus.gif' id='pic1' onclick='klappe_torrent(1)' alt='' /><div id='k1' style='display: none;'><table align='center' cellpadding='0' cellspacing='0' class='table_table' border='1' width='100%'><tr><th class='table_head' align='left'>&nbsp;".T_("FILE")."</th><th width='50' class='table_head'>&nbsp;".T_("SIZE")."</th></tr>";
$fres = SQL_Query_exec("SELECT * FROM `files` WHERE `torrent` = $id ORDER BY `path` ASC");
if (mysql_num_rows($fres)) {
while ($frow = mysql_fetch_assoc($fres)) {
echo "<tr><td class='table_col1'>".htmlspecialchars($frow['path'])."</td><td class='table_col2'>".mksize($frow['filesize'])."</td></tr>";
}
}else{
echo "<tr><td class='table_col1'>".htmlspecialchars($row["name"])."</td><td class='table_col2'>".mksize($row["size"])."</td></tr>";
}
echo "</table></div>";

if ($row["external"]!='yes'){
echo "<br /><br /><b>".T_("PEERS_LIST").":</b><br />";
$query = SQL_Query_exec("SELECT * FROM peers WHERE torrent = $id ORDER BY seeder DESC");

$result = mysql_num_rows($query);
if($result == 0) {
echo T_("NO_ACTIVE_PEERS")."n";
}else{
?>

<table border="0" cellpadding="3" cellspacing="0" width="100%" class="table_table">
<tr>
<th class="table_head"><?php echo T_("PORT"); ?></th>
<th class="table_head"><?php echo T_("UPLOADED"); ?></th>
<th class="table_head"><?php echo T_("DOWNLOADED"); ?></th>
<th class="table_head"><?php echo T_("RATIO"); ?></th>
<th class="table_head"><?php echo T_("LEFT"); ?></th>
<th class="table_head"><?php echo T_("FINISHED_SHORT"). "%"; ?></th>
<th class="table_head"><?php echo T_("SEED"); ?></th>
<th class="table_head"><?php echo T_("CONNECTED_SHORT"); ?></th>
<th class="table_head"><?php echo T_("CLIENT"); ?></th>
<th class="table_head"><?php echo T_("USER_SHORT"); ?></th>

</tr>

<?php
while($row1 = mysql_fetch_array($query)) {

if ($row1["downloaded"] > 0){
$ratio = $row1["uploaded"] / $row1["downloaded"];
$ratio = number_format($ratio, 3);
}else{
$ratio = "---";
}

$percentcomp = sprintf("%.2f", 100 * (1 - ($row1["to_go"] / $row["size"])));

if ($site_config["MEMBERSONLY"]) {
$res = SQL_Query_exec("SELECT id, username, privacy FROM users WHERE id=".$row1["userid"]."");
$arr = mysql_fetch_array($res);

$arr["username"] = "<a href='account-details.php?id=$arr[id]'>$arr[username]</a>";
}

# With $site_config["MEMBERSONLY"] off this will be shown.
if ( !$arr["username"] ) $arr["username"] = "Unknown User";

if ($arr["privacy"] != "strong" || ($CURUSER["control_panel"] == "yes")) {
print("<tr><td class='table_col2'>".$row1["port"]."</td><td class='table_col1'>".mksize($row1["uploaded"])."</td><td class='table_col2'>".mksize($row1["downloaded"])."</td><td class='table_col1'>".$ratio."</td><td class='table_col2'>".mksize($row1["to_go"])."</td><td class='table_col1'>".$percentcomp."%</td><td class='table_col2'>$row1[seeder]</td><td class='table_col1'>$row1[connectable]</td><td class='table_col2'>".htmlspecialchars($row1["client"])."</td><td class='table_col1'>$arr[username]</td></tr>");
}else{
print("<tr><td class='table_col2'>".$row1["port"]."</td><td class='table_col1'>".mksize($row1["uploaded"])."</td><td class='table_col2'>".mksize($row1["downloaded"])."</td><td class='table_col1'>".$ratio."</td><td class='table_col2'>".mksize($row1["to_go"])."</td><td class='table_col1'>".$percentcomp."%</td><td class='table_col2'>$row1[seeder]</td><td class='table_col1'>$row1[connectable]</td><td class='table_col2'>".htmlspecialchars($row1["client"])."</td><td class='table_col1'>Private</td></tr>");
}

}
echo "</table>";
}
}

echo "<br /><br />";
//DISPLAY NFO BLOCK
function my_nfo_translate($nfo){
$trans = array(
"x80" => "&#199;", "x81" => "&#252;", "x82" => "&#233;", "x83" => "&#226;", "x84" => "&#228;", "x85" => "&#224;", "x86" => "&#229;", "x87" => "&#231;", "x88" => "&#234;", "x89" => "&#235;", "x8a" => "&#232;", "x8b" => "&#239;", "x8c" => "&#238;", "x8d" => "&#236;", "x8e" => "&#196;", "x8f" => "&#197;", "x90" => "&#201;",
"x91" => "&#230;", "x92" => "&#198;", "x93" => "&#244;", "x94" => "&#246;", "x95" => "&#242;", "x96" => "&#251;", "x97" => "&#249;", "x98" => "&#255;", "x99" => "&#214;", "x9a" => "&#220;", "x9b" => "&#162;", "x9c" => "&#163;", "x9d" => "&#165;", "x9e" => "&#8359;", "x9f" => "&#402;", "xa0" => "&#225;", "xa1" => "&#237;",
"xa2" => "&#243;", "xa3" => "&#250;", "xa4" => "&#241;", "xa5" => "&#209;", "xa6" => "&#170;", "xa7" => "&#186;", "xa8" => "&#191;", "xa9" => "&#8976;", "xaa" => "&#172;", "xab" => "&#189;", "xac" => "&#188;", "xad" => "&#161;", "xae" => "&#171;", "xaf" => "&#187;", "xb0" => "&#9617;", "xb1" => "&#9618;", "xb2" => "&#9619;",
"xb3" => "&#9474;", "xb4" => "&#9508;", "xb5" => "&#9569;", "xb6" => "&#9570;", "xb7" => "&#9558;", "xb8" => "&#9557;", "xb9" => "&#9571;", "xba" => "&#9553;", "xbb" => "&#9559;", "xbc" => "&#9565;", "xbd" => "&#9564;", "xbe" => "&#9563;", "xbf" => "&#9488;", "xc0" => "&#9492;", "xc1" => "&#9524;", "xc2" => "&#9516;", "xc3" => "&#9500;",
"xc4" => "&#9472;", "xc5" => "&#9532;", "xc6" => "&#9566;", "xc7" => "&#9567;", "xc8" => "&#9562;", "xc9" => "&#9556;", "xca" => "&#9577;", "xcb" => "&#9574;", "xcc" => "&#9568;", "xcd" => "&#9552;", "xce" => "&#9580;", "xcf" => "&#9575;", "xd0" => "&#9576;", "xd1" => "&#9572;", "xd2" => "&#9573;", "xd3" => "&#9561;", "xd4" => "&#9560;",
"xd5" => "&#9554;", "xd6" => "&#9555;", "xd7" => "&#9579;", "xd8" => "&#9578;", "xd9" => "&#9496;", "xda" => "&#9484;", "xdb" => "&#9608;", "xdc" => "&#9604;", "xdd" => "&#9612;", "xde" => "&#9616;", "xdf" => "&#9600;", "xe0" => "&#945;", "xe1" => "&#223;", "xe2" => "&#915;", "xe3" => "&#960;", "xe4" => "&#931;", "xe5" => "&#963;",
"xe6" => "&#181;", "xe7" => "&#964;", "xe8" => "&#934;", "xe9" => "&#920;", "xea" => "&#937;", "xeb" => "&#948;", "xec" => "&#8734;", "xed" => "&#966;", "xee" => "&#949;", "xef" => "&#8745;", "xf0" => "&#8801;", "xf1" => "&#177;", "xf2" => "&#8805;", "xf3" => "&#8804;", "xf4" => "&#8992;", "xf5" => "&#8993;", "xf6" => "&#247;",
"xf7" => "&#8776;", "xf8" => "&#176;", "xf9" => "&#8729;", "xfa" => "&#183;", "xfb" => "&#8730;", "xfc" => "&#8319;", "xfd" => "&#178;", "xfe" => "&#9632;", "xff" => "&#160;",
);
$trans2 = array("xe4" => "&auml;", "xF6" => "&ouml;", "xFC" => "&uuml;", "xC4" => "&Auml;", "xD6" => "&Ouml;", "xDC" => "&Uuml;", "xDF" => "&szlig;");
$all_chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
$last_was_ascii = False;
$tmp = "";
$nfo = $nfo . "00";
for ($i = 0; $i < (strlen($nfo) - 1); $i++)
{
$char = $nfo[$i];
if (isset($trans2[$char]) and ($last_was_ascii or strpos($all_chars, ($nfo[$i + 1]))))
{
$tmp = $tmp . $trans2[$char];
$last_was_ascii = True;
}
else
{
if (isset($trans[$char]))
{
$tmp = $tmp . $trans[$char];
}
else
{
$tmp = $tmp . $char;
}
$last_was_ascii = strpos($all_chars, $char);
}
}
return $tmp;
}
//-----------------------------------------------

//DISPLAY NFO BLOCK
if($row["nfo"]== "yes"){
$nfofilelocation = "$nfo_dir/$row[id].nfo";
$filegetcontents = file_get_contents($nfofilelocation);
$nfo = htmlspecialchars($filegetcontents);
if ($nfo) {
$nfo = my_nfo_translate($nfo);
echo "<br /><br /><b>NFO:</b><br />";
print("<textarea class='nfo' style='width:98%;height:100%;' rows='20' cols='20' readonly='readonly'>".stripslashes($nfo)."</textarea>");
}else{
print(T_("ERROR")." reading .nfo file!");
}
}
end_frame();
begin_frame(T_("COMMENTS"));
echo "<p align=center><a class=index href=torrents-comment.php?id=$id>" .T_("ADDCOMMENT"). "</a></p>n";

$subres = SQL_Query_exec("SELECT COUNT(*) FROM comments WHERE torrent = $id");
$subrow = mysql_fetch_array($subres);
$commcount = $subrow[0];

if ($commcount) {
list($pagertop, $pagerbottom, $limit) = pager(10, $commcount, "torrents-details.php?id=$id&amp;");
$commquery = "SELECT comments.id, text, user, comments.added, avatar, signature, username, title, class, uploaded, downloaded, privacy, donated FROM comments LEFT JOIN users ON comments.user = users.id WHERE torrent = $id ORDER BY comments.id $limit";
$commres = SQL_Query_exec($commquery);
}else{
unset($commres);
}

if ($commcount) {
print($pagertop);
commenttable($commres, 'torrent');
print($pagerbottom);
}else {
print("<br /><b>" .T_("NOCOMMENTS"). "</b><br />n");
}

require_once("backend/bbcode.php");

if ($CURUSER) {
echo "<center>";
echo "<form name="comment" method="post" action="torrents-details.php?id=$row[id]&amp;takecomment=yes">";
echo textbbcode("comment","body")."<br />";
echo "<input type="submit" value="".T_("ADDCOMMENT")."" />";
echo "</form></center>";
}

end_frame();

stdfoot();
?>

greetz :]
awesome^^

but only old zip or rar files will be downloaded with magnet links  :(

torrent links works great^^


<?php
//
// TorrentTrader v2.x
// $LastChangedDate: 2011-11-24 05:42:28 +0000 (Thu, 24 Nov 2011) $
// $LastChangedBy: dj-howarth1 $
//
// http://www.torrenttrader.org
//
//
require_once("backend/functions.php");
require_once("backend/BDecode.php");
dbconn();

$torrent_dir = $site_config["torrent_dir"];
$nfo_dir = $site_config["nfo_dir"];

//check permissions
if ($site_config["MEMBERSONLY"]){
loggedinonly();

if($CURUSER["view_torrents"]=="no")
show_error_msg(T_("ERROR"), T_("NO_TORRENT_VIEW"), 1);
}

//************ DO SOME "GET" STUFF BEFORE PAGE LAYOUT ***************

$id = (int) $_GET["id"];
$scrape = (int)$_GET["scrape"];
if (!is_valid_id($id))
show_error_msg("ERROR", T_("THATS_NOT_A_VALID_ID"), 1);

//GET ALL MYSQL VALUES FOR THIS TORRENT
$res = SQL_Query_exec("SELECT torrents.anon, torrents.seeders, torrents.thanks, 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, torrents.webseed, 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.privacy 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 WHERE torrents.id = $id");
$row = mysql_fetch_assoc($res);

//DECIDE IF TORRENT EXISTS
if (!$row || ($row["banned"] == "yes" && $CURUSER["edit_torrents"] == "no"))
show_error_msg(T_("ERROR"), T_("TORRENT_NOT_FOUND"), 1);

//torrent is availiable so do some stuff

if ($_GET["hit"]) {
SQL_Query_exec("UPDATE torrents SET views = views + 1 WHERE id = $id");
header("Location: torrents-details.php?id=$id");
die;
}

stdhead(T_("DETAILS_FOR_TORRENT")." "" . $row["name"] . """);

if ($CURUSER["id"] == $row["owner"] || $CURUSER["edit_torrents"] == "yes")
$owned = 1;
else
$owned = 0;

//take rating
if ($_GET["takerating"] == 'yes'){
$rating = (int)$_POST['rating'];

if ($rating <= 0 || $rating > 5)
show_error_msg(T_("RATING_ERROR"), T_("INVAILD_RATING"), 1);

$res = SQL_Query_exec("INSERT INTO ratings (torrent, user, rating, added) VALUES ($id, " . $CURUSER["id"] . ", $rating, '".get_date_time()."')");

if (!$res) {
if (mysql_errno() == 1062)
show_error_msg(T_("RATING_ERROR"), T_("YOU_ALREADY_RATED_TORRENT"), 1);
else
show_error_msg(T_("RATING_ERROR"), T_("A_UNKNOWN_ERROR_CONTACT_STAFF"), 1);
}

SQL_Query_exec("UPDATE torrents SET numratings = numratings + 1, ratingsum = ratingsum + $rating WHERE id = $id");
show_error_msg(T_("RATING_ERROR"), T_("RATING_THANK")."<br /><br /><a href='torrents-details.php?id=$id'>" .T_("BACK_TO_TORRENT"). "</a>");
}

//take comment add
if ($_GET["takecomment"] == 'yes'){
loggedinonly();
$body = $_POST['body'];

if (!$body)
show_error_msg(T_("RATING_ERROR"), T_("YOU_DID_NOT_ENTER_ANYTHING"), 1);

SQL_Query_exec("UPDATE torrents SET comments = comments + 1 WHERE id = $id");

SQL_Query_exec("INSERT INTO comments (user, torrent, added, text) VALUES (".$CURUSER["id"].", ".$id.", '" .get_date_time(). "', " . sqlesc($body).")");

if (mysql_affected_rows() == 1)
show_error_msg(T_("COMPLETED"), T_("COMMENT_ADDED"), 0);
else
show_error_msg(T_("ERROR"), T_("UNABLE_TO_ADD_COMMENT"), 0);
}//end insert comment

//START OF PAGE LAYOUT HERE
$char1 = 50; //cut length
$shortname = CutName(htmlspecialchars($row["name"]), $char1);

begin_frame(T_("TORRENT_DETAILS_FOR"). " "" . $shortname . """);

echo "<div align='right'>[<a href='report.php?torrent=$id'><b>" .T_("REPORT_TORRENT"). "</b></a>]&nbsp;";
if ($owned)
echo "[<a href='torrents-edit.php?id=$row[id]&amp;returnto=" . urlencode($_SERVER["REQUEST_URI"]) . "'><b>".T_("EDIT_TORRENT")."</b></a>]";
echo "</div>";

echo "<center><h1>" . $shortname . "</h1></center>";

// Calculate local torrent speed test
if ($row["leechers"] >= 1 && $row["seeders"] >= 1 && $row["external"]!='yes'){
$speedQ = SQL_Query_exec("SELECT (SUM(p.downloaded)) / (UNIX_TIMESTAMP('".get_date_time()."') - UNIX_TIMESTAMP(added)) AS totalspeed FROM torrents AS t LEFT JOIN peers AS p ON t.id = p.torrent WHERE p.seeder = 'no' AND p.torrent = '$id' GROUP BY t.id ORDER BY added ASC LIMIT 15");
$a = mysql_fetch_assoc($speedQ);
$totalspeed = mksize($a["totalspeed"]) . "/s";
}else{
$totalspeed = T_("NO_ACTIVITY");
}

//download box
echo "<center><table border='0' width='100%'><tr><td><div id='downloadbox'>";
if ($row["banned"] == "yes"){
print ("<center><b>" .T_("DOWNLOAD"). ": </b>BANNED!</center>");
}else{
//print ("<table border='0' cellpadding='0' width='100%'><tr><td align='center' valign='middle' width='54'><a href="download.php?id=$id&amp;name=" . rawurlencode($row["filename"]) . ""><img src="".$site_config["SITEURL"]."/images/download_torrent.png" border="0" alt='' /></a></td>");
//print ("<table border=0 cellpadding=0 width=95%><tr><td align=center valign=middle width='204px'><a href="download.php?id=$id&name=" . rawurlencode($row["filename"]) . ""><img src="".$site_config["SITEURL"]."/images/download_torrent.png" border="0"></a><a href="magnet:?xt=urn:btih:" . $row['info_hash'] . "&dn=" . rawurlencode($row['name']) . "&tr=" . $row['announce'] . ""><img src="".$site_config["SITEURL"]."/images/magnet.png" border="0"></a></td>");
//print ("<td valign='top'><a href="download.php?id=$id&amp;name=" . rawurlencode($row["filename"]) . "">".T_("DOWNLOAD_TORRENT")."</a><br />");
//print ("<a href="magnet:?xt=urn:btih:" . $row['info_hash'] . "&dn=" . rawurlencode($row['name']) . "&tr=" . $row['announce'] . ""><font size=4pt>get this torrent per magnet :]</font></a><BR><BR>");
if ($row["external"] == 'yes')
$announce_url2 = $row['announce'];
else
$announce_url2 = sprintf($site_config["PASSKEYURL"], $CURUSER["passkey"]);
print ("<table border=0 cellpadding=0 width=95%><tr><td align=left valign=middle width='204px'><a href="download.php?id=$id&name=" . rawurlencode($row["filename"]) . ""><img src="".$site_config["SITEURL"]."/images/download_torrent.png" border="0"></a><a href="magnet:?xt=urn:btih:" . $row['info_hash'] . "&dn=" . rawurlencode($row['name']) . "&tr=" . $announce_url2 . ""><img src="" .$site_config["SITEURL"]."/images/magnet.png" border="0"></a></td>");


print ("<b>" .T_("HEALTH"). ": </b><img src='".$site_config["SITEURL"]."/images/health/health_".health($row["leechers"], $row["seeders"]).".gif' alt='' /><br />");
print ("<b>" .T_("SEEDS"). ": </b><font color='green'>" . number_format($row["seeders"]) . "</font><br />");
print ("<b>".T_("LEECHERS").": </b><font color='#ff0000'>" . number_format($row["leechers"]) . "</font><br />");

if ($row["external"]!='yes'){
print ("<b>".T_("SPEED").": </b>" . $totalspeed . "<br />");
}

print ("<b>".T_("COMPLETED").":</b> " . number_format($row["times_completed"]) . "&nbsp;");

if ($row["external"] != "yes" && $row["times_completed"] > 0) {
echo("[<a href='torrents-completed.php?id=$id'>" .T_("WHOS_COMPLETED"). "</a>] ");
if ($row["seeders"] <= 1) {
echo("[<a href='torrents-reseed.php?id=$id'>" .T_("REQUEST_A_RE_SEED"). "</a>]");
}
}
echo "<br />";

if ($row["external"]!='yes' && $row["freeleech"]=='1'){
print ("<b>".T_("FREE_LEECH").": </b><font color='#ff0000'>".T_("FREE_LEECH_MSG")."</font><br />");
}
//
if ($row["external"]!='yes' && $row["webseed"]=='1'){
print ("<B>Webseed: </b><font color=red>Seed with ro0t or seedb0x :]</font> &nbsp;<img src="".$site_config["SITEURL"]."/images/webseed.gif" border="0"></a><BR>");
}
//

print ("<b>".T_("LAST_CHECKED").": </b>" . date("d-m-Y H:i:s", utc_to_tz_time($row["last_action"])) . "<br /></td>");

if ($row["external"]=='yes'){

if ($scrape =='1'){
print("<td valign='top' align='right'><b>Tracked: </b>EXTERNAL<br /><br />");
$seeders1 = $leechers1 = $downloaded1 = null;

$tres = SQL_Query_exec("SELECT url FROM announce WHERE torrent=$id");
while ($trow = mysql_fetch_array($tres)) {
$ann = $trow["url"];
$tracker = explode("/", $ann);
$path = array_pop($tracker);
$oldpath = $path;
$path = preg_replace("/^announce/", "scrape", $path);
$tracker = implode("/", $tracker)."/".$path;

if ($oldpath == $path) {
continue; // Scrape not supported, ignored
}

// TPB's tracker is dead. Use openbittorrent instead
if (preg_match("/thepiratebay.org/i", $tracker) || preg_match("/prq.to/", $tracker)) {
$tracker = "http://tracker.openbittorrent.com/scrape";
}

$stats = torrent_scrape_url($tracker, $row["info_hash"]);
if ($stats['seeds'] != -1) {
$seeders1 += $stats['seeds'];
$leechers1 += $stats['peers'];
$downloaded1 += $stats['downloaded'];
SQL_Query_exec("UPDATE `announce` SET `online` = 'yes', `seeders` = $stats[seeds], `leechers` = $stats[peers], `times_completed` = $stats[downloaded] WHERE `url` = ".sqlesc($ann)." AND `torrent` = $id");
} else {
SQL_Query_exec("UPDATE `announce` SET `online` = 'no' WHERE `url` = ".sqlesc($ann)." AND `torrent` = $id");

}
}

if ($seeders1 !== null){ //only update stats if data is received
print ("<b>".T_("LIVE_STATS").": </b><br />");
print ("Seeders: ".number_format($seeders1)."<br />");
print ("Leechers: ".number_format($leechers1)."<br />");
print (T_("COMPLETED").": ".number_format($downloaded1)."<br />");

SQL_Query_exec("UPDATE torrents SET leechers='".$leechers1."', seeders='".$seeders1."', times_completed='".$downloaded1."',last_action= '".get_date_time()."',visible='yes' WHERE id='".$row['id']."'");
}else{
print ("<b>".T_("LIVE_STATS").": </b><br />");
print ("<font color='#ff0000'>Tracker Timeout<br />Please retry later</font><br />");
}

print ("<form action='torrents-details.php?id=$id&amp;scrape=1' method='post'><input type="submit" name="submit" value="Update Stats" /></form></td>");
}else{
print ("<td valign='top' align='right'><b>Tracked:</b> EXTERNAL<br /><br /><form action='torrents-details.php?id=$id&amp;scrape=1' method='post'><input type="submit" name="submit" value="Update Stats" /></form></td>");
}
}

echo "</tr></table>";
}
echo "</div></td></tr></table></center><br /><br />";
//end download box


echo "<fieldset class='download'><legend><b>Details</b></legend>";
echo "<table cellpadding='3' border='0' width='100%'>";
print("<tr><td align='left'><b>".T_("NAME").":</b></td><td>" . $shortname . "</td></tr>n");
print("<tr><td align='left' colspan='2'><b>" .T_("DESCRIPTION"). ":</b><br />" . format_comment($row['descr']) . "</td></tr>n");
print("<tr><td align='left'><b>" .T_("CATEGORY"). ":</b></td><td>" . $row["cat_parent"] . " > " . $row["cat_name"] . "</td></tr>n");

if (empty($row["lang_name"])) $row["lang_name"] = "Unknown/NA";
print("<tr><td align='left'><b>" .T_("LANG"). ":</b></td><td>" . $row["lang_name"] . "n");

if (isset($row["lang_image"]) && $row["lang_image"] != "")
print("&nbsp;<img border="0" src="" . $site_config['SITEURL'] . "/images/languages/" . $row["lang_image"] . "" alt="" . $row["lang_name"] . "" />");

print("</td></tr>");

print("<tr><td align='left'><b>" .T_("TOTAL_SIZE"). ":</b></td><td>" . mksize($row["size"]) . " </td></tr>n");
print("<tr><td align='left'><b>" .T_("INFO_HASH"). ":</b></td><td>" . $row["info_hash"] . "</td></tr>n");
print("");
if ($row["anon"] == "yes" && !$owned)
print("<tr><td align='left'><b>" .T_("ADDED_BY"). ":</b></td><td>Anonymous</td></tr>");

print("<tr><td align='left'><b>" .T_("ADDED_BY"). ":</b></td><td>Unknown</td></tr>");

print("<tr><td align='left'><b>" .T_("DATE_ADDED"). ":</b></td><td>" . date("d-m-Y H:i:s", utc_to_tz_time($row["added"])) . "</td></tr>n");
print("<tr><td align='left'><b>" .T_("VIEWS"). ":</b></td><td>" . number_format($row["views"]) . "</td></tr>n");
print("<tr><td align='left'><b>".T_("HITS").":</b></td><td>" . number_format($row["hits"]) . "</td></tr>n");
$thanksl = explode(",", $row['thanks']);
if ($CURUSER['username'] == $row['username'] || !$CURUSER) $leftthanks = true;
foreach ($thanksl as $u) {
$thanks .= ($i>0)?", $u":$u;
if ($u == $CURUSER['username']) $leftthanks = true;
$i++;
}

if (!$thanks) $thanks = "No one yet.";

print("<tr><td align=left><b>Thanks By:</b></td><td>$thanks</td></tr>n");
if (!$leftthanks) print("<tr><td align=left>&nbsp;</td><td><form action=thanks.php method=POST><input type=hidden name=torrent value=$id><input type=submit value='Thanks!'></form></td></tr>n");
echo "</table></fieldset><br /><br />";

// $srating IS RATING VARIABLE
$srating = "";
$srating .= "<table class='f-border' cellspacing="1" cellpadding="4" width='100%'><tr><td class='f-title' width='60'><b>".T_("RATINGS").":</b></td><td class='f-title' valign='middle'>";
if (!isset($row["rating"])) {
$srating .= "Not Yet Rated";
}else{
$rpic = ratingpic($row["rating"]);
if (!isset($rpic))
$srating .= "invalid?";
else
$srating .= "$rpic (" . $row["rating"] . " ".T_("OUT_OF")." 5) " . $row["numratings"] . " ".T_("USERS_HAVE_RATED");
}
$srating .= "n";
if (!isset($CURUSER))
$srating .= "(<a href="account-login.php?returnto=" . urlencode($_SERVER["REQUEST_URI"]) . "&amp;nowarn=1">Log in</a> to rate it)";
else {
$ratings = array(
5 => T_("COOL"),
4 => T_("PRETTY_GOOD"),
3 => T_("DECENT"),
2 => T_("PRETTY_BAD"),
1 => T_("SUCKS")
);
//if (!$owned || $moderator) {
$xres = SQL_Query_exec("SELECT rating, added FROM ratings WHERE torrent = $id AND user = " . $CURUSER["id"]);
$xrow = mysql_fetch_assoc($xres);
if ($xrow)
$srating .= "<br /><i>(".T_("YOU_RATED")." "" . $xrow["rating"] . " - " . $ratings[$xrow["rating"]] . "")</i>";
else {
$srating .= "<form style="display:inline;" method="post" action="torrents-details.php?id=$id&amp;takerating=yes"><input type="hidden" name="id" value="$id" />n";
$srating .= "<select name="rating">n";
$srating .= "<option value="0">(".T_("ADD_RATING").")</option>n";
foreach ($ratings as $k => $v) {
$srating .= "<option value="$k">$k - $v</option>n";
}
$srating .= "</select>n";
$srating .= "<input type="submit" value="".T_("VOTE")."" />";
$srating .= "</form>n";
}
//}
}
$srating .= "</td></tr></table>";

print("<center>". $srating . "</center>");// rating

//END DEFINE RATING VARIABLE

echo "<br />";

if ($row["image1"] != "" OR $row["image2"] != "") {

if ($row["image1"] != "")

$img1 = "<a href=".$site_config["SITEURL"]."/uploads/images/$row[image1] rel=gb_imageset[nice_pics] title=" . $shortname . "><IMG class=glossy src=".$site_config["SITEURL"]."/uploads/images/$row[image1] width=150 border=0></a>";

if ($row["image2"] != "")

$img2 = "<a href=".$site_config["SITEURL"]."/uploads/images/$row[image2] rel=gb_imageset[nice_pics] title=" . $shortname . "><IMG class=glossy src=".$site_config["SITEURL"]."/uploads/images/$row[image2] width=150 border=0></a>";

print("<CENTER>". $img1 . "&nbsp&nbsp" . $img2."</CENTER><BR>");

}

if ($row["external"]=='yes'){
print ("<br /><b>Tracker:</b><br /> ".htmlspecialchars($row['announce'])."<br />");
}

$tres = SQL_Query_exec("SELECT * FROM `announce` WHERE `torrent` = $id");
if (mysql_num_rows($tres) > 1){
echo "<br /><b>".T_("THIS_TORRENT_HAS_BACKUP_TRACKERS")."</b><br />";
echo '<table cellpadding="1" cellspacing="2" class="table_table"><tr>';
echo '<th class="table_head">URL</th><th class="table_head">'.T_("SEEDERS").'</th><th class="table_head">'.T_("LEECHERS").'</th><th class="table_head">'.T_("COMPLETED").'</th></tr>';
$x = 1;
while ($trow = mysql_fetch_assoc($tres)) {
$colour = $trow["online"] == "yes" ? "green" : "red";
echo "<tr class="table_col$x"><td><font color="$colour"><b>".htmlspecialchars($trow['url'])."</b></font></td><td align="center">".number_format($trow["seeders"])."</td><td align="center">".number_format($trow["leechers"])."</td><td align="center">".number_format($trow["times_completed"])."</td></tr>";
$x = $x == 1 ? 2 : 1;
}
echo '</table>';
}

echo "<br /><br /><b>".T_("FILE_LIST").":</b>&nbsp;<img src='images/plus.gif' id='pic1' onclick='klappe_torrent(1)' alt='' /><div id='k1' style='display: none;'><table align='center' cellpadding='0' cellspacing='0' class='table_table' border='1' width='100%'><tr><th class='table_head' align='left'>&nbsp;".T_("FILE")."</th><th width='50' class='table_head'>&nbsp;".T_("SIZE")."</th></tr>";
$fres = SQL_Query_exec("SELECT * FROM `files` WHERE `torrent` = $id ORDER BY `path` ASC");
if (mysql_num_rows($fres)) {
while ($frow = mysql_fetch_assoc($fres)) {
echo "<tr><td class='table_col1'>".htmlspecialchars($frow['path'])."</td><td class='table_col2'>".mksize($frow['filesize'])."</td></tr>";
}
}else{
echo "<tr><td class='table_col1'>".htmlspecialchars($row["name"])."</td><td class='table_col2'>".mksize($row["size"])."</td></tr>";
}
echo "</table></div>";

if ($row["external"]!='yes'){
echo "<br /><br /><b>".T_("PEERS_LIST").":</b><br />";
$query = SQL_Query_exec("SELECT * FROM peers WHERE torrent = $id ORDER BY seeder DESC");

$result = mysql_num_rows($query);
if($result == 0) {
echo T_("NO_ACTIVE_PEERS")."n";
}else{
?>

<table border="0" cellpadding="3" cellspacing="0" width="100%" class="table_table">
<tr>
<th class="table_head"><?php echo T_("PORT"); ?></th>
<th class="table_head"><?php echo T_("UPLOADED"); ?></th>
<th class="table_head"><?php echo T_("DOWNLOADED"); ?></th>
<th class="table_head"><?php echo T_("RATIO"); ?></th>
<th class="table_head"><?php echo T_("LEFT"); ?></th>
<th class="table_head"><?php echo T_("FINISHED_SHORT"). "%"; ?></th>
<th class="table_head"><?php echo T_("SEED"); ?></th>
<th class="table_head"><?php echo T_("CONNECTED_SHORT"); ?></th>
<th class="table_head"><?php echo T_("CLIENT"); ?></th>
<th class="table_head"><?php echo T_("USER_SHORT"); ?></th>
</tr>

<?php
while($row1 = mysql_fetch_array($query)) {

if ($row1["downloaded"] > 0){
$ratio = $row1["uploaded"] / $row1["downloaded"];
$ratio = number_format($ratio, 3);
}else{
$ratio = "---";
}

$percentcomp = sprintf("%.2f", 100 * (1 - ($row1["to_go"] / $row["size"])));

if ($site_config["MEMBERSONLY"]) {
$res = SQL_Query_exec("SELECT id, username, privacy FROM users WHERE id=".$row1["userid"]."");
$arr = mysql_fetch_array($res);

$arr["username"] = "<a href='account-details.php?id=$arr[id]'>$arr[username]</a>";
}

# With $site_config["MEMBERSONLY"] off this will be shown.
if ( !$arr["username"] ) $arr["username"] = "Unknown User";

if ($arr["privacy"] != "strong" || ($CURUSER["control_panel"] == "yes")) {
print("<tr><td class='table_col2'>".$row1["port"]."</td><td class='table_col1'>".mksize($row1["uploaded"])."</td><td class='table_col2'>".mksize($row1["downloaded"])."</td><td class='table_col1'>".$ratio."</td><td class='table_col2'>".mksize($row1["to_go"])."</td><td class='table_col1'>".$percentcomp."%</td><td class='table_col2'>$row1[seeder]</td><td class='table_col1'>$row1[connectable]</td><td class='table_col2'>".htmlspecialchars($row1["client"])."</td><td class='table_col1'>$arr[username]</td></tr>");
}else{
print("<tr><td class='table_col2'>".$row1["port"]."</td><td class='table_col1'>".mksize($row1["uploaded"])."</td><td class='table_col2'>".mksize($row1["downloaded"])."</td><td class='table_col1'>".$ratio."</td><td class='table_col2'>".mksize($row1["to_go"])."</td><td class='table_col1'>".$percentcomp."%</td><td class='table_col2'>$row1[seeder]</td><td class='table_col1'>$row1[connectable]</td><td class='table_col2'>".htmlspecialchars($row1["client"])."</td><td class='table_col1'>Private</td></tr>");
}

}
echo "</table>";
}
}

echo "<br /><br />";

//DISPLAY NFO BLOCK
function my_nfo_translate($nfo){
$trans = array(
"x80" => "Ç", "x81" => "ü", "x82" => "é", "x83" => "â", "x84" => "ä", "x85" => "à", "x86" => "å", "x87" => "ç", "x88" => "ê", "x89" => "ë", "x8a" => "è", "x8b" => "ï", "x8c" => "î", "x8d" => "ì", "x8e" => "Ä", "x8f" => "Å", "x90" => "É",
"x91" => "æ", "x92" => "Æ", "x93" => "ô", "x94" => "ö", "x95" => "ò", "x96" => "û", "x97" => "ù", "x98" => "ÿ", "x99" => "Ö", "x9a" => "Ü", "x9b" => "¢", "x9c" => "£", "x9d" => "¥", "x9e" => "?", "x9f" => "ƒ", "xa0" => "á", "xa1" => "í",
"xa2" => "ó", "xa3" => "ú", "xa4" => "ñ", "xa5" => "Ñ", "xa6" => "ª", "xa7" => "º", "xa8" => "¿", "xa9" => "?", "xaa" => "¬", "xab" => "½", "xac" => "¼", "xad" => "¡", "xae" => "«", "xaf" => "»", "xb0" => "?", "xb1" => "?", "xb2" => "?",
"xb3" => "?", "xb4" => "?", "xb5" => "?", "xb6" => "?", "xb7" => "?", "xb8" => "?", "xb9" => "?", "xba" => "?", "xbb" => "?", "xbc" => "?", "xbd" => "?", "xbe" => "?", "xbf" => "?", "xc0" => "?", "xc1" => "?", "xc2" => "?", "xc3" => "?",
"xc4" => "?", "xc5" => "?", "xc6" => "?", "xc7" => "?", "xc8" => "?", "xc9" => "?", "xca" => "?", "xcb" => "?", "xcc" => "?", "xcd" => "?", "xce" => "?", "xcf" => "?", "xd0" => "?", "xd1" => "?", "xd2" => "?", "xd3" => "?", "xd4" => "?",
"xd5" => "?", "xd6" => "?", "xd7" => "?", "xd8" => "?", "xd9" => "?", "xda" => "?", "xdb" => "?", "xdc" => "?", "xdd" => "?", "xde" => "?", "xdf" => "?", "xe0" => "?", "xe1" => "ß", "xe2" => "?", "xe3" => "?", "xe4" => "?", "xe5" => "?",
"xe6" => "µ", "xe7" => "?", "xe8" => "?", "xe9" => "?", "xea" => "?", "xeb" => "?", "xec" => "?", "xed" => "?", "xee" => "?", "xef" => "?", "xf0" => "?", "xf1" => "±", "xf2" => "?", "xf3" => "?", "xf4" => "?", "xf5" => "?", "xf6" => "÷",
"xf7" => "?", "xf8" => "°", "xf9" => "?", "xfa" => "·", "xfb" => "?", "xfc" => "?", "xfd" => "²", "xfe" => "?", "xff" => " ",
);
$trans2 = array("xe4" => "&auml;", "xF6" => "&ouml;", "xFC" => "&uuml;", "xC4" => "&Auml;", "xD6" => "&Ouml;", "xDC" => "&Uuml;", "xDF" => "ß");
$all_chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
$last_was_ascii = False;
$tmp = "";
$nfo = $nfo . "00";
for ($i = 0; $i < (strlen($nfo) - 1); $i++)
{
$char = $nfo[$i];
if (isset($trans2[$char]) and ($last_was_ascii or strpos($all_chars, ($nfo[$i + 1]))))
{
$tmp = $tmp . $trans2[$char];
$last_was_ascii = True;
}
else
{
if (isset($trans[$char]))
{
$tmp = $tmp . $trans[$char];
}
else
{
$tmp = $tmp . $char;
}
$last_was_ascii = strpos($all_chars, $char);
}
}
return $tmp;
}
//-----------------------------------------------

//DISPLAY NFO BLOCK
if($row["nfo"]== "yes"){
$nfofilelocation = "$nfo_dir/$row[id].nfo";
$filegetcontents = file_get_contents($nfofilelocation);
$nfo = htmlspecialchars($filegetcontents);
if ($nfo) {
$nfo = my_nfo_translate($nfo);
echo "<br /><br /><b>NFO:</b><br />";
print("<textarea class='nfo' style='width:98%;height:100%;' rows='20' cols='20' readonly='readonly'>".stripslashes($nfo)."</textarea>");
}else{
print(T_("ERROR")." reading .nfo file!");
}
}
end_frame();

begin_frame(T_("COMMENTS"));
//echo "<p align=center><a class=index href=torrents-comment.php?id=$id>" .T_("ADDCOMMENT"). "</a></p>n";

$subres = SQL_Query_exec("SELECT COUNT(*) FROM comments WHERE torrent = $id");
$subrow = mysql_fetch_array($subres);
$commcount = $subrow[0];

if ($commcount) {
list($pagertop, $pagerbottom, $limit) = pager(10, $commcount, "torrents-details.php?id=$id&amp;");
$commquery = "SELECT comments.id, text, user, comments.added, avatar, signature, username, title, class, uploaded, downloaded, privacy, donated FROM comments LEFT JOIN users ON comments.user = users.id WHERE torrent = $id ORDER BY comments.id $limit";
$commres = SQL_Query_exec($commquery);
}else{
unset($commres);
}

if ($commcount) {
print($pagertop);
commenttable($commres, 'torrent');
print($pagerbottom);
}else {
print("<br /><b>" .T_("NOCOMMENTS"). "</b><br />n");
}

require_once("backend/bbcode.php");

if ($CURUSER) {
echo "<center>";
echo "<form name="comment" method="post" action="torrents-details.php?id=$row[id]&amp;takecomment=yes">";
echo textbbcode("comment","body")."<br />";
echo "<input type="submit" value="".T_("ADDCOMMENT")."" />";
echo "</form></center>";
}

end_frame();

stdfoot();
?>

greetz
n1 mod but dont work 4 me  B)



<?php

//

//  TorrentTrader v2.x

//  $LastChangedDate: 2011-11-24 05:42:28 +0000 (Thu, 24 Nov 2011) $

//  $LastChangedBy: dj-howarth1 $

//

//  http://www.torrenttrader.org

//

//

require_once("backend/functions.php");

require_once("backend/BDecode.php");

dbconn();



$torrent_dir = $site_config["torrent_dir"];

$nfo_dir = $site_config["nfo_dir"];



//check permissions

if ($site_config["MEMBERSONLY"]){

loggedinonly();



if($CURUSER["view_torrents"]=="no")

show_error_msg(T_("ERROR"), T_("NO_TORRENT_VIEW"), 1);

}



//************ DO SOME "GET" STUFF BEFORE PAGE LAYOUT ***************



$id = (int) $_GET["id"];

$scrape = (int)$_GET["scrape"];

if (!is_valid_id($id))

show_error_msg("ERROR", T_("THATS_NOT_A_VALID_ID"), 1);



//GET ALL MYSQL VALUES FOR THIS TORRENT

$res = SQL_Query_exec("SELECT torrents.anon, torrents.seeders, torrents.thanks, 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, torrents.webseed, 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.privacy 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 WHERE torrents.id = $id");

$row = mysql_fetch_assoc($res);



//DECIDE IF TORRENT EXISTS

if (!$row || ($row["banned"] == "yes" && $CURUSER["edit_torrents"] == "no"))

show_error_msg(T_("ERROR"), T_("TORRENT_NOT_FOUND"), 1);



//torrent is availiable so do some stuff



if ($_GET["hit"]) {

SQL_Query_exec("UPDATE torrents SET views = views + 1 WHERE id = $id");

header("Location: torrents-details.php?id=$id");

die;

}



stdhead(T_("DETAILS_FOR_TORRENT")." "" . $row["name"] . """);



if ($CURUSER["id"] == $row["owner"] || $CURUSER["edit_torrents"] == "yes")

$owned = 1;

else

$owned = 0;



//take rating

if ($_GET["takerating"] == 'yes'){

$rating = (int)$_POST['rating'];



if ($rating <= 0 || $rating > 5)

show_error_msg(T_("RATING_ERROR"), T_("INVAILD_RATING"), 1);



$res = SQL_Query_exec("INSERT INTO ratings (torrent, user, rating, added) VALUES ($id, " . $CURUSER["id"] . ", $rating, '".get_date_time()."')");



if (!$res) {

if (mysql_errno() == 1062)

show_error_msg(T_("RATING_ERROR"), T_("YOU_ALREADY_RATED_TORRENT"), 1);

else

show_error_msg(T_("RATING_ERROR"), T_("A_UNKNOWN_ERROR_CONTACT_STAFF"), 1);

}



SQL_Query_exec("UPDATE torrents SET numratings = numratings + 1, ratingsum = ratingsum + $rating WHERE id = $id");

show_error_msg(T_("RATING_ERROR"), T_("RATING_THANK")."<br /><br /><a href='torrents-details.php?id=$id'>" .T_("BACK_TO_TORRENT"). "</a>");

}



//take comment add

if ($_GET["takecomment"] == 'yes'){

loggedinonly();

$body = $_POST['body'];



if (!$body)

show_error_msg(T_("RATING_ERROR"), T_("YOU_DID_NOT_ENTER_ANYTHING"), 1);



SQL_Query_exec("UPDATE torrents SET comments = comments + 1 WHERE id = $id");



SQL_Query_exec("INSERT INTO comments (user, torrent, added, text) VALUES (".$CURUSER["id"].", ".$id.", '" .get_date_time(). "', " . sqlesc($body).")");



if (mysql_affected_rows() == 1)

show_error_msg(T_("COMPLETED"), T_("COMMENT_ADDED"), 0);

else

show_error_msg(T_("ERROR"), T_("UNABLE_TO_ADD_COMMENT"), 0);

}//end insert comment



//START OF PAGE LAYOUT HERE

$char1 = 50; //cut length

$shortname = CutName(htmlspecialchars($row["name"]), $char1);



begin_frame(T_("TORRENT_DETAILS_FOR"). " "" . $shortname . """);



echo "<div align='right'>[<a href='report.php?torrent=$id'><b>" .T_("REPORT_TORRENT"). "</b></a>]&nbsp;";

if ($owned)

echo "[<a href='torrents-edit.php?id=$row[id]&amp;returnto=" . urlencode($_SERVER["REQUEST_URI"]) . "'><b>".T_("EDIT_TORRENT")."</b></a>]";

echo "</div>";



echo "<center><h1>" . $shortname . "</h1></center>";



// Calculate local torrent speed test

if ($row["leechers"] >= 1 && $row["seeders"] >= 1 && $row["external"]!='yes'){

$speedQ = SQL_Query_exec("SELECT (SUM(p.downloaded)) / (UNIX_TIMESTAMP('".get_date_time()."') - UNIX_TIMESTAMP(added)) AS totalspeed FROM torrents AS t LEFT JOIN peers AS p ON t.id = p.torrent WHERE p.seeder = 'no' AND p.torrent = '$id' GROUP BY t.id ORDER BY added ASC LIMIT 15");

$a = mysql_fetch_assoc($speedQ);

$totalspeed = mksize($a["totalspeed"]) . "/s";

}else{

$totalspeed = T_("NO_ACTIVITY");

}



//download box

echo "<center><table border='0' width='100%'><tr><td><div id='downloadbox'>";

if ($row["banned"] == "yes"){

print ("<center><b>" .T_("DOWNLOAD"). ": </b>BANNED!</center>");

}else{

//print ("<table border='0' cellpadding='0' width='100%'><tr><td align='center' valign='middle' width='54'><a href="download.php?id=$id&amp;name=" . rawurlencode($row["filename"]) . ""><img src="".$site_config["SITEURL"]."/images/download_torrent.png" border="0" alt='' /></a></td>");

print ("<table border=0 cellpadding=0 width=95%><tr><td align=center valign=middle width='204px'><a href="download.php?id=$id&name=" . rawurlencode($row["filename"]) . ""><img src="".$site_config["SITEURL"]."/images/download_torrent.png" border="0"></a><a href="magnet:?xt=urn:btih:" . $row['info_hash'] . "&dn=" . rawurlencode($row['name']) . "&tr=" . $row['announce'] . ""><img src="".$site_config["SITEURL"]."/images/magnet.png" border="0"></a></td>");

print ("<td valign='top'><a href="download.php?id=$id&amp;name=" . rawurlencode($row["filename"]) . "">".T_("DOWNLOAD_TORRENT")."</a><br />");

print ("<a href="magnet:?xt=urn:btih:" . $row['info_hash'] . "&dn=" . rawurlencode($row['name']) . "&tr=" . $row['announce'] . ""><font size=4pt>get this torrent per magnet :]</font></a><BR><BR>");

print ("<b>" .T_("HEALTH"). ": </b><img src='".$site_config["SITEURL"]."/images/health/health_".health($row["leechers"], $row["seeders"]).".gif' alt='' /><br />");

print ("<b>" .T_("SEEDS"). ": </b><font color='green'>" . number_format($row["seeders"]) . "</font><br />");

print ("<b>".T_("LEECHERS").": </b><font color='#ff0000'>" .  number_format($row["leechers"]) . "</font><br />");



if ($row["external"]!='yes'){

print ("<b>".T_("SPEED").": </b>" . $totalspeed . "<br />");

}



print ("<b>".T_("COMPLETED").":</b> " . number_format($row["times_completed"]) . "&nbsp;");



if ($row["external"] != "yes" && $row["times_completed"] > 0) {

echo("[<a href='torrents-completed.php?id=$id'>" .T_("WHOS_COMPLETED"). "</a>] ");

if ($row["seeders"] <= 1) {

echo("[<a href='torrents-reseed.php?id=$id'>" .T_("REQUEST_A_RE_SEED"). "</a>]");

}

}

echo "<br />";



if ($row["external"]!='yes' && $row["freeleech"]=='1'){

print ("<b>".T_("FREE_LEECH").": </b><font color='#ff0000'>".T_("FREE_LEECH_MSG")."</font><br />");

}

//

if ($row["external"]!='yes' && $row["webseed"]=='1'){

print ("<B>webseed: </b><font color=red>Seed with ro0t or seedb0x :]</font> &nbsp;<img src="".$site_config["SITEURL"]."/images/webseed.gif" border="0"></a><BR>");

}

//



print ("<b>".T_("LAST_CHECKED").": </b>" . date("d-m-Y H:i:s", utc_to_tz_time($row["last_action"])) . "<br /></td>");



if ($row["external"]=='yes'){



if ($scrape =='1'){

print("<td valign='top' align='right'><b>Tracked: </b>EXTERNAL<br /><br />");

$seeders1 = $leechers1 = $downloaded1 = null;



$tres = SQL_Query_exec("SELECT url FROM announce WHERE torrent=$id");

while ($trow = mysql_fetch_array($tres)) {

$ann = $trow["url"];

$tracker = explode("/", $ann);

$path = array_pop($tracker);

$oldpath = $path;

$path = preg_replace("/^announce/", "scrape", $path);

$tracker = implode("/", $tracker)."/".$path;



if ($oldpath == $path) {

continue; // Scrape not supported, ignored

}



// TPB's tracker is dead. Use openbittorrent instead

if (preg_match("/thepiratebay.org/i", $tracker) || preg_match("/prq.to/", $tracker)) {

$tracker = "http://tracker.openbittorrent.com/scrape";

}



$stats = torrent_scrape_url($tracker, $row["info_hash"]);

if ($stats['seeds'] != -1) {

$seeders1 += $stats['seeds'];

$leechers1 += $stats['peers'];

$downloaded1 += $stats['downloaded'];

SQL_Query_exec("UPDATE `announce` SET `online` = 'yes', `seeders` = $stats[seeds], `leechers` = $stats[peers], `times_completed` = $stats[downloaded] WHERE `url` = ".sqlesc($ann)." AND `torrent` = $id");

} else {

SQL_Query_exec("UPDATE `announce` SET `online` = 'no' WHERE `url` = ".sqlesc($ann)." AND `torrent` = $id");



}

}



if ($seeders1 !== null){ //only update stats if data is received

print ("<b>".T_("LIVE_STATS").": </b><br />");

print ("Seeders: ".number_format($seeders1)."<br />");

print ("Leechers: ".number_format($leechers1)."<br />");

print (T_("COMPLETED").": ".number_format($downloaded1)."<br />");



SQL_Query_exec("UPDATE torrents SET leechers='".$leechers1."', seeders='".$seeders1."', times_completed='".$downloaded1."',last_action= '".get_date_time()."',visible='yes' WHERE id='".$row['id']."'");

}else{

print ("<b>".T_("LIVE_STATS").": </b><br />");

print ("<font color='#ff0000'>Tracker Timeout<br />Please retry later</font><br />");

}



print ("<form action='torrents-details.php?id=$id&amp;scrape=1' method='post'><input type="submit" name="submit" value="Update Stats" /></form></td>");

}else{

print ("<td valign='top' align='right'><b>Tracked:</b> EXTERNAL<br /><br /><form action='torrents-details.php?id=$id&amp;scrape=1' method='post'><input type="submit" name="submit" value="Update Stats" /></form></td>");

}

}



echo "</tr></table>";

}

echo "</div></td></tr></table></center><br /><br />";

//end download box





echo "<fieldset class='download'><legend><b>Details</b></legend>";

echo "<table cellpadding='3' border='0' width='100%'>";

print("<tr><td align='left'><b>".T_("NAME").":</b></td><td>" . $shortname . "</td></tr>n");

print("<tr><td align='left' colspan='2'><b>" .T_("DESCRIPTION"). ":</b><br />" .  format_comment($row['descr']) . "</td></tr>n");

print("<tr><td align='left'><b>" .T_("CATEGORY"). ":</b></td><td>" . $row["cat_parent"] . " > " . $row["cat_name"] . "</td></tr>n");



if (empty($row["lang_name"])) $row["lang_name"] = "Unknown/NA";

print("<tr><td align='left'><b>" .T_("LANG"). ":</b></td><td>" . $row["lang_name"] . "n");



if (isset($row["lang_image"]) && $row["lang_image"] != "")

print("&nbsp;<img border="0" src="" . $site_config['SITEURL'] . "/images/languages/" . $row["lang_image"] . "" alt="" . $row["lang_name"] . "" />");



print("</td></tr>");



print("<tr><td align='left'><b>" .T_("TOTAL_SIZE"). ":</b></td><td>" . mksize($row["size"]) . " </td></tr>n");

print("<tr><td align='left'><b>" .T_("INFO_HASH"). ":</b></td><td>" . $row["info_hash"] . "</td></tr>n");

print("");

if ($row["anon"] == "yes" && !$owned)

print("<tr><td align='left'><b>" .T_("ADDED_BY"). ":</b></td><td>Anonymous</td></tr>");



print("<tr><td align='left'><b>" .T_("ADDED_BY"). ":</b></td><td>Unknown</td></tr>");



print("<tr><td align='left'><b>" .T_("DATE_ADDED"). ":</b></td><td>" . date("d-m-Y H:i:s", utc_to_tz_time($row["added"])) . "</td></tr>n");

print("<tr><td align='left'><b>" .T_("VIEWS"). ":</b></td><td>" . number_format($row["views"]) . "</td></tr>n");

print("<tr><td align='left'><b>".T_("HITS").":</b></td><td>" . number_format($row["hits"]) . "</td></tr>n");

$thanksl = explode(",", $row['thanks']);

if ($CURUSER['username'] == $row['username'] || !$CURUSER) $leftthanks = true;

foreach ($thanksl as $u) {

$thanks .= ($i>0)?", $u":$u;

if ($u == $CURUSER['username']) $leftthanks = true;

$i++;

}



if (!$thanks) $thanks = "No one yet.";



print("<tr><td align=left><b>Thanks By:</b></td><td>$thanks</td></tr>n");

if (!$leftthanks) print("<tr><td align=left>&nbsp;</td><td><form action=thanks.php method=POST><input type=hidden name=torrent value=$id><input type=submit value='Thanks!'></form></td></tr>n");

echo "</table></fieldset><br /><br />";



// $srating IS RATING VARIABLE

$srating = "";

$srating .= "<table class='f-border' cellspacing="1" cellpadding="4" width='100%'><tr><td class='f-title' width='60'><b>".T_("RATINGS").":</b></td><td class='f-title' valign='middle'>";

if (!isset($row["rating"])) {

$srating .= "Not Yet Rated";

}else{

$rpic = ratingpic($row["rating"]);

if (!isset($rpic))

$srating .= "invalid?";

else

$srating .= "$rpic (" . $row["rating"] . " ".T_("OUT_OF")." 5) " . $row["numratings"] . " ".T_("USERS_HAVE_RATED");

}

$srating .= "n";

if (!isset($CURUSER))

$srating .= "(<a href="account-login.php?returnto=" . urlencode($_SERVER["REQUEST_URI"]) . "&amp;nowarn=1">Log in</a> to rate it)";

else {

$ratings = array(

5 => T_("COOL"),

4 => T_("PRETTY_GOOD"),

3 => T_("DECENT"),

2 => T_("PRETTY_BAD"),

1 => T_("SUCKS")

);

//if (!$owned || $moderator) {

$xres = SQL_Query_exec("SELECT rating, added FROM ratings WHERE torrent = $id AND user = " . $CURUSER["id"]);

$xrow = mysql_fetch_assoc($xres);

if ($xrow)

$srating .= "<br /><i>(".T_("YOU_RATED")." "" . $xrow["rating"] . " - " . $ratings[$xrow["rating"]] . "")</i>";

else {

$srating .= "<form style="display:inline;" method="post" action="torrents-details.php?id=$id&amp;takerating=yes"><input type="hidden" name="id" value="$id" />n";

$srating .= "<select name="rating">n";

$srating .= "<option value="0">(".T_("ADD_RATING").")</option>n";

foreach ($ratings as $k => $v) {

$srating .= "<option value="$k">$k - $v</option>n";

}

$srating .= "</select>n";

$srating .= "<input type="submit" value="".T_("VOTE")."" />";

$srating .= "</form>n";

}

//}

}

$srating .= "</td></tr></table>";



print("<center>". $srating . "</center>");// rating



//END DEFINE RATING VARIABLE



echo "<br />";

 

if ($row["image1"] != "" OR $row["image2"] != "") {



 if ($row["image1"] != "")



$img1 = "<a href=".$site_config["SITEURL"]."/uploads/images/$row[image1] rel=gb_imageset[nice_pics] title=" . $shortname . "><IMG class=glossy src=".$site_config["SITEURL"]."/uploads/images/$row[image1] width=150 border=0></a>";



 if ($row["image2"] != "")



$img2 = "<a href=".$site_config["SITEURL"]."/uploads/images/$row[image2] rel=gb_imageset[nice_pics] title=" . $shortname . "><IMG class=glossy src=".$site_config["SITEURL"]."/uploads/images/$row[image2] width=150 border=0></a>";



 print("<CENTER>". $img1 . "&nbsp&nbsp" . $img2."</CENTER><BR>");



}



if ($row["external"]=='yes'){

print ("<br /><b>Tracker:</b><br /> ".htmlspecialchars($row['announce'])."<br />");

}



$tres = SQL_Query_exec("SELECT * FROM `announce` WHERE `torrent` = $id");

if (mysql_num_rows($tres) > 1){

echo "<br /><b>".T_("THIS_TORRENT_HAS_BACKUP_TRACKERS")."</b><br />";

echo '<table cellpadding="1" cellspacing="2" class="table_table"><tr>';

echo '<th class="table_head">URL</th><th class="table_head">'.T_("SEEDERS").'</th><th class="table_head">'.T_("LEECHERS").'</th><th class="table_head">'.T_("COMPLETED").'</th></tr>';

$x = 1;

while ($trow = mysql_fetch_assoc($tres)) {

$colour = $trow["online"] == "yes" ? "green" : "red";

echo "<tr class="table_col$x"><td><font color="$colour"><b>".htmlspecialchars($trow['url'])."</b></font></td><td align="center">".number_format($trow["seeders"])."</td><td align="center">".number_format($trow["leechers"])."</td><td align="center">".number_format($trow["times_completed"])."</td></tr>";

$x = $x == 1 ? 2 : 1;

}

echo '</table>';

}



echo "<br /><br /><b>".T_("FILE_LIST").":</b>&nbsp;<img src='images/plus.gif' id='pic1' onclick='klappe_torrent(1)' alt='' /><div id='k1' style='display: none;'><table align='center' cellpadding='0' cellspacing='0' class='table_table' border='1' width='100%'><tr><th class='table_head' align='left'>&nbsp;".T_("FILE")."</th><th width='50' class='table_head'>&nbsp;".T_("SIZE")."</th></tr>";

$fres = SQL_Query_exec("SELECT * FROM `files` WHERE `torrent` = $id ORDER BY `path` ASC");

if (mysql_num_rows($fres)) {

while ($frow = mysql_fetch_assoc($fres)) {

echo "<tr><td class='table_col1'>".htmlspecialchars($frow['path'])."</td><td class='table_col2'>".mksize($frow['filesize'])."</td></tr>";

}

}else{

echo "<tr><td class='table_col1'>".htmlspecialchars($row["name"])."</td><td class='table_col2'>".mksize($row["size"])."</td></tr>";

}

echo "</table></div>";



if ($row["external"]!='yes'){

echo "<br /><br /><b>".T_("PEERS_LIST").":</b><br />";

$query = SQL_Query_exec("SELECT * FROM peers WHERE torrent = $id ORDER BY seeder DESC");



$result = mysql_num_rows($query);

if($result == 0) {

echo T_("NO_ACTIVE_PEERS")."n";

}else{

?>



<table border="0" cellpadding="3" cellspacing="0" width="100%" class="table_table">

<tr>

<th class="table_head"><?php echo T_("PORT"); ?></th>

  <th class="table_head"><?php echo T_("UPLOADED"); ?></th>

  <th class="table_head"><?php echo T_("DOWNLOADED"); ?></th>

  <th class="table_head"><?php echo T_("RATIO"); ?></th>

  <th class="table_head"><?php echo T_("LEFT"); ?></th>

  <th class="table_head"><?php echo T_("FINISHED_SHORT"). "%"; ?></th>

  <th class="table_head"><?php echo T_("SEED"); ?></th>

  <th class="table_head"><?php echo T_("CONNECTED_SHORT"); ?></th>

  <th class="table_head"><?php echo T_("CLIENT"); ?></th>

  <th class="table_head"><?php echo T_("USER_SHORT"); ?></th>

</tr>



<?php

while($row1 = mysql_fetch_array($query)) {



if ($row1["downloaded"] > 0){

$ratio = $row1["uploaded"] / $row1["downloaded"];

$ratio = number_format($ratio, 3);

}else{

$ratio = "---";

}



$percentcomp = sprintf("%.2f", 100 * (1 - ($row1["to_go"] / $row["size"])));



if ($site_config["MEMBERSONLY"]) {

$res = SQL_Query_exec("SELECT id, username, privacy FROM users WHERE id=".$row1["userid"]."");

$arr = mysql_fetch_array($res);



$arr["username"] = "<a href='account-details.php?id=$arr[id]'>$arr[username]</a>";

}



# With $site_config["MEMBERSONLY"] off this will be shown.

if ( !$arr["username"] ) $arr["username"] = "Unknown User";



if ($arr["privacy"] != "strong" || ($CURUSER["control_panel"] == "yes")) {

print("<tr><td class='table_col2'>".$row1["port"]."</td><td class='table_col1'>".mksize($row1["uploaded"])."</td><td class='table_col2'>".mksize($row1["downloaded"])."</td><td class='table_col1'>".$ratio."</td><td class='table_col2'>".mksize($row1["to_go"])."</td><td class='table_col1'>".$percentcomp."%</td><td class='table_col2'>$row1[seeder]</td><td class='table_col1'>$row1[connectable]</td><td class='table_col2'>".htmlspecialchars($row1["client"])."</td><td class='table_col1'>$arr[username]</td></tr>");

}else{

print("<tr><td class='table_col2'>".$row1["port"]."</td><td class='table_col1'>".mksize($row1["uploaded"])."</td><td class='table_col2'>".mksize($row1["downloaded"])."</td><td class='table_col1'>".$ratio."</td><td class='table_col2'>".mksize($row1["to_go"])."</td><td class='table_col1'>".$percentcomp."%</td><td class='table_col2'>$row1[seeder]</td><td class='table_col1'>$row1[connectable]</td><td class='table_col2'>".htmlspecialchars($row1["client"])."</td><td class='table_col1'>Private</td></tr>");

}



}

echo "</table>";

}

}



echo "<br /><br />";



//DISPLAY NFO BLOCK

function my_nfo_translate($nfo){

$trans = array(

"x80" => "Ç", "x81" => "ü", "x82" => "é", "x83" => "â", "x84" => "ä", "x85" => "à", "x86" => "å", "x87" => "ç", "x88" => "ê", "x89" => "ë", "x8a" => "è", "x8b" => "ï", "x8c" => "î", "x8d" => "ì", "x8e" => "Ä", "x8f" => "Å", "x90" => "É",

"x91" => "æ", "x92" => "Æ", "x93" => "ô", "x94" => "ö", "x95" => "ò", "x96" => "û", "x97" => "ù", "x98" => "ÿ", "x99" => "Ö", "x9a" => "Ü", "x9b" => "¢", "x9c" => "£", "x9d" => "¥", "x9e" => "?", "x9f" => "ƒ", "xa0" => "á", "xa1" => "í",

"xa2" => "ó", "xa3" => "ú", "xa4" => "ñ", "xa5" => "Ñ", "xa6" => "ª", "xa7" => "º", "xa8" => "¿", "xa9" => "?", "xaa" => "¬", "xab" => "½", "xac" => "¼", "xad" => "¡", "xae" => "«", "xaf" => "»", "xb0" => "?", "xb1" => "?", "xb2" => "?",

"xb3" => "?", "xb4" => "?", "xb5" => "?", "xb6" => "?", "xb7" => "?", "xb8" => "?", "xb9" => "?", "xba" => "?", "xbb" => "?", "xbc" => "?", "xbd" => "?", "xbe" => "?", "xbf" => "?", "xc0" => "?", "xc1" => "?", "xc2" => "?", "xc3" => "?",

"xc4" => "?", "xc5" => "?", "xc6" => "?", "xc7" => "?", "xc8" => "?", "xc9" => "?", "xca" => "?", "xcb" => "?", "xcc" => "?", "xcd" => "?", "xce" => "?", "xcf" => "?", "xd0" => "?", "xd1" => "?", "xd2" => "?", "xd3" => "?", "xd4" => "?",

"xd5" => "?", "xd6" => "?", "xd7" => "?", "xd8" => "?", "xd9" => "?", "xda" => "?", "xdb" => "?", "xdc" => "?", "xdd" => "?", "xde" => "?", "xdf" => "?", "xe0" => "?", "xe1" => "ß", "xe2" => "?", "xe3" => "?", "xe4" => "?", "xe5" => "?",

"xe6" => "µ", "xe7" => "?", "xe8" => "?", "xe9" => "?", "xea" => "?", "xeb" => "?", "xec" => "?", "xed" => "?", "xee" => "?", "xef" => "?", "xf0" => "?", "xf1" => "±", "xf2" => "?", "xf3" => "?", "xf4" => "?", "xf5" => "?", "xf6" => "÷",

"xf7" => "?", "xf8" => "°", "xf9" => "?", "xfa" => "·", "xfb" => "?", "xfc" => "?", "xfd" => "²", "xfe" => "?", "xff" => " ",

);

$trans2 = array("xe4" => "&auml;", "xF6" => "&ouml;", "xFC" => "&uuml;", "xC4" => "&Auml;", "xD6" => "&Ouml;", "xDC" => "&Uuml;", "xDF" => "ß");

$all_chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";

$last_was_ascii = False;

$tmp = "";

$nfo = $nfo . "00";

for ($i = 0; $i < (strlen($nfo) - 1); $i++)

{

$char = $nfo[$i];

if (isset($trans2[$char]) and ($last_was_ascii or strpos($all_chars, ($nfo[$i + 1]))))

{

$tmp = $tmp . $trans2[$char];

$last_was_ascii = True;

}

else

{

if (isset($trans[$char]))

{

$tmp = $tmp . $trans[$char];

}

else

{

$tmp = $tmp . $char;

}

$last_was_ascii = strpos($all_chars, $char);

}

}

return $tmp;

}

//-----------------------------------------------



//DISPLAY NFO BLOCK

if($row["nfo"]== "yes"){

$nfofilelocation = "$nfo_dir/$row[id].nfo";

$filegetcontents = file_get_contents($nfofilelocation);

$nfo = htmlspecialchars($filegetcontents);

if ($nfo) {

$nfo = my_nfo_translate($nfo);

echo "<br /><br /><b>NFO:</b><br />";

print("<textarea class='nfo' style='width:98%;height:100%;' rows='20' cols='20' readonly='readonly'>".stripslashes($nfo)."</textarea>");

}else{

print(T_("ERROR")." reading .nfo file!");

}

}

end_frame();



begin_frame(T_("COMMENTS"));

//echo "<p align=center><a class=index href=torrents-comment.php?id=$id>" .T_("ADDCOMMENT"). "</a></p>n";



$subres = SQL_Query_exec("SELECT COUNT(*) FROM comments WHERE torrent = $id");

$subrow = mysql_fetch_array($subres);

$commcount = $subrow[0];



if ($commcount) {

list($pagertop, $pagerbottom, $limit) = pager(10, $commcount, "torrents-details.php?id=$id&amp;");

$commquery = "SELECT comments.id, text, user, comments.added, avatar, signature, username, title, class, uploaded, downloaded, privacy, donated FROM comments LEFT JOIN users ON comments.user = users.id WHERE torrent = $id ORDER BY comments.id $limit";

$commres = SQL_Query_exec($commquery);

}else{

unset($commres);

}



if ($commcount) {

print($pagertop);

commenttable($commres, 'torrent');

print($pagerbottom);

}else {

print("<br /><b>" .T_("NOCOMMENTS"). "</b><br />n");

}



require_once("backend/bbcode.php");



if ($CURUSER) {

echo "<center>";

echo "<form name="comment" method="post" action="torrents-details.php?id=$row[id]&amp;takecomment=yes">";

echo textbbcode("comment","body")."<br />";

echo "<input type="submit"  value="".T_("ADDCOMMENT")."" />";

echo "</form></center>";

}



end_frame();



stdfoot();

?>



missing passkey ...

greetz
can someone help me^^

horizontal 6 and vertical 6 tables

greetz
hey 4ll

for working seedbonus fix your mybonus.php



<?php

////////////////////////////////////////////////////////

// Bonus Mod by TvRecall.org

// Bonus Mod Updated by devin

// Version 0.3

// Updated 01/05/2006

// Updated to TT V2.08 by ArcticWolf

// under GPL-License

///////////////////////////////////////////////////////

ob_start("ob_gzhandler");

require_once('backend/functions.php');

dbconn(false);

loggedinonly();

$action = $_POST['action'];

stdhead($CURUSER['username'] . "'s Bonus");

if ($action == "exchange") {

   $userid = $CURUSER["id"];

   $option = $_POST["option"];

   $art = $_POST["art"];

   $modcomment = $CURUSER['modcomment'];

   $upload = $CURUSER['uploaded'];

   $res = SQL_Query_exec("SELECT * FROM bonus WHERE id='$option'");

   $row = mysql_fetch_assoc($res);

   if (!$row) {

   show_error_msg("Error", "Invalid request.", 1);

   die;

   }

   $up = $row['menge'];

   $invites = $CURUSER['invites'];

   $inv = $row['menge'];

   $points = $row['points'];

   if ($CURUSER['seedbonus'] >= $points) {

   if ($art == "traffic") {

   $modcomment = gmdate("Y-m-d") . " - User has traded " . $points . " Points for traffic.n " . $modcomment;

   SQL_Query_exec("UPDATE users SET uploaded = uploaded+$up, seedbonus = seedbonus-$points, modcomment = '$modcomment' WHERE id = '$userid'");

   show_error_msg("Success", "Account updated.", 1);

   } elseif ($art == "invite") {

   $modcomment = gmdate("Y-m-d") . " - User has traded " . $points . " Points for invites.n " . $modcomment;

   SQL_Query_exec("UPDATE users SET modcomment = '$modcomment', invites = invites+$inv, seedbonus = seedbonus-$points WHERE id = '$userid'");

   show_error_msg("Success", "Account updated.", 1);

   } else {

   show_error_msg("Error", "No valid type", 1);

   }

   } else {

   show_error_msg("Error", "Not enough points to trade...", 1);

   }

}

$bonus = $CURUSER['seedbonus'];

$userid = $CURUSER['id'];

begin_frame("Seeder Bonus Exchange");

print("<table align=center width=600 border="1" cellspacing="0" cellpadding="5">n");

Print("<tr><td class=tabletitle width=600>Seeder Bonus</td></tr></table>");

print("<table class=tableb align=center width=600 border="1" cellspacing="0" cellpadding="5">n");

?>

<tr><td align=center>Here you can exchange your Seeder-Bonus (currently: <?php echo "$bonus"; ?>).

<br>

(If the button's deactivated, you do not have enough to trade.)

<br>

<?php

print("<table border=1 cellspacing=0 cellpadding=5 width=500><tr>" . "<td class=tabletitle align=left>Option</td>" . "<td class=tabletitle align=left>What's this about?</td>" . "<td class=tabletitle align=left>Points</td>" . "<td class=tabletitle align=left>Trade</td>" . "</tr>");

$res = SQL_Query_exec("SELECT * from bonus order by id");

while ($gets = mysql_fetch_assoc($res)) {

   print("<tr class=tableb><td>" . $gets["id"] . "</td><td align='left'><b>" . $gets["bonusname"] . "</b><br>" . $gets["description"] . "</td><td align='right'>" . $gets["points"] . "</td>");

   print("<form method=post action=mybonus.php>");

   print("<input type="hidden" name="option" value="" . $gets["id"] . "">n");

   print("<input type="hidden" name="art" value="" . $gets["art"] . "">n");

   print("<input type=hidden name='action' value='exchange'>n");



   if ($bonus >= $gets["points"]) {

   print("<td><input type=submit name=submit value="exchange"></td></form>");

   } else {

   print("<td><input type=submit name=submit value="exchange" disabled></td></form>");

   }

}

print("</table><br><br><br>");

?>

<blockquote><p align=left><b>How do I get points?</b><br>

You receive 0.5 points for every hour the system registers you as being a seeder.

</p></blockquote>

</td></tr>

<tr><td><a href=account.php>Back to your profile</a></td></tr>



</table>

<?php

end_frame();

stdfoot();

?>



greetz all :]
hey yes horizontal 6 and vertical 6 :]



thx :]
it is^^



i want an middle block 6 *6 or 7*7

greetz
same thing so0 crazy  :blink:  what can i do?



thx



<?php

 

$cats = implode(',', array(47, 48));



$i = 0;

$q = "SELECT torrents.id, torrents.image1 FROM torrents WHERE visible = 'yes' AND banned = 'no' AND image1 != '' AND category IN ($cats) ORDER BY id DESC LIMIT 36";

$q = mysql_query($q);



begin_block();



print '<table>';

print '<tr>';

while ( $r = mysql_fetch_object($q) )

{

print (($i && $i % 6) ? '<td><a href="torrents-details.php?id='.$r->id.'"><img src="uploads/images/' . $r->image1 . '" height="100" width="100" border="0" /></a></td></tr>' : '<tr><td><a href="torrents-details.php?id='.$r->id.'"><img src="uploads/images/' . $r->image1 . '" height="100" width="100" border="0" /></a></td>');

$i++;

}

print '</tr>';

print '</table>';



end_block();



?>  

y 6 -7 vertikal and 7 horizontal!

or

6 verti and 6 horizontal :]

thx
hey mostvotedplaya

damn not working 7 tables site by site und 8 -11 tables down

n1 test system Red Hat 6.2 (Linux 2.6.32-042stab044.11) so0 n1^^

thx
how get 7 tables 4 an middle block thx

greetz
repost pls^^

forceless download 4 vip^^

greetz
Users online

No users online

Search



Statistics

    Torrents

  • Tracking: 3
  • Todays torrents: 0
  • Seeders: 0
  • Leechers: 0
  • Peers: 0
  • Downloaded: 89.96 GB
  • Uploaded: 9.86 GB

  • Members

  • We have: 838
  • New today: 0
  • Guest today: 9

  • Online

  • Total online: 9
  • Members: 0
  • Guests online: 9
  • Comments: 3
  • Messages: 1,728