Bravo List

Bravo List (http://www.bvlist.com/index.php)
-   Torrent Trader (http://www.bvlist.com/forumdisplay.php?f=29)
-   -   Bookmark on browse TT v2.7? (http://www.bvlist.com/showthread.php?t=9002)

Extremlym 19th March 2013 17:34

Bookmark on browse TT v2.7?
 
hello,

i need a Bookmark mod for TTv2.7

daffy 19th March 2013 23:35

2 Attachment(s)
add sql

Code:

CREATE TABLE IF NOT EXISTS `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`)
)

also

Code:

ALTER TABLE torrents ADD addbookmark char(3) NOT NULL DEFAULT no
torrent-details.php

add where want to show

Code:

  // Bookmarks mod
                         
echo "
Bookmark this torrent";
echo "
";

$bookt = mysql_query("SELECT torrentid FROM bookmarks WHERE torrentid =" .$row[id]);
$bookt1 = mysql_fetch_array($bookt);
if ($bookt1[0] == $row[id])
{
   
    print ("
You already have this torrent in Your Bookmark Click. [HERE] to remove it");
}
    else {

    print ("
Click HERE to save to bookmarks which can be viewed HERE.\n");}
     
     
echo "

";
// End Bookmarks mod

add attached to root

add link to bookmark.php in account.php

Extremlym 27th March 2013 11:30

ERROR

http://extremlymtorrents.com/bookmark.php

Fatal error: Call to undefined function SQL_Query_exec() in /home/extremly/public_html/bookmark.php on line 17

daffy 27th March 2013 15:08

Work it out, its not rocket science.:coffee:

Extremlym 7th April 2013 20:16

SOLVED!
 
SQL
PHP Code:

CREATE TABLE `bookmarks` (
`
idint(10unsigned NOT NULL auto_increment,
`
useridint(10unsigned NOT NULL default '0',
`
torrentidint(10unsigned NOT NULL default '0',
PRIMARY KEY (`id`)
TYPE=MyISAM AUTO_INCREMENT=13

account.php find
PHP Code:

<?print("<a href=mailbox.php><b>My Messages</b></a>");?>

add after
PHP Code:

&nbsp;|&nbsp;
<?print("<a href=bookmark.php><b>My Bookmarks</b></a>");?>

torrents-details.php find
PHP Code:

print("<b>" HITS ": </b>" $row["hits"] . "\n"); 

add after
PHP Code:

// Bookmarks mod
$bookt mysql_query("SELECT torrentid FROM bookmarks WHERE torrentid = $row[id] AND userid = $CURUSER[id]");
if (
mysql_num_rows($bookt) > 0)
        print(
"<tr><td align=left><b>Bookmark:</b></td><td><font color=red>You already have this torrent <a href='bookmark.php'>bookmarked.</a></font></td></tr><td>&nbsp;</td><td><a href='takedelbookmark.php?bookmarkid="$row[id] ."'><img src='images/delchat.gif' border='0' width='10px' alt='delete' title='delete' /></a></td></tr>\n");
        else 
print(
"<tr><td align=left><b>Bookmark:</b></td><td><a href='bookmarks.php?torrent=$row[id]'>Add this torrent</a> to <a href='bookmark.php'>My Bookmarks</a></td></tr>\n");
   
//end bookmarks 

function.php find
PHP Code:

mysql_query("DELETE FROM torrents WHERE id = $id"); 

add after
PHP Code:

mysql_query("DELETE FROM bookmarks WHERE torrentid = $id"); 

find
PHP Code:

mysql_query("DELETE FROM ratings WHERE user = $userid"); 

add after
PHP Code:

 mysql_query("DELETE FROM bookmarks WHERE userid = $userid"); 

find
PHP Code:

 case 'rating':
                                echo 
"<td class=ttable_head>".RATINGS."</td>";
                        break; 

add after
PHP Code:

 case 'bookmark':
                if (
$variant == "bookmarks"
echo 
"<td class=ttable_head>Delete</td>";
                        break; 

find
PHP Code:

 case 'rating':
                                if (!
$row["rating"])
                                        
$rating "--";
                                else
                                        
$rating "<a title='$row[rating]/5'>".ratingpic($row["rating"])."</a>";
                                        
//$rating = ratingpic($row["rating"]);
                                         //$srating .= "$rpic (" . $row["rating"] . " out of 5) " . $row["numratings"] . " users have rated this torrent";
                                
print("<td class=ttable_col$x align=center>$rating</td>");
                        break; 
add after
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; 

config.php
find
PHP Code:

 $site_config["torrenttable_columns"] = "category,name,dl,uploader,comments,size,seeders,leechers,health,external"

change for
PHP Code:

 $site_config["torrenttable_columns"] = "category,name,dl,uploader,comments,size,seeders,leechers,health,external,boo
kmark"


bookmark.php ==>upload it
PHP Code:

 <?
require_once("backend/functions.php");
dbconn(false);

if (!isset(
$_GET[user]))
          
$user $CURUSER[id];
else
          
$user $_GET[user];

$res mysql_query("SELECT username FROM users WHERE id = $user") or sqlerr();
$arr mysql_fetch_array($res);

stdhead("Bookmarks for " $arr[username]);

//print ("<h1>Bookmarks for <a href=userdetails.php?id=$user><b>$arr[username]<b></a></h2>");

$res mysql_query("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 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 = $user ORDER BY torrents.id DESC $limit")  or sqlerr();

begin_frame("My Bookmarks");

print(
$pagertop);
torrenttable($res"bookmarks"TRUE);
print(
$pagerbottom);

end_frame();
stdfoot();

?>

bookmarks.php ==> upload it
PHP Code:

<?
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) {
mysql_query("INSERT INTO bookmarks (userid, torrentid) VALUES ($CURUSER[id]$gottorrent)") or die(mysql_error());

stdhead("Bookmarks");
begin_frame ("Successfully");
echo 
"Torrent bookmarked";
echo 
"<a href=torrents-details.php?id=$gottorrent>Back To Torrent</a>";
end_frame();
stdfoot();
}
else  
show_error_msg("Error","ID not found",1);

?>

takedelbookmark.php ==>upload it
PHP Code:

 <?
require_once("backend/functions.php");
dbconn(true);
loggedinonly();

$delid = (int)$_GET['bookmarkid'];

$res2 mysql_query ("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);

mysql_query ("DELETE FROM bookmarks WHERE torrentid = $delid AND userid = $CURUSER[id]") or die();
header("Refresh: 0;url=".$_SERVER['HTTP_REFERER']);
?>


firefly007 9th September 2013 18:42

I will post my bookmark mod as soon as its done.. It also allows you to use your key to download later.

I_lie_and_steal_code_and_call_it_mine 25th June 2015 18:34

PHP Code:

<?

to

PHP Code:

<?php

At top of all php files


would be a good start too


would be

PHP Code:

<?php
require_once("backend/functions.php");
dbconn(true);
loggedinonly();

$delid = (int)$_GET['bookmarkid'];

$res2 mysql_query ("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);

mysql_query ("DELETE FROM bookmarks WHERE torrentid = $delid AND userid = $CURUSER[id]") or die();
header("Refresh: 0;url=".$_SERVER['HTTP_REFERER']);
?>


daffy 26th June 2015 00:01

your over 2 years late to reply bro lol


All times are GMT +2. The time now is 06:04.

Powered by vBulletin® Version 3.8.11 Beta 3
Copyright ©2000 - 2024, vBulletin Solutions Inc.