View Single Post
  #9  
Old 15th December 2008, 02:59
joeroberts's Avatar
joeroberts joeroberts is offline
BT.Manager Owner
 
Join Date: Jan 2008
United States
Posts: 2,113
Default
open ajax.php find
Code:
		case 'view_peers_page':{
		if(!$user->user)error("your not allowed to view peers with out being loged in");
		if ($_GET["tracker"] == "" AND $_GET["type"] != "link" AND $user->user) {
        OpenTable(_btsource);
        echo "<iframe src=\"frame.php?op=peerlist&amp;id=".$_GET['torrent']."&amp;password=".$_GET["pass"]."\" width=\"100%\" height=\"250\" align=\"middle\" scrolling=auto marginwidth=\"0\" marginheight=\"0\"></iframe>\n";
        CloseTable();
}
		ob_end_flush();
$db->sql_close();
die();
and replace with
Code:
		case 'view_peers_page':{
		if(!$user->user)error("your not allowed to view peers with out being loged in");
		if ($_GET["tracker"] == "" AND $_GET["type"] != "link" AND $user->user) {
        OpenTable(_btsource);
                if (!isset($_GET['torrent']) OR !is_numeric($_GET['torrent']) OR $_GET['torrent'] < 1) error(_bterridnotset);
                $password = urldecode($password);
                $sql = "SELECT password FROM ".$db_prefix."_torrents WHERE id = '".$_GET['torrent']."' AND (password IS NULL OR password = '".$_GET["pass"]."') LIMIT 1;";
                $res = $db->sql_query($sql);
                if ($db->sql_numrows($res) < 1) die(); //Password is wrong or not set
                $db->sql_freeresult($res);
                $i = 0;
                $tropen = false;
                $sql = "SELECT P.id AS pid, P.peer_id AS peer_id, P.downloaded AS downloaded, P.uploaded AS uploaded, P.download_speed AS download_speed, P.upload_speed AS upload_speed, P.ip AS ip, P.real_ip AS real_ip, P.to_go AS to_go, P.seeder AS seeder, UNIX_TIMESTAMP(P.started) AS started_ts, UNIX_TIMESTAMP(P.last_action) AS last_action_ts, P.connectable AS connectable, P.client AS client, P.version AS clientversion, U.id AS uid, U.username AS username, U.name AS name, U.avatar AS avatar, U.level AS level, T.size AS torrent_size FROM ".$db_prefix."_peers P LEFT JOIN ".$db_prefix."_users U ON U.id = P.uid LEFT JOIN ".$db_prefix."_torrents T ON T.id = P.torrent WHERE P.torrent = '".$_GET['torrent']."' ORDER BY P.seeder ASC;";
                $res = $db->sql_query($sql) or print_r($db->sql_error());
                if ($db->sql_numrows($res) < 1) break;

                echo "<table border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"0\" class=\"peertable\">\n";
                while ($row = $db->sql_fetchrow($res)) {
                        if (!$tropen) {
                                echo "<tr style=\"height:150px\">\n";
                                $tropen = true;
                        }
                        #This box contains all data of the single user
                        echo "<td width=\"20%\">\n";
                        echo "<table border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"0\">\n";


                        echo "<tr>\n<td style=\"vertical-align:bottom\">";
                        #This table contains peer attributes
                        echo "<div align=\"center\">";
                        echo "<table border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"0\" style=\"width:90px;\">";
                        echo "<tr>";

                        #Column not yet assigned
                        echo "<td width=\"20%\">";
                        echo "<p align=\"center\">";
                        $s = _btuploadedbts.": ".mksize($row["uploaded"])."<br />";
                        $s .= _btdownloadedbts.": ".mksize($row["downloaded"])."<br />";
                        $s .= _btpercent.": ".sprintf("%.2f%%", (1 - ($row["to_go"] / $row["torrent_size"])) * 100)."<br />";
                        ##RATIO START
                        $s .= _btratio.": ";
                        if ($row["downloaded"])
                                $s .= number_format($row["uploaded"]/$row["downloaded"],2);
                        else
                                if ($e["uploaded"])
                                        $s .= number_format($row["uploaded"]/$row["torrent_size"],2);
                                else
                                        $s .= "---";
                        $s .= "<br />";
                        $s .= _btuploadspeed. ": ". mksize($row["upload_speed"])."/s<br />";
                        if ($row["seeder"] == "no") {
                                if ($row["download_speed"]) {
                                        $edt_m = ($row["to_go"] / $row["download_speed"])/60; //to minutes
                                        $edt = ($edt_m % 60)."m"; //minutes
                                        $edt_h = floor($edt_m / 60);
                                        if ($edt_h>0) $edt = $edt_h."h ".$edt;
                                } else {
                                        $edt = "&infin;";
                                }
                                $s .= _btdownloadspeed.": ". mksize($row["download_speed"])."/s<br />";
                                $s .= _btedt." ".$edt;
                        }
                        ##RATIO END
                        echo help(pic("help.gif","",null),$s,_bttransfer);
                        echo "</p>\n";
                        echo "</td>\n";

                        #Seeder or Leecher
                        echo "<td width=\"20%\">";
                        echo "<p align=\"center\">";
                        if ($row["seeder"] == "yes") echo pic("upload.gif","",_btseeder);
                        else echo pic("download.gif","",_btleecher);
                        echo "</p>\n";
                        echo "</td>\n";

                        #Client Information
                        echo "<td width=\"20%\">";
                        echo "<p align=\"center\">";
                        $client = $row["client"]." ".$row["clientversion"];
                        if ($row["client"] != "" AND is_readable("client_icons/".$row["client"].".gif")) echo "<img src=\"client_icons/".htmlspecialchars($row["client"]).".gif\" alt=\"".$client."\" title=\"".$client."\" />";
                        else echo "<img src=\"client_icons/Unknown.gif\" alt=\"".$client."\" title=\"".$client."\" />";
                        echo "</p>\n";
                        echo "</td>\n";

                        #Active or passive
                        echo "<td width=\"20%\">";
                        echo "<p align=\"center\">";
                        if ($row["connectable"] == "yes") echo pic("icon_active.gif","",constant("_btalt_icon_active.gif"));
                        else echo pic("icon_passive.gif","",constant("_btalt_icon_passive.gif"));
                        echo "</p>";
                        echo "</td>\n";

                        #Time information
                        echo "<td width=\"20%\">";
                        echo "<p align=\"center\">";
                        $s = _btconnected.": ".mkprettytime(time()-$row["started_ts"]);
                        $s .= "<br />";
                        $s .= _btidle.": ".mkprettytime(time()-$row["last_action_ts"]);
                        help(pic("clock.gif"),$s,_dtimeconnected);
                        echo "</p>";
                        echo"</td>\n";

                        echo "</tr>\n";
                        echo "</table>\n";
                        echo "</div>";
                        #End of peer attributes

                        echo "</td>\n";
                        echo "</tr>\n";

                        #User name and avatar with profile link
                        echo "<tr>\n";
                        echo "<td style=\"height:120px\"><p align=\"center\">";
                        if (!$user->admin) $ip = preg_replace('/\.\d+$/', ".xxx", long2ip($row["ip"]));
                        else $ip = long2ip($row["ip"]);
                        if ($row["uid"] != 0) {
                                $usertxt = "<a href=\"user.php?op=profile&id=".$row["uid"]."\" target=\"_top\">";
                                if ($row["avatar"] == "blank.gif" OR !is_readable("avatars/".$row["avatar"])) { //No avatar
                                        $usertxt .= pic("noavatar.png");
                                } else {
                                        $usertxt .= "<img src=\"avatars/".$row["avatar"]."\" alt=\"".str_replace("**user**",($row["name"] == "") ? $row["username"]:$row["name"],_btalt_avatar)."\" border=\"0\">";
                                }
                                $usertxt .= "<br />";
                                if ($row["name"] != "") $usertxt .= $row["name"];
                                else $usertxt .= $row["username"];

                                if ($row["level"] == "admin") $usertxt .= pic("icon_admin.gif");
                                elseif ($row["level"] == "premium") $usertxt .= pic("icon_premium.gif");

                                $usertxt .= "</a>";
                        } else {
                                $usertxt = pic("noavatar.png");
                                $usertxt.= "<br />".$ip;
                        }
                        echo $usertxt;
                        echo "</p></td>";
                        echo "</tr>\n";
                        #End of user name, avatar & link


                        echo "</table>\n";
                        echo "</td>\n";
                        #End of user box

                        $i++;
                        if ($i == 4) {
                                $i = 0;
                                echo "</tr>\n";
                                $tropen = false;
                        }
                }
                if ($tropen) {
                        for (; $i<4 ;$i++) echo "<td width=\"20%\"></td>\n";
                        echo "</tr>\n";
                }
                echo "</table>\n";

                $db->sql_freeresult($res);
        CloseTable();
}
		ob_end_flush();
$db->sql_close();
die();
__________________
Do not ask me to help you work on your site that is not phpMyBitTorrent
Do not ask me to make a mod for any other source
Do not Ask me to setup your site.
I will no longer help you setup your site, there is a setup script if you have trouble with it post in the forum here or in BT.Manager™ forum
My Current Demo is here http://demo.btmanager.org/
Reply With Quote