Login
Username: Password:
Remember me

[Sign Up] / [Recover Password]

Theme / Language

Popular
New Torrents
new name
Size: 18.40 MB
Most active
new name
S: 74 L: 3
New Posters
Bookmark Torrent
Controls ·  Search New posts · Mark unread

You are in: Forum / Forum / v2.08 / v2 Only Mods Complete

Unknown User
2011-03-06 14:38:33
find and delete:

case 'bookmark':

if ($variant == "bookmarks")

echo "<td class=ttable_col2 align=center><a href='takedelbookmark.php?bookmarkid=$id' title='Delete'><img src='images/delchat.gif' border='0' width='10px' alt='delete' title='delete' /></a></td>";

break;
replace with this:


case 'bookmark':

$bookt = mysql_query("SELECT torrentid FROM bookmarks WHERE torrentid = $row[id] AND userid = $CURUSER[id]");

if (mysql_num_rows($bookt) > 0)



print("<td class=ttable_col$x align=center><a href='takedelbookmark.php?bookmarkid=$id' title='Delete'><img src='images/delchat.gif' border='0' width='16px' alt='delete' title='delete' /></a></td>");

 else

print("<td class=ttable_col$x align=center><a href='bookmarks.php?torrent=$id' title='Bookmark'><img src='images/MyBookmarks3.png' border='0' width='16px' alt='Bookmark' title='Bookmark' /></a></td>");

break;



works perfect for me ;)

delete.png
delete.png
Unknown User
2011-03-06 15:43:19
niceone will apply that now and see if all ok many thanks again for help

---- UPADTE all is working spot on i can honestly say this mod is working perfect on v2.06 ----- woot nice mod this

thank you war02 for your help ;)
Unknown User
2011-03-06 16:08:12
i also added the image on the bar above torrents browse using the check.gif that was posted earlier to finish it off

			case 'bookmark':

if ($variant == "bookmarks")

echo "<td class=ttable_head>Delete</td>";

else

echo "<td class=ttable_head>";

echo "<img src='images/check.gif' height='20px'>";

echo "</td>";

break;
Unknown User
2011-03-06 16:08:42
Hi war02,

Thanx for this customization.  Works on v2.06.

Cheers.
Unknown User
2011-03-12 20:40:16
"war02, post: 71101":
find and delete:

case 'bookmark':

if ($variant == "bookmarks")

echo "<td class=ttable_col2 align=center><a href='takedelbookmark.php?bookmarkid=$id' title='Delete'><img src='images/delchat.gif' border='0' width='10px' alt='delete' title='delete' /></a></td>";

break;
replace with this:


case 'bookmark':

$bookt = mysql_query("SELECT torrentid FROM bookmarks WHERE torrentid = $row[id] AND userid = $CURUSER[id]");

if (mysql_num_rows($bookt) > 0)



print("<td class=ttable_col$x align=center><a href='takedelbookmark.php?bookmarkid=$id' title='Delete'><img src='images/delchat.gif' border='0' width='16px' alt='delete' title='delete' /></a></td>");

 else

print("<td class=ttable_col$x align=center><a href='bookmarks.php?torrent=$id' title='Bookmark'><img src='images/MyBookmarks3.png' border='0' width='16px' alt='Bookmark' title='Bookmark' /></a></td>");

break;



works perfect for me  :lol:




thanks worked great
Unknown User
2011-04-22 12:25:28
I also added the following code to bookmarks.php to check the torrent exists:

if ((get_row_count("torrents", "WHERE id = $_GET[torrent]")) == 0)

stderr("Error", "<br>No Such Torrent!<br><br><b><a href='java script:history.back()'>Back!</a></b><br><br>");
Unknown User
2011-04-22 12:52:05
$torrentid = (int) $_GET['torrent'];



if (get_row_count("torrents", "WHERE `id` = $torrentid") == 0)

show_error_msg("Error", "No Such torrent go back.", 1);


This will work better, one because you should never trust user input, secondly stderr is no longer a TT function.
Unknown User
2011-04-22 20:13:41
Sorry, posted my code, forgot this thread is for V2, I still use V1 - think it was even by sqrtboy back then!
Unknown User
2011-05-02 21:54:14
Quote:
find and delete:CODE

case 'bookmark':

if ($variant == "bookmarks")

echo "<td class=ttable_col2 align=center><a href='takedelbookmark.php?bookmarkid=$id' title='Delete'><img src='images/delchat.gif' border='0' width='10px' alt='delete' title='delete' /></a></td>";

break;

replace with this:

CODE

case 'bookmark':

$bookt = mysql_query("SELECT torrentid FROM bookmarks WHERE torrentid = $row[id] AND userid = $CURUSER[id]");

if (mysql_num_rows($bookt) > 0)

print("<td class=ttable_col$x align=center><a href='takedelbookmark.php?bookmarkid=$id' title='Delete'><img src='images/delchat.gif' border='0' width='16px' alt='delete' title='delete' /></a></td>");

else

print("<td class=ttable_col$x align=center><a href='bookmarks.php?torrent=$id' title='Bookmark'><img src='images/MyBookmarks3.png' border='0' width='16px' alt='Bookmark' title='Bookmark' /></a></td>");

break;


applied this code and getting a error above the torrent table

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/backend/functions.php on line 1131
Unknown User
2011-05-02 23:04:28
ok finally got it working  :lol:

edited in the wrong place :/
Unknown User
2013-03-01 22:47:57
i try this for 2.08 thank you azuris i come back if it work or not ;)
Unknown User
2013-03-03 05:17:26
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>]&nbsp;";






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&nbsp;");

   else

print("<div align='right'><a href='bookmarks.php?torrent=$row[id]'><b>[suivre]</b></a></td></tr>n&nbsp;");

  //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 "&nbsp;<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
Unknown User
2013-03-03 14:45:22
you can also delete



or sqlerr()




or die(mysql_error())




if you use

SQL_Query_exec
Unknown User
2014-05-22 19:46:43
if the user is a guest, the error -

Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in C:xampphtdocsbackendfunctions.php on line .....
Unknown User
2014-05-22 20:45:03
something like this might work..

functions.php

case 'bookmark':
           if($CURUSER) {
           $bookt = SQL_Query_exec("SELECT torrentid FROM bookmarks WHERE torrentid = $row[id] AND userid = $CURUSER[id]");
           if (mysql_num_rows($bookt) > 0)                        
             print("<td class=ttable_col$x align=center><a href='takedelbookmark.php?bookmarkid=$id' title='Delete'><img src='images/delchat.gif' border='0' width='16px' alt='delete' title='delete' /></a></td>");
             else
             print("<td class=ttable_col$x align=center><a href='bookmarks.php?torrent=$id' title='Bookmark'><img src='images/MyBookmarks3.png' border='0' width='16px' alt='Bookmark' title='Bookmark' /></a></td>");
           }
             break;

Its untested and for 2.08 i dont care about any version lower!

you prob also change to change this 1 one in torrents-details

// 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&nbsp;");
    else
print("<div align='right'><a href='bookmarks.php?torrent=$row[id]'><b>[Suivre]</b></a></td></tr>n&nbsp;");
//end bookmarks
to



 // Bookmarks mod
if ($CURUSER) {
$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&nbsp;");
       else
       print("<div align='right'><a href='bookmarks.php?torrent=$row[id]'><b>[Suivre]</b></a></td></tr>n&nbsp;");
}
  //end bookmarks
Users online

No users online

Search



Statistics

    Torrents

  • Tracking: 3
  • Todays torrents: 0
  • Seeders: 0
  • Leechers: 0
  • Peers: 0
  • Downloaded: 89.96 GB
  • Uploaded: 9.86 GB

  • Members

  • We have: 838
  • New today: 0
  • Guest today: 9

  • Online

  • Total online: 1
  • Members: 0
  • Guests online: 1
  • Comments: 3
  • Messages: 1,728