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
Users: Also Downloaded
Controls ·  Search New posts · Mark unread

You are in: Forum / Forum / Torrent Trader / v3 Mods Completed

2020-06-16 02:49:45
Something I made to help connect downloaders to other downloaders with a link to request file help / feedback. As time goes on, the table will populate with hits and users photos will start to appear on details page.

Open download.php and find

SQL_Query_exec("UPDATE torrents SET hits = hits + 1 WHERE id = $id");


Add after

SQL_Query_exec("INSERT INTO users_downloaded (userid, torrentid, lastdownload) VALUES ($CURUSER[id], $id, NOW())");


Open torrents-details.php and find


print("<center><br />" . format_comment($row['descr']) . "<br /><br />\n");

// end description

?>


Add after


<h1 itemprop="name" class="entry-title" style="font-size:30px;font-weight:400">
     Also downloaded
</h1>
<?
$downloaders = SQL_Query_exec("SELECT users_downloaded.userid, users_downloaded.torrentid, users.avatar, users.id, users.class, users.username FROM users_downloaded LEFT JOIN users ON users.id = users_downloaded.userid WHERE users_downloaded.torrentid = $id LIMIT 12");
if (mysql_num_rows($downloaders) > 0) {
?>
<!-- BEGIN Users Also Downloaded -->
<div class="alsoDownloaded">
  <ul class="grid columns-3" style="list-style: none">
     <?
           while ($dlrow = mysql_fetch_assoc($downloaders)):
     ?>
    <li>
        <a href="/user/?id=<? echo $dlrow["userid"]; ?>">
        <img src="/<? echo $dlrow["avatar"]; ?>" /></a>
    <?
        if ($CURUSER) {
    ?>
       <p><a href="/message/?compose&id=<?
           echo $dlrow["userid"]; ?>">Ask for Help</a></p>
    <?
        }
    ?>
    </li>
     <?
          endwhile;
     ?>
    <li style="padding-bottom:10px; list-style: none">
        <span>+ 11 more</span>
     </li>
  </ul>
</div>
<?
} else {
   echo '<span style="float:right;padding:30px">' . format_comment('No downloaders populated yet.. :( ') . '</span>';
}
?>


Add to your theme's CSS


.alsoDownloaded {
   margin: 0 auto;
   margin-top: 3%;
   margin-bottom: 4%
   }

ul.grid {
   list-style: none;
   font-size: 0px;
   margin-left: -6.5% /* should match li left margin */
   }

ul.grid li {
   float: right;
   display: inline-block;
   _padding: 10px;
   _margin: 0 0 2.5% 2.5%;
   _background: #fff;
   _border: 1px solid #dfdfdf;
   font-size: 16px;
   font-size: 1rem;
   vertical-align: top;
   _box-shadow: 0 0 5px #dfdfdf;
   box-sizing: border-box;
   -moz-box-sizing: border-box;
   -webkit-box-sizing: border-box
   }

ul.grid li img {
   height:55px;
   width:55px;
   border-radius:100%;
   margin-left:10px
   }

ul.grid li h3 {
   margin: 0 0 5px
   }

ul.grid li p {
   font-size: .9em;
   line-height: 1.5em;
   color: #999;
   text-align: center
   }

ul.grid.columns-3 li {
   _width: 30.83%; /* this value + 2.5 should = 33% */
   }


run query

CREATE TABLE `users_downloaded` (
 `userid` int(10) unsigned NOT NULL DEFAULT 0,
 `torrentid` int(10) unsigned NOT NULL DEFAULT 0,
 `lastdownload` datetime NOT NULL,
 UNIQUE KEY `userfriend` (`userid`,`torrentid`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;


What it looks like on my end

[ATTACH type="full" alt="AlsoDownloaded.png"]5589[/ATTACH]
AlsoDownloaded.png
AlsoDownloaded.png
2020-06-20 13:23:52
Thanks you !

thanks for the help...
This part does not work for me ?

$downloaders = SQL_Query_exec("SELECT users_downloaded.userid, users_downloaded.torrentid, users.avatar, users.id, users.class, users.username FROM users_downloaded LEFT JOIN users ON users.id = users_downloaded.userid WHERE users_downloaded.torrentid = $id LIMIT 12");
if (mysqli_num_rows($downloaders) > 0) {
   ?>
<div itemprop="name" class="entry-title" style="font-size:30px;font-weight:400">
     Également téléchargé
</div>    
<!-- BEGIN Users Also Downloaded -->
<div class="alsoDownloaded">
  <ul class="grid columns-3" style="list-style: none">
     <?
           while ($dlrow = mysqli_fetch_assoc($downloaders)):
     ?>
    <li>
        <a href="/user/?id=<? echo $dlrow["userid"]; ?>">
        <img src="/<? echo $dlrow["avatar"]; ?>" /></a>
    <?
        if ($CURUSER) {
    ?>
       <p><a href="/message/?compose&id=<? echo $dlrow["userid"]; ?>">Demander de l'aide</a></p>
    <?
        }
    ?>
    </li>
     <?
          endwhile;
     ?>
    <li style="padding-bottom:10px; list-style: none">
        <span>+ 11 plus</span>
     </li>
  </ul>
</div>
<?    
} else {
   echo '<span style="float:right;padding:30px">' .format_comment("Aucun téléchargeur pour l'instant.. "). '</span>';
}


thanks! ;)
2020-06-20 22:49:59
See it live on my site for full demo. what is not working? Can you post the error feedback?
It will be blank until members start downloading.

Too stoned that night, I forgot to add a vital piece of the mod for download.php, so sorry! I updated original post.

Open download.php and find

SQL_Query_exec("UPDATE torrents SET hits = hits + 1 WHERE id = $id");


Add under

SQL_Query_exec("INSERT INTO users_downloaded (userid, torrentid, lastdownload) VALUES ($CURUSER[id], $id, NOW())");
2020-06-21 12:53:32
thanks for the correction, but it still doesn't work?
2020-06-21 15:04:03
I don’t know what to tell you, I followed original V3 files, line by line. Open tag issue?
2020-06-21 15:14:19
"STorrents2020, post: 68745, member: 20382":

I don’t know what to tell you, I followed original V3 files, line by line. Open tag issue?


me too with v3 mysqli ... lolll


$downloaders = SQL_Query_exec("SELECT users_downloaded.userid, users_downloaded.torrentid, users.avatar, users.id, users.class, users.username FROM users_downloaded LEFT JOIN users ON users.id = users_downloaded.userid WHERE users_downloaded.torrentid = $id LIMIT 12");
if (mysqli_num_rows($downloaders) > 0) {
   ?>
<div itemprop="name" class="entry-title" style="font-size:30px;font-weight:400">
     Également téléchargé
</div>    
<!-- BEGIN Users Also Downloaded -->
<div class="alsoDownloaded">
  <ul class="grid columns-3" style="list-style: none">
     <?
           while ($dlrow = mysqli_fetch_assoc($downloaders)):
     ?>
    <li>
        <a href="/user/?id=<?php echo $dlrow["userid"]; ?>">
        <img src="/<?php echo $dlrow["avatar"]; ?>" /></a>
    <?
        if ($CURUSER) {
    ?>
       <p><a href="/message/?compose&id=<?php echo $dlrow["userid"]; ?>">Demander de l'aide</a></p>
    <?
        }
    ?>
    </li>
     <?
          endwhile;
     ?>
    <li style="padding-bottom:10px; list-style: none">
        <span>+ 11 plus</span>
     </li>
  </ul>
</div>
<?    
} else {
   echo '<span style="float:right;padding:30px">' .format_comment("Aucun téléchargeur pour l'instant.. "). '</span>';
}

2020-06-21 15:46:51
Check sqlerror, post access log, i have nothing to go off of if you ran the SQL. Works fine and it’s very vanilla to V3. I’m sure others have it working, but the majority of those are runners so no feedback for a few hours time. Always nice.
2020-06-21 18:35:40
Looking at the code it might be links like
href="/user/?id and a few others which have been altered, open tags has been mentioned
a look at the errors log would help or display on screen if script runs - remember this is for development only

ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
2020-06-21 18:47:51
"STorrents2020, post: 68747, member: 20382":

Check sqlerror, post access log, i have nothing to go off of if you ran the SQL. Works fine and it’s very vanilla to V3. I’m sure others have it working, but the majority of those are runners so no feedback for a few hours time. Always nice.

no error sql
2020-06-21 19:22:17
"m-jay, post: 68748, member: 20288":

Looking at the code it might be links like
href="/user/?id and a few others which have been altered, open tags has been mentioned
a look at the errors log would help or display on screen if script runs - remember this is for development only

ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);

thanks you !

not error which concerned this mod, but its license of debugged!  (y)
2020-06-27 14:01:47
little question...
I tried adding the default avatar with an [color=rgb(226, 80, 65)]else[/color] and it didn't work, you have an idea, don't I?

CODE BETA:

$downloaders = SQL_Query_exec("SELECT users_downloaded.userid, users_downloaded.torrentid, users.avatar, users.id, users.class, users.username FROM users_downloaded LEFT JOIN users ON users.id = users_downloaded.userid WHERE users_downloaded.torrentid = $id LIMIT 12");
if (mysqli_num_rows($downloaders) > 0) {

print('<tr><td align="center" colspan="2"><div class="alsoDownloaded">
   <ul class="grid" style="list-style: none">');
   while ($dlrow = mysqli_fetch_assoc($downloaders)):
   $avatar = htmlspecialchars($user["avatar"]);
   if (!$avatar){
   print('<li class="grid"><a href="account-details.php?id="'.$dlrow["userid"].'"></a><img src="'.$dlrow["avatar"].'" /><br/><font size="2">&nbsp; '.class_user($dlrow["username"]).' &nbsp;</font>');
   }else{
   print('<img class="hitavatar" src="'.$avatar.'" alt="" />');
#print('<a href="account-details.php?id="'.$dlrow["userid"].'"><img src="'.$site_config["SITEURL"].'"/images/default_avatar.png"/>'.$avatar.'</a>');
   }
   #if ($CURUSER) {
   #print('<p><a href="mailbox.php?compose&amp;id="'.$dlrow["userid"].'"> Mp</a></p>');
   #}
   print('</li>');
   endwhile;  
   print('</ul></div></td></tr>');
   #} else {
       #print('<img src="'.$avatar.'" alt="" />');
   #echo '<span style="float:right;padding:30px">' .format_comment("Aucun téléchargeur pour l'instant.. "). '</span>';
}

[ATTACH type="full" alt="Capture.PNG"]5595[/ATTACH]

...thanks !
Capture.PNG
Capture.PNG

2020-07-03 00:20:53
"spiritblue, post: 68758, member: 401":

little question...
I tried adding the default avatar with an [color=rgb(226, 80, 65)]else[/color] and it didn't work, you have an idea, don't I?

CODE BETA:

$downloaders = SQL_Query_exec("SELECT users_downloaded.userid, users_downloaded.torrentid, users.avatar, users.id, users.class, users.username FROM users_downloaded LEFT JOIN users ON users.id = users_downloaded.userid WHERE users_downloaded.torrentid = $id LIMIT 12");
if (mysqli_num_rows($downloaders) > 0) {

print('<tr><td align="center" colspan="2"><div class="alsoDownloaded">
   <ul class="grid" style="list-style: none">');
   while ($dlrow = mysqli_fetch_assoc($downloaders)):
   $avatar = htmlspecialchars($user["avatar"]);
   if (!$avatar){
   print('<li class="grid"><a href="account-details.php?id="'.$dlrow["userid"].'"></a><img src="'.$dlrow["avatar"].'" /><br/><font size="2">&nbsp; '.class_user($dlrow["username"]).' &nbsp;</font>');
   }else{
   print('<img class="hitavatar" src="'.$avatar.'" alt="" />');
#print('<a href="account-details.php?id="'.$dlrow["userid"].'"><img src="'.$site_config["SITEURL"].'"/images/default_avatar.png"/>'.$avatar.'</a>');
   }
   #if ($CURUSER) {
   #print('<p><a href="mailbox.php?compose&amp;id="'.$dlrow["userid"].'"> Mp</a></p>');
   #}
   print('</li>');
   endwhile;  
   print('</ul></div></td></tr>');
   #} else {
       #print('<img src="'.$avatar.'" alt="" />');
   #echo '<span style="float:right;padding:30px">' .format_comment("Aucun téléchargeur pour l'instant.. "). '</span>';
}

[ATTACH type="full" alt="Capture.PNG"]5595[/ATTACH]

...thanks !


That’s easy, I’ll write it out tonight. I’m surprised I didn’t add it.
2020-07-06 18:39:30
"STorrents2020, post: 68764, member: 20382":

That’s easy, I’ll write it out tonight. I’m surprised I didn’t add it.

?..lolll
2020-07-07 03:55:27
replace

$avatar = htmlspecialchars($user["avatar"]);


with

$avatar = htmlspecialchars($dlrow["avatar"]);


$user has no place here. This is otherwise available by calling users.owner column by $_GET ID.

Whenever you want to check row, it must always resolve to the variable/statement for mysql (ASSOC, ARRAY, OBJECT, etc) query result(s). In this case, it is [color=rgb(226, 80, 65)]$dlrow[/color] and it is in a loop, so we point to $dlrow and assign to the conditional row check.
2020-07-28 18:03:48
small error, when a member has been warned, he has the warning image as avatar
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: 8
  • Members: 0
  • Guests online: 8
  • Comments: 3
  • Messages: 1,728