ob_start("ob_gzhandler"); require_once("include/bittorrent.php"); dbconn(false); loggedinorreturn(); stdhead($CURUSER["username"] . "'s torrents"); if(isset($_GET["sort"])) { $order = mysql_escape_string($_GET['sort']); if( !is_valid_sort($order) ) $order = 'id'; $scending = ($_GET['d'] == 'ASC') ? 'ASC' : 'DESC'; $orderby = "ORDER BY $order $scending"; } else $orderby = "ORDER BY torrents.inverted_timestamp"; $addparam = ""; $where = "WHERE owner = " . $CURUSER["id"] . " AND banned != 'yes'"; $res = do_mysql_query("SELECT COUNT(*) as num_torrents FROM torrents $where"); $row = mysql_fetch_assoc($res); $count = $row['num_torrents']; if (!$count) { ?>
You haven't uploaded any torrents yet, so there's nothing in this page.
} else { list($pagertop, $pagerbottom, $limit) = pager(20, $count, "mytorrents.php?" . $addparam); if(!$GLOBALS['settings']['cache'] || !($records = unserialize( $cache_lite->get('mytorrents', $CURUSER['id']) ) ) ) { $query = "SELECT UNIX_TIMESTAMP(torrents.added) as utadded, FLOOR( ( UNIX_TIMESTAMP() - UNIX_TIMESTAMP(torrents.added) ) / 3600 ) as time_alive, torrents.id, torrents.category, torrents.leechers, torrents.seeders, torrents.name, torrents.visible, torrents.times_completed, torrents.size, torrents.added, torrents.comments, torrents.numfiles, torrents.filename, torrents.owner, IF(torrents.nfo <> '', 1, 0) as nfoav, IF(torrents.numratings < $minvotes, NULL, ROUND(torrents.ratingsum / torrents.numratings, 1)) AS rating, categories.name AS cat_name, categories.image AS cat_pic, users.username, categories.name AS cat_name, categories.image AS cat_pic, categories.stylesheet AS cat_stylesheet, users.username FROM torrents LEFT JOIN categories ON category = categories.id LEFT JOIN users ON torrents.owner = users.id $where $orderby $limit"; $res = do_mysql_query($query) or die(mysql_error()); while ($record = mysql_fetch_assoc($res) ) { $records[] = $record; } $cache_lite->save( serialize($records), 'mytorrents', $CURUSER['id']); } print($pagertop); torrenttable($records, "mytorrents.php?" . $addparam); print($pagerbottom); } stdfoot(); ?>