} $htmlout .= "</table>\n"; return $htmlout; } //==Sharemarks $userid = isset($_GET['id']) ? (int) $_GET['id'] : ''; if (!is_valid_id($userid)) { stderr("Error", "Invalid ID."); } $res = sql_query("SELECT id, username FROM users WHERE id = " . sqlesc($userid)) or sqlerr(__FILE__, __LINE__); $arr = mysqli_fetch_array($res); $htmlout .= "<h1>Sharemarks for <a href=\"userdetails.php?id=" . $userid . "\">" . htmlsafechars($arr['username']) . "</a></h1>"; $htmlout .= "<b><a href=\"bookmarks.php\">My Bookmarks</a></b>"; $res = sql_query("SELECT COUNT(id) FROM bookmarks WHERE userid = " . sqlesc($userid)) or sqlerr(__FILE__, __LINE__); $row = mysqli_fetch_array($res); $count = $row[0]; $torrentsperpage = $CURUSER["torrentsperpage"]; if (!$torrentsperpage) { $torrentsperpage = 25; } if ($count) { $pager = pager($torrentsperpage, $count, "sharemarks.php?&"); $query1 = "SELECT bookmarks.id as bookmarkid, torrents.username, torrents.owner, torrents.id, torrents.name, torrents.type, torrents.comments, torrents.leechers, torrents.seeders, torrents.save_as, torrents.numfiles, torrents.added, torrents.filename, torrents.size, torrents.views, torrents.visible, torrents.hits, torrents.times_completed, torrents.category FROM bookmarks LEFT JOIN torrents ON bookmarks.torrentid = torrents.id WHERE bookmarks.userid = " . sqlesc($userid) . " AND bookmarks.private = 'no' ORDER BY id DESC {$pager['limit']}"; $res = sql_query($query1) or sqlerr(__FILE__, __LINE__); } if ($count) { $htmlout .= $pager['pagertop']; $htmlout .= sharetable($res, "index", TRUE); $htmlout .= $pager['pagerbottom']; } echo stdhead("Sharemarks for " . htmlsafechars($arr['username'])) . $htmlout . stdfoot();
$res = mysql_query("SELECT id, username FROM users WHERE id = {$userid}") or sqlerr(); $arr = mysql_fetch_array($res); stdhead("Sharemarks for " . $arr['username']); echo '<h1>Sharemarks for <a href=userdetails.php?id=$userid><b>' . $arr['username'] . '<b></a></h2>'; $res = mysql_query("SELECT COUNT(id) FROM bookmarks WHERE userid = {$userid}"); $row = mysql_fetch_array($res); $count = $row[0]; $torrentsperpage = $CURUSER["torrentsperpage"]; if (!$torrentsperpage) { $torrentsperpage = 25; } if ($count) { // $pager = pager($torrentsperpage, $count, "bookmarks.php?");//TB list($pagertop, $pagerbottom, $limit) = pager(25, $count, "bookmarks.php?"); /*//TB $query = "SELECT bookmarks.id as bookmarkid, users.username,users.id as owner, torrents.id, torrents.name, torrents.type, torrents.comments, torrents.leechers, torrents.seeders, ROUND(torrents.ratingsum / torrents.numratings) AS rating, categories.name AS cat_name, categories.image AS cat_pic, torrents.save_as, torrents.numfiles, torrents.added, torrents.filename, torrents.size, torrents.views, torrents.visible, torrents.hits, torrents.times_completed, torrents.category FROM bookmarks LEFT JOIN torrents ON bookmarks.torrentid = torrents.id LEFT JOIN users on torrents.owner = users.id LEFT JOIN categories ON torrents.category = categories.id WHERE bookmarks.userid = $userid AND bookmarks.private = 'no' ORDER BY torrents.id DESC {$pager['limit']}"; $res = mysql_query($query) or sqlerr(); */ $res = mysql_query("SELECT bookmarks.id as bookmarkid, users.username,users.id as owner, torrents.id, torrents.name, torrents.type, torrents.comments, torrents.leechers, torrents.seeders, ROUND(torrents.ratingsum / torrents.numratings) AS rating, categories.name AS cat_name, categories.image AS cat_pic, torrents.save_as, torrents.numfiles, torrents.added, torrents.filename, torrents.size, torrents.views, torrents.visible, torrents.hits, torrents.times_completed, torrents.category FROM bookmarks LEFT JOIN torrents ON bookmarks.torrentid = torrents.id LEFT JOIN users on torrents.owner = users.id LEFT JOIN categories ON torrents.category = categories.id WHERE bookmarks.userid = {$userid} AND bookmarks.private = 'no' ORDER BY torrents.id DESC {$limit}") or sqlerr(); } if ($count) { print $pagertop; sharetable($res, "index", true); print $pagerbottom; /*//TB print($pager['pagertop']); sharetable($res, "index", TRUE); print($pager['pagerbottom']); */ } stdfoot();