} //==Bookmarks $userid = isset($_GET['id']) ? (int) $_GET['id'] : $CURUSER['id']; if (!is_valid_id($userid)) { stderr("Error", "Invalid ID."); } if ($userid != $CURUSER["id"]) { stderr("Error", "Access denied. Try <a href=\"sharemarks.php?id=" . $userid . "\">Here</a>"); } $res = sql_query("SELECT id, username FROM users WHERE id = " . sqlesc($userid)) or sqlerr(__FILE__, __LINE__); $arr = mysqli_fetch_array($res); $htmlout .= "<h1>My Bookmarks</h1>"; $htmlout .= "<b><a href='sharemarks.php?id=" . $CURUSER['id'] . "'>My Sharemarks</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, "bookmarks.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) . " ORDER BY torrents.id DESC {$pager['limit']}" or sqlerr(__FILE__, __LINE__); $res = sql_query($query1) or sqlerr(__FILE__, __LINE__); } if ($count) { $htmlout .= $pager['pagertop']; $htmlout .= bookmarktable($res, "index", TRUE); $htmlout .= $pager['pagerbottom']; } echo stdhead('Bookmarks') . $htmlout . stdfoot();
$res = mysql_query("SELECT id, username FROM users WHERE id = {$userid}") or sqlerr(); $arr = mysql_fetch_array($res); stdhead("My Bookmarks"); echo '<h1>My Bookmarks</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} ORDER BY torrents.id DESC {$limit}") or sqlerr(); } if ($count) { print $pagertop; bookmarktable($res, "index", true); print $pagerbottom; /*//TB print($pager['pagertop']); sharetable($res, "index", TRUE); print($pager['pagerbottom']); */ } stdfoot();