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
Torrent and Profile Views mod
Controls ·  Search New posts · Mark unread

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

2021-07-19 07:57:15
Torrent and Profile Views mod
Credit to original author djhowarth. Big Thanks for this great mod

Run SQL

CREATE TABLE IF NOT EXISTS `trackerviews` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`subject` int(10) unsigned NOT NULL DEFAULT '0',
`viewer` int(10) unsigned NOT NULL DEFAULT '0',
`count` int(10) NOT NULL DEFAULT '0',
`type` enum('torrent','profile') DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;


Open torrents-details.php and find:

if ($_GET["hit"]) {
 SQL_Query_exec("UPDATE torrents SET views = views + 1 WHERE id = $id");
 header("Location: torrents-details.php?id=$id");
 die;
 }


Replace with:

if ($_GET["hit"])
{
    $query = (mysqli_fetch_row(SQL_Query_exec("SELECT COUNT(*) FROM `trackerviews` WHERE `viewer` = " . $CURUSER["id"] . " AND `subject` = '$id' AND `type` = 'torrent'")));
    if ($query[0] == 0)
    {
        SQL_Query_exec("INSERT INTO `trackerviews` (`subject`, `viewer`, `count`, `type`)
        VALUES (" . $id . ", " . $CURUSER["id"] . ", '1', 'torrent')");
    }
    else
    {
        SQL_Query_exec("UPDATE `trackerviews` SET `count` = `count` + '1' WHERE `subject` = '$id' AND `viewer` = " . $CURUSER["id"] . " AND `type` = 'torrent'");
    }
   
    header("Location: torrents-details.php?id=$id");
    die;
}


Also find:

print("<tr><td align='left'><b>".T_("HITS").":</b></td><td>" . number_format($row["hits"]) . "</td></tr>\n");


Replace with:

/* Torrent Views... */

 $query = SQL_Query_exec("SELECT DISTINCT(viewer), username, count FROM trackerviews LEFT JOIN users ON trackerviews.viewer = users.id WHERE trackerviews.type = 'torrent' AND trackerviews.subject = '$id' AND users.privacy != 'strong' AND users.status = 'confirmed' AND users.enabled = 'yes' LIMIT 10");
 
 if (mysqli_num_rows($query) > 0)
 {
     print("<tr><td align='left'><b>".T_("VIEWED_BY").":</b></td><td>");
     
          $user = "";
       
     while ($rows = mysqli_fetch_array($query))
     {
          $user .= "<a href='account-details.php?id=" . $rows["viewer"] . "'>" . class_user($rows["username"]) . "</a> (" . number_format($rows["count"]) . "), ";
     }
     
     $users  = substr($user, 0, (strlen($user) - 2));
     
     print( $users . "</td></tr>");
 }
 else
 {
     print("<tr><td align='left'><b>".T_("VIEWED_BY").":</b></td><td><strong>".T_("TORRENT_NOT_VIEWED")."</strong></td></tr>\n");
 }
 
/* End */


Features...

- show users visited the torrent aslong as there privacy is not strong
- seperator , of last comma removed...
- (count) of views / times they visted the torrent...
- This replaces the standard hits/views code

-------------------------------------------------------------

For Profile Views Continue Open account-details.php and find:

if (($user["enabled"] == "no" || ($user["status"] == "pending")) && $CURUSER["edit_users"] == "no")
   show_error_msg(T_("ERROR"), T_("NO_ACCESS_ACCOUNT_DISABLED"), 1);


Underneath Add:

if ($CURUSER["id"] != $id)
{
   $query = (mysqli_fetch_row(SQL_Query_exec("SELECT COUNT(*) FROM `trackerviews` WHERE `viewer` = " . $CURUSER["id"] . " AND `subject` = '$id' AND `type` = 'profile'")));
   if ($query[0] == 0)
   {
        SQL_Query_exec("INSERT INTO `trackerviews` (`subject`, `viewer`, `count`, `type`) VALUES (" . $id . ", " . $CURUSER["id"] . ", '1', 'profile')");
   }
   else
   {
        SQL_Query_exec("UPDATE `trackerviews` SET `count` = `count` + '1' WHERE `subject` = '$id' AND `viewer` = " . $CURUSER["id"] . " AND `type` = 'profile'");
   }
}


Also find:

}else{
echo sprintf(T_("REPORT_MEMBER_MSG"), $user["id"]);
}

end_frame();


Underneath Add:

if ($user["privacy"] != "strong" || ($CURUSER["control_panel"] == "yes"))
{
   begin_frame(T_("PROFILE_VIEWS"));
   
   $query = SQL_Query_exec("SELECT DISTINCT(viewer), username, count FROM trackerviews LEFT JOIN users ON trackerviews.viewer = users.id WHERE trackerviews.type = 'profile' AND trackerviews.subject = '$id' AND users.privacy != 'strong' AND users.status = 'confirmed' AND users.enabled = 'yes' LIMIT 10");
   
   if (mysqli_num_rows($query) > 0)
   {      
              $view = "";  
         
              while ($rows = mysqli_fetch_array($query))
       {
           $view .= "<a href='account-details.php?id=" . $rows["viewer"] . "'>" . class_user($rows["username"]) . "</a> (" . number_format($rows["count"]) . "), ";      
       }
       
        $users  = substr($view, 0, (strlen($view) - 2));
       
        echo($users);
   }
   else
   {
       echo("<center><strong>".T_("NO_PROFILE_VIEWS")."</strong></center>");
   }
                       
   end_frame();
}


In the file english.php add:

$LANG["VIEWED_BY"] = "Viewed by";
$LANG["TORRENT_NOT_VIEWED"] = "This torrent has not had any views yet";
$LANG["PROFILE_VIEWS"] = "Profile views";
$LANG["NO_PROFILE_VIEWS"] = "This member has had no profile views";

Profile:


Torrent:

Last edited by coco on 2021-07-19 11:33:06
2021-07-21 15:25:51
hello coco

thank you very much for this hack, but on my side the nicknames were all stacked one on top of the other and not side by side, here is my personal modification which could be of service to a personal server.

thanks again.

torrents-details :

/* Torrent Views... */
print("<tr><td align='center' colspan='2'><b>" .T_("VIEWED_BY"). "&#8628;</b></td></tr>\n");

$query = SQL_Query_exec("SELECT DISTINCT(viewer), username, count FROM trackerviews LEFT JOIN users ON trackerviews.viewer = users.id WHERE trackerviews.type = 'torrent' AND trackerviews.subject = '$id' AND users.privacy != 'strong' AND users.status = 'confirmed' AND users.enabled = 'yes' LIMIT 10");
if (mysqli_num_rows($query) > 0) {
    print("<tr><td align='left'>");    
    $user = "";  
    while ($rows = mysqli_fetch_array($query)){
    $user .= "<a href='account-details.php?id=" . $rows["viewer"] . "'>" . class_user($rows["username"]) . "</a> (" . number_format($rows["count"]) . "), ";
    }
    $users  = substr($user, 0, (strlen($user) - 2));  
    print($users . "<hr/></td></tr>");
}else{
    print("<tr><td align='center' colspan='2'>".T_("TORRENT_NOT_VIEWED")."</td></tr>\n");
}
/* End */


Last edited by spiritblue on 2021-07-23 21:54:16
2024-05-14 14:10:39
Thanks. Done
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