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
Fix duplicate torrents being uploaded
Controls ·  Search New posts · Mark unread

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

Unknown User
2019-05-24 14:00:56
Current code in torrents-upload.php is adding duplicate torrents and wasting the space of web server in advance.

This is a simple fix which will create a new file duplicate.torrent and store / erase there every duplicated torrent without making multiple of them.

1. Open torrents-upload.php and find the following part:
if (mysqli_errno($GLOBALS["DBconnector"]) == 1062)
show_error_msg(T_("UPLOAD_FAILED"), T_("UPLOAD_ALREADY_UPLOADED"), 1);

Replace with:
if (mysqli_errno($GLOBALS["DBconnector"]) == 1062) {
   rename("$torrent_dir/$fname", "$torrent_dir/duplicate.torrent");  
   show_error_msg(T_("UPLOAD_FAILED"), T_("UPLOAD_ALREADY_UPLOADED"), 1);
   }
2019-05-27 16:27:17
so does this work correctly? I assume there will always be a file called duplicate.torrent and it just gets overwritten each time? If so, nice job :) Thanks for sharing
TTv3 Micro Edition
Ubuntu 20.04.6 LTS Server
Mysql Version: 10.3.39-MariaDB-0ubuntu0.20.04.2
PHP Version: 7.4.3-4ubuntu2.20
Apache Version: Apache/2.4.59 (Ubuntu)
Unknown User
2019-05-27 17:56:34
"MicroMonkey, post: 66638, member: 311":

so does this work correctly? I assume there will always be a file called duplicate.torrent and it just gets overwritten each time? If so, nice job :) Thanks for sharing

Indeed that's how it works.
2019-05-28 08:43:54
Thanks you[USER=20311] shadows[/USER]
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: 6
  • Members: 0
  • Guests online: 6
  • Comments: 3
  • Messages: 1,728