View Single Post
  #3  
Old 27th June 2008, 14:01
roland1000 roland1000 is offline
Member
 
Join Date: Mar 2008
Posts: 3
Default Re: Why the [img][/img] tag doesn't work?
It still don't work. There is a problem with details.php. Please check it out.


[code]<?

ob_start("ob_gzhandler");

require_once("include/bittorrent.php");


function getagent($httpagent, $peer_id="")
{
if (preg_match("/^Azureus ([0-9]+\.[0-9]+\.[0-9]+\.[0-9]\_B([0-9][0-9|*])(.+)$)/", $httpagent, $matches))
return "Azureus/$matches[1]";
elseif (preg_match("/^Azureus ([0-9]+\.[0-9]+\.[0-9]+\.[0-9]\_CVS)/", $httpagent, $matches))
return "Azureus/$matches[1]";
elseif (preg_match("/^Java\/([0-9]+\.[0-9]+\.[0-9]+)/", $httpagent, $matches))
return "Azureus/<2.0.7.0";
elseif (preg_match("/^Azureus ([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)/", $httpagent, $matches))
return "Azureus/$matches[1]";
elseif (preg_match("/BitTorrent\/S-([0-9]+\.[0-9]+(\.[0-9]+)*)/", $httpagent, $matches))
return "Shadow's/$matches[1]";
elseif (preg_match("/BitTorrent\/U-([0-9]+\.[0-9]+\.[0-9]+)/", $httpagent, $matches))
return "UPnP/$matches[1]";
elseif (preg_match("/^BitTor(rent|nado)\\/T-(.+)$/", $httpagent, $matches))
return "BitTornado/$matches[2]";
elseif (preg_match("/^BitTornado\\/T-(.+)$/", $httpagent, $matches))
return "BitTornado/$matches[1]";
elseif (preg_match("/^BitTorrent\/ABC-([0-9]+\.[0-9]+(\.[0-9]+)*)/", $httpagent, $matches))
return "ABC/$matches[1]";
elseif (preg_match("/^ABC ([0-9]+\.[0-9]+(\.[0-9]+)*)\/ABC-([0-9]+\.[0-9]+(\.[0-9]+)*)/", $httpagent, $matches))
return "ABC/$matches[1]";
elseif (preg_match("/^Python-urllib\/.+?, BitTorrent\/([0-9]+\.[0-9]+(\.[0-9]+)*)/", $httpagent, $matches))
return "BitTorrent/$matches[1]";
elseif (preg_match("/^BitTorrent\/brst(.+)/", $httpagent, $matches))
return "Burst";
elseif (preg_match("/^RAZA (.+)$/", $httpagent, $matches))
return "Shareaza/$matches[1]";
elseif (preg_match("/Rufus\/([0-9]+\.[0-9]+\.[0-9]+)/", $httpagent, $matches))
return "Rufus/$matches[1]";
elseif (preg_match("/^Python-urllib\\/([0-9]+\\.[0-9]+(\\.[0-9]+)*)/", $httpagent, $matches))
return "G3 Torrent";
elseif (preg_match("/MLDonkey\/([0-9]+).([0-9]+).([0-9]+)*/", $httpagent, $matches))
return "MLDonkey/$matches[1].$matches[2].$matches[3]";
elseif (preg_match("/ed2k_plugin v([0-9]+\\.[0-9]+).*/", $httpagent, $matches))
return "eDonkey/$matches[1]";
elseif (preg_match("/uTorrent\/([0-9]+)([0-9]+)([0-9]+)([0-9A-Z]+)/", $httpagent, $matches))
return "uTorrent/$matches[1].$matches[2].$matches[3].$matches[4]";
elseif (preg_match("/CT([0-9]+)([0-9]+)([0-9]+)([0-9]+)/", $peer_id, $matches))
return "cTorrent/$matches[1].$matches[2].$matches[3].$matches[4]";
elseif (preg_match("/Transmission\/([0-9]+).([0-9]+)/", $httpagent, $matches))
return "Transmission/$matches[1].$matches[2]";
elseif (preg_match("/KT([0-9]+)([0-9]+)([0-9]+)([0-9]+)/", $peer_id, $matches))
return "KTorrent/$matches[1].$matches[2].$matches[3].$matches[4]";
elseif (preg_match("/rtorrent\/([0-9]+\\.[0-9]+(\\.[0-9]+)*)/", $httpagent, $matches))
return "rTorrent/$matches[1]";
elseif (preg_match("/^ABC\/Tribler_ABC-([0-9]+\.[0-9]+(\.[0-9]+)*)/", $httpagent, $matches))
return "Tribler/$matches[1]";
elseif (preg_match("/^BitsOnWheels( |\/)([0-9]+\\.[0-9]+).*/", $httpagent, $matches))
return "BitsOnWheels/$matches[2]";
elseif (preg_match("/BitTorrentPlus\/(.+)$/", $httpagent, $matches))
return "BitTorrent Plus!/$matches[1]";
elseif (ereg("^Deadman Walking", $httpagent))
return "Deadman Walking";
elseif (preg_match("/^eXeem( |\/)([0-9]+\\.[0-9]+).*/", $httpagent, $matches))
return "eXeem$matches[1]$matches[2]";
elseif (preg_match("/^libtorrent\/(.+)$/", $httpagent, $matches))
return "libtorrent/$matches[1]";
elseif (substr($peer_id, 0, 12) == "d0c")
return "Mainline";
elseif (substr($peer_id, 0, 1) == "M")
return "Mainline/Decoded";
elseif (substr($peer_id, 0, 3) == "-BB")
return "BitBuddy";
elseif (substr($peer_id, 0, 8) == "-AR1001-")
return "Arctic Torrent/1.2.3";
elseif (substr($peer_id, 0, 6) == "exbc\08")
return "BitComet/0.56";
elseif (substr($peer_id, 0, 6) == "exbc\09")
return "BitComet/0.57";
elseif (substr($peer_id, 0, 6) == "exbc\0:")
return "BitComet/0.58";
elseif (substr($peer_id, 0,4) == "-BC0")
return "BitComet/0.".substr($peer_id,5,2);
elseif (substr($peer_id, 0, 7) == "exbc\0L")
return "BitLord/1.0";
elseif (substr($peer_id, 0, 7) == "exbcL")
return "BitLord/1.1";
elseif (substr($peer_id, 0, 3) == "346")
return "TorrenTopia";
elseif (substr($peer_id, 0, 8) == "-MP130n-")
return "MooPolice";
elseif (substr($peer_id, 0, 8) == "-SZ2210-")
return "Shareaza/2.2.1.0";
elseif (ereg("^0P3R4H", $httpagent))
return "Opera BT Client";
elseif (substr($peer_id, 0, 6) == "A310--")
return "ABC/3.1";
elseif (ereg("^XBT Client", $httpagent))
return "XBT Client";
elseif (ereg("^BitTorrent\/BitSpirit$", $httpagent))
return "BitSpirit";
elseif (ereg("^DansClient", $httpagent))
return "XanTorrent";

else
return "Unknow";
}

function dltable($name, $arr, $torrent)
{

global $CURUSER;
$s = "" . count($arr) . " $name\n";
if (!count($arr))
return $s;
$s .= "\n";
$s .= "<table width=100% class=main border=1 cellspacing=0 cellpadding=5>\n";
$s .= "<tr><td class=colhead>User/IP</td>" .
"<td class=colhead align=center>Connectable</td>".
"<td class=colhead align=right>Uploaded</td>".
"<td class=colhead align=right>Rate</td>".
"<td class=colhead align=right>Downloaded</td>" .
"<td class=colhead align=right>Rate</td>" .
"<td class=colhead align=right>Ratio</td>" .
"<td class=colhead align=right>Complete</td>" .
"<td class=colhead align=right>Connected</td>" .
"<td class=colhead align=right>Idle</td>" .
"<td class=colhead align=left>Client</td></tr>\n";
$now = time();
$moderator = (isset($CURUSER) && get_user_class() >= UC_MODERATOR);
$mod = get_user_class() >= UC_MODERATOR;
foreach ($arr as $e) {


// user/ip/port
// check if anyone has this ip
($unr = mysql_query("SELECT id, username, privacy, warned, donor FROM users WHERE id=$e[userid] ORDER BY last_access DESC LIMIT 1")) or die;
$una = mysql_fetch_array($unr);
if ($una["privacy"] == "strong") continue;
++$num;

$highlight = $CURUSER["id"] == $una["id"] ? " bgcolor=#BBAF9B" : "";
$s .= "<tr$highlight>\n";
//$s .= "<tr>\n";
if ($una["username"]) {

if (get_user_class() >= UC_MODERATOR || $torrent['anonymous'] != 'yes' || $e['userid'] != $torrent['owner']) {
// $s .= "<td><a href=userdetails.php?id=$e[userid]>$una[username]</a></td>\n";
$s .= "<td><a href=userdetails.php?id=$e[userid]>$una[username]</a>" . ($una["donor"] == "yes" ? "<img src=".
"pic/star.gif alt='Donor'>" : "") . ($una["enabled"] == "no" ? "<img src=".
"pic/disabled.gif alt=\"This account is disabled\" style='margin-left: 2px'>" : ($una["warned"] == "yes" ? "<img src=pic/warned.gif alt=\"Warned\" border=0>" : ""));
}
elseif (get_user_class() >= UC_MODERATOR || $torrent['anonymous'] = 'yes') {
$s .= "<td>Anonymous</a></td>\n";
}
}
else
$s .= "<td>(unknown)</td>\n";
$secs = max(1, ($now - $e["st"]) - ($now - $e["la"]));
$revived = $e["revived"] == "yes";
$s .= "<td align=center>" . ($e[connectable] == "yes" ? "Yes" : "<font color=red>No</font>") . "</td>\n";
$s .= "<td align=right>" . mksize($e["uploaded"]) . "</td>\n";
$s .= "<td align=right><nobr>" . mksize(($e["uploaded"] - $e["uploadoffset"]) / $secs) . "/s</nobr></td>\n";
$s .= "<td align=right>" . mksize($e["downloaded"]) . "</td>\n";
if ($e["seeder"] == "no")
$s .= "<td align=right><nobr>" . mksize(($e["downloaded"] - $e["downloadoffset"]) / $secs) . "/s</nobr></td>\n";
else
$s .= "<td align=right><nobr>" . mksize(($e["downloaded"] - $e["downloadoffset"]) / max(1, $e["finishedat"] - $e[st])) . "/s</nobr></td>\n";
if ($e["downloaded"])
{
$ratio = floor(($e["uploaded"] / $e["downloaded"]) * 1000) / 1000;
$s .= "<td align=\"right\"><font color=" . get_ratio_color($ratio) . ">" . number_format($ratio, 3) . "</font></td>\n";
}
else
if ($e["uploaded"])
$s .= "<td align=right>Inf.</td>\n";
else
$s .= "<td align=right>---</td>\n";
$s .= "<td align=right>" . sprintf("%.2f%%", 100 * (1 - ($e["to_go"] / $torrent["size"]))) . "</td>\n";
$s .= "<td align=right>" . mkprettytime($now - $e["st"]) . "</td>\n";
$s .= "<td align=right>" . mkprettytime($now - $e["la"]) . "</td>\n";
$s .= "<td align=left>" . htmlspecialchars(getagent($e["agent"], $e["peer_id"])) . "</td>\n";
$s .= "</tr>\n";
}
$s .= "</table>\n";
return $s;
}

dbconn(false);

loggedinorreturn();

$id = 0 + $_GET["id"];

if (!isset($id) || !$id)
die();

$res = mysql_query("SELECT torrents.seeders, torrents.banned, torrents.leechers, torrents.info_hash, torrents.filename, LENGTH(torrents.nfo) AS nfosz, UNIX_TIMESTAMP() - UNIX_TIMESTAMP(torrents.last_action) AS lastseed, torrents.numratings, torrents.name, torrents.description, IF(torrents.numratings < $minvotes, NULL, ROUND(torrents.ratingsum / torrents.numratings, 1)) AS rating, 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.numfiles, torrents.anonymous, categories.name AS cat_name, users.username FROM torrents LEFT JOIN categories ON torrents.category = categories.id LEFT JOIN users ON torrents.owner = users.id WHERE torrents.id = $id")
or sqlerr();
$row = mysql_fetch_array($res);

$owned = $moderator = 0;
if (get_user_class() >= UC_MODERATOR)
$owned = $moderator = 1;
elseif ($CURUSER["id"] == $row["owner"])
$owned = 1;
//}

if (!$row || ($row["banned"] == "yes" && !$moderator))
stderr("Error", "No torrent with ID $id.");
else {
if ($_GET["hit"]) {
mysql_query("UPDATE torrents SET views = views + 1 WHERE id = $id");
if ($_GET["tocomm"])
header("Location: $BASEURL/details.php?id=$id&page=0#startcomments");
elseif ($_GET["filelist"])
header("Location: $BASEURL/details.php?id=$id&filelist=1#filelist");
elseif ($_GET["toseeders"])
header("Location: $BASEURL/details.php?id=$id&dllist=1#seeders");
elseif ($_GET["todlers"])
header("Location: $BASEURL/details.php?id=$id&dllist=1#leechers");
else
header("Location: $BASEURL/details.php?id=$id");
exit();
}

if (!isset($_GET["page"])) {
stdhead("Details for torrent \"" . $row["name"] . "\"");

if ($CURUSER["id"] == $row["owner"] || get_user_class() >= UC_MODERATOR)
$owned = 1;
else
$owned = 0;

$spacer = "";

if ($_GET["uploaded"]) {
print("<h2>Successfully uploaded!</h2>\n");
print("

Torrent is changed to tracker standarts</p>\n");
print("

Please redownload torrent and start seeding. Note that the torrent won't be visible until you do that!</p>\n");
}
elseif ($_GET["edited"]) {
print("<h2>Successfully edited!</h2>\n");
if (isset($_GET["returnto"]))
print("

Go back to <a href=\"" . htmlspecialchars($_GET["returnto"]) . "\">whence you came</a>.</p>\n");
}
elseif (isset($_GET["searched"])) {
print("<h2>Your search for \"" . htmlspecialchars($_GET["searched"]) . "\" gave a single result:</h2>\n");
}
elseif ($_GET["rated"])
print("<h2>Rating added!</h2>\n");

$s=$row["name"];
$descrs = $row["description"];
print("<h1>$s</h1>\n");
print("<table width=750 border=\"1\" cellspacing=\"0\" cellpadding=\"5\">\n");

$url = "edit.php?id=" . $row["id"];
if (isset($_GET["returnto"])) {
$addthis = "&amp;returnto=" . urlencode($_GET["returnto"]);
$url .= $addthis;
$keepget .= $addthis;
}
$editlink = "a href=\"$url\" class=\"sublink\"";

// $s = "" . htmlspecialchars($row["name"]) . "";
// if ($owned)
// $s .= " $spacer<$editlink>[Edit torrent]</a>";
// tr("Name", $s, 1);

print("<tr><td class=rowhead width=1%>Download</td><td width=99% align=left><a class=\"index\" href=\"download.php/$id/" . rawurlencode($row["filename"]) . "\">" . htmlspecialchars($row["filename"]) . "</a></td></tr>");
if (!empty($row["description"]))
print("<tr><td class=rowhead width=1%>Small Description</td><td width=99% align=left>$descrs</td></tr>");
// tr("Downloadsas", $row["save_as"]);

function hex_esc($matches) {
return sprintf("%02x", ord($matches[0]));
}
tr("Info hash", preg_replace_callback('/./s', "hex_esc", hash_pad($row["info_hash"])));

if (!empty($row["descr"]))
tr("Description", str_replace(array("\n", " ", "?", " ", "U^", " ", "^(2)", " ",
"U", " ", "?", " ", "Y", " ", "
Reply With Quote