<?php
/*
*----------------------------phpMyBitTorrent V 2.0-beta4-----------------------*
*--- The Ultimate BitTorrent Tracker and BMS (Bittorrent Management System) ---*
*--------------   Created By Antonio Anzivino (aka DJ Echelon)   --------------*
*-------------               http://www.p2pmania.it               -------------*
*------------ Based on the Bit Torrent Protocol made by Bram Cohen ------------*
*-------------              http://www.bittorrent.com             -------------*
*------------------------------------------------------------------------------*
*------------------------------------------------------------------------------*
*--   This program is free software; you can redistribute it and/or modify   --*
*--   it under the terms of the GNU General Public License as published by   --*
*--   the Free Software Foundation; either version 2 of the License, or      --*
*--   (at your option) any later version.                                    --*
*--                                                                          --*
*--   This program is distributed in the hope that it will be useful,        --*
*--   but WITHOUT ANY WARRANTY; without even the implied warranty of         --*
*--   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          --*
*--   GNU General Public License for more details.                           --*
*--                                                                          --*
*--   You should have received a copy of the GNU General Public License      --*
*--   along with this program; if not, write to the Free Software            --*
*-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA --*
*--                                                                          --*
*------------------------------------------------------------------------------*
*------              ©2005 phpMyBitTorrent Development Team              ------*
*-----------               http://phpmybittorrent.com               -----------*
*------------------------------------------------------------------------------*
*-----------------   Sunday, September 14, 2008 9:05 PM   ---------------------*
*/


global $db_prefix;
$sql = ("SELECT id, name, downloaded, completed, seeders, leechers, added FROM ".$db_prefix."_torrents WHERE leechers > 0 AND seeders = 0 ORDER BY leechers DESC LIMIT 10");
$res = $db->sql_query($sql) or btsqlerror($sql);
if ($db->sql_numrows($res) > 0)
	{
OpenTable(_btneedseed);
	print("<center><table  style=\"width: 100%;\" class=table_table border=2 cellspacing=0 cellpadding=0 >\n");
	print ("<CENTER><B>"._btifyhhelpthem."</B></CENTER>\n");
	print("<tr><td class=colhead>"._bttorrent."</td><td class=colhead>"._btleechers."</td><td class=colhead>"._btdownloaded."</td><td class=colhead>"._btsnatch."</td><td class=colhead>"._btadded."</td></tr>\n");
		while ($arr = $db->sql_fetchrow($res))
			{
			$torrname = htmlspecialchars($arr['name']);
			$torrname = str_replace(array('-','_'),array(' ',' '),$torrname);
				if (strlen($torrname) > 55)
				$torrname = substr($torrname, 0, 55) . "...";


			print("<tr><td class=table_col1  align=left><a href=\"details.php?id=".$arr['id']."&hit=1\" alt=\"".$arr['name']."\" 	title=\"".$arr['name']."\">".((strlen($arr['name']) <= 30) ? $arr['name']: substr($arr['name'],0,27)."...")."</td><td  class=table_col1><font color=red> ".number_format($arr['leechers'])." </td><td  class=table_col1>  ".$arr['downloaded']."  </td><td  class=table_col1>  ".$arr['completed']."  </td><td  class=table_col1>  ".$arr['added']."  </td></tr>\n");
			}
		print("</table></center>\n");


CloseTable();
}
else
{
OpenTable(_btneedseed);
echo"<p><center><h3>"._btntnseeded."</h3></center></p>";
CloseTable();
}
?>