Work good in 2.08 :)
here is new file
SQL
CREATE TABLE `bookmarks` (
`id` int(10) unsigned NOT NULL auto_increment,
`userid` int(10) unsigned NOT NULL default '0',
`torrentid` int(10) unsigned NOT NULL default '0',
PRIMARY KEY (`id`)
) TYPE=MyISAM AUTO_INCREMENT=13;
Add link to
bookmark.php where you want to show the page.
torrents-details.php
you can use the original code or here is mine i juste change mysql_query to SQL_Query_exec
find
echo "[<a href='report.php?torrent=$id'><b>" .T_("REPORT_TORRENT"). "</b></a>] ";
ADD before
// Bookmarks mod
$bookt = SQL_Query_exec("SELECT torrentid FROM bookmarks WHERE torrentid = $row[id] AND userid = $CURUSER[id]");
if (mysql_num_rows($bookt) > 0)
print("<div align='right'><div align='right'><a href='takedelbookmark.php?bookmarkid=". $row[id] ."'><b>[Ne plus suivre]</b></a></td></tr>n ");
else
print("<div align='right'><a href='bookmarks.php?torrent=$row[id]'><b>[suivre]</b></a></td></tr>n ");
//end bookmarks
function.php
find
SQL_Query_exec("DELETE FROM torrents WHERE id = $id");
add after
SQL_Query_exec("DELETE FROM bookmarks WHERE torrentid = $id");
find
SQL_Query_exec("DELETE FROM ratings WHERE user = $userid");
add after
SQL_Query_exec("DELETE FROM bookmarks WHERE userid = $userid");
bookmark.php
<?
require_once("backend/functions.php");
dbconn(false);
if (!isset($_GET[user]))
$user = $CURUSER[id];
else
$user = $_GET[user];
$res = SQL_Query_exec("SELECT username FROM users WHERE id = $user") or sqlerr();
$arr = mysql_fetch_array($res);
stdhead("Suivis pour " . $arr[username]);
//print ("<h1>Bookmarks for <a href=userdetails.php?id=$user><b>$arr[username]<b></a></h2>");
$res = SQL_Query_exec("SELECT COUNT(id) FROM bookmarks WHERE userid = $user");
$row = mysql_fetch_array($res);
$count = $row[0];
list($pagertop, $pagerbottom, $limit) = pager(25, $count, "bookmarks.php?");
$res = SQL_Query_exec("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 = $user ORDER BY torrents.id DESC $limit") or sqlerr();
begin_frame("Mes suivis");
print($pagertop);
torrenttable($res, "bookmarks", TRUE);
print($pagerbottom);
end_frame();
stdfoot();
?>
bookmarks.php
<?
require_once("backend/functions.php");
dbconn();
$gottorrent = (int)$_GET["torrent"];
if (!isset($gottorrent))
show_error_msg("Error"," ... No torrent selected",1);
if ((get_row_count("bookmarks", "WHERE userid=$CURUSER[id] AND torrentid = $gottorrent")) > 0)
show_error_msg("Error","Already bookmarked torrent",1);
if ((get_row_count("torrents", "WHERE id = $gottorrent")) > 0) {
SQL_Query_exec("INSERT INTO bookmarks (userid, torrentid) VALUES ($CURUSER[id], $gottorrent)") or die(mysql_error());
stdhead("Bookmarks");
begin_frame ("Successfully");
echo "<div align=center><font color=red><font size=3>Torrent ajouté avec succes!!!</font></font>";
echo " <a href=torrents-details.php?id=$gottorrent>Retour sur la fiche du torrent!</a></div>";
end_frame();
stdfoot();
}
else show_error_msg("Error","ID not found",1);
?>
takedelbookmark.php
<?
require_once("backend/functions.php");
dbconn(true);
loggedinonly();
$delid = (int)$_GET['bookmarkid'];
$res2 = SQL_Query_exec("SELECT id, userid FROM bookmarks WHERE torrentid = $delid AND userid = $CURUSER[id]") or die();
$arr = mysql_fetch_assoc($res2);
if (!$arr)
show_error_msg("Error!","ID not found in your bookmarks list...",1);
SQL_Query_exec("DELETE FROM bookmarks WHERE torrentid = $delid AND userid = $CURUSER[id]") or die();
header("Refresh: 0;url=".$_SERVER['HTTP_REFERER']);
?>
Thank you azuris workk good :D