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
Bug Tracker
Controls ·  Search New posts · Mark unread

You are in: Forum / Forum / M-BiTsy / M-BiTsy Support

2021-12-22 17:57:15
Thank you I will update sql

Leave as ALLOWEXTERNAL' => 1

What is tracker url on top of upload form ?
and is torrent external ?
is file in data/uploads/torrents folder ?

Not sure if dedibox is messing with htaccess is data folder and TorrentTraderMVC folder in same place


Last edited by M-jay warn on 2021-12-22 17:57:49
2021-12-22 18:30:48
What is tracker url on top of upload form ? -> tracker url https://XXX/TorrentTraderMVC/announce.php

htacces ->  RewriteBase /TorrentTraderMVC/

(ALLOWEXTERNAL' => 1) -> .torrent is in data/uploads/torrents  -> Tracker: [Could not parse bencoded data]

Ubuntu Linux 20.04.3 | MySQL 8 | Apache 2.4.41 | PHP 8.1.1

2021-12-22 19:27:47
lets try internal first ALLOWEXTERNAL' => 0

replace app/controller/upload.php with
<?php

class Upload
{
   public function __construct()
   {
       $this->session = Auth::user(0, 2);
   }

   public static function checks()
   {
       // Checks
       if ($_SESSION["can_upload"] == "no") {
           Redirect::autolink(URLROOT, Lang::T("UPLOAD_NO_PERMISSION"));
       }
       if (Config::TT()['UPLOADERSONLY'] && $_SESSION["class"] < _VIP) {
           Redirect::autolink(URLROOT, Lang::T("UPLOAD_ONLY_FOR_UPLOADERS"));
       }
   }

   public function index()
   {
       self::checks();
       // Announcelist
       $announce_urls = explode(",", ANNOUNCELIST);
       $data = [
           'title' => Lang::T("UPLOAD"),
           'announce_urls' => $announce_urls,
       ];
       View::render('upload/index', $data, 'user');
   }

   public function submit()
   {
       self::checks();
       if ($_POST["takeupload"] == "yes") {
           // Check form data.
           if (!isset($_POST['type'], $_POST['name'], $_FILES['torrent'])) {
               $message = Lang::T('MISSING_FORM_DATA');
           }
           $tupload = new Tupload('torrent');
           if (($num = $tupload->getError())) {
               Redirect::autolink(URLROOT . '/upload', Lang::T("UPLOAD_ERR[$num]"));
           }
           if (!($fname = $tupload->getName())) {
               $message = Lang::T("EMPTY_FILENAME");
           }
           // NFO
           $nfo = 'no';
           if ($_FILES['nfo']['size'] != 0) {
               $nfofile = $_FILES['nfo'];
               if ($nfofile['name'] == '') {
                   $message = Lang::T("NO_NFO_UPLOADED");
               }
               if (!preg_match('/^(.+)\.nfo$/si', $nfofile['name'], $fmatches)) {
                   $message = Lang::T("UPLOAD_NOT_NFO");
               }
               if ($nfofile['size'] == 0) {
                   $message = Lang::T("NO_NFO_SIZE");
               }
               if ($nfofile['size'] > 65535) {
                   $message = Lang::T("NFO_UPLOAD_SIZE");
               }
               $nfofilename = $nfofile['tmp_name'];
               if (($num = $_FILES['nfo']['error'])) {
                   $message = Lang::T("UPLOAD_ERR[$num]");
               }
               $nfo = 'yes';
           }
           // Check Post Inputs
           $descr = Input::get("descr");
           if (!$descr) {
               $descr = Lang::T("UPLOAD_NO_DESC");
           }
           $vip = Input::get("vip");
           if (!$vip) {
               $vip = 0;
           }
           $free = Input::get("free");
           if (!$free) {
               $free = 0;
           }
           $langid = (int) Input::get("lang");
           $catid = (int) Input::get("type");

           if (!Validate::Id($catid)) {
               $message = Lang::T("UPLOAD_NO_CAT");
           }
           if (!empty(Input::get('tube'))) {
               $tube = Input::get('tube');
           }
           if (!Validate::Filename($fname)) {
               $message = Lang::T("UPLOAD_INVALID_FILENAME");
           }
           if (!preg_match('/^(.+)\.torrent$/si', $fname, $matches)) {
               $message = Lang::T("UPLOAD_INVALID_FILENAME_NOT_TORRENT");
           }

           $shortfname = $torrent = $matches[1];

           if (!empty(Input::get("name"))) {
               $name = Input::get("name");
           }
           if (!empty(Input::get('tmdb'))) {
               $tmdb = Input::get('tmdb');
           }
           // If Message Show
           if ($message) {
               Redirect::autolink(URLROOT . '/upload', $message);
           }
           if (!$message) {
               //parse torrent file
               $torrent_dir = UPLOADDIR."/torrents";
               $nfo_dir = UPLOADDIR."/nfos";
               if (!($tupload->move("$torrent_dir/$fname"))) {
                   Redirect::autolink(URLROOT . '/upload', Lang::T("ERROR") . ": " . Lang::T("UPLOAD_COULD_NOT_BE_COPIED") . " $torrent_dir - $fname");
               }
               $torInfo = new Parse();
               $tor = $torInfo->torr("$torrent_dir/$fname");
               $announce = $tor[0];
               $infohash = $tor[1];
               $creationdate = $tor[2];
               $internalname = $tor[3];
               $torrentsize = $tor[4];
               $filecount = $tor[5];
               $annlist = $tor[6];
               $comment = $tor[7];
               $filelist = $tor[8];

               //if externals is turned off
               //$external = $announce !== ANNOUNCELIST ? "yes" : "no";
               $announce_urls = explode(",", ANNOUNCELIST);
               if (!in_array($announce, $announce_urls, 1)){
                   $external='yes';
               }else{
                   $external='no';
               }
               if (!Config::TT()['ALLOWEXTERNAL'] && $external == 'yes') {
                   $message = Lang::T("UPLOAD_NO_TRACKER_ANNOUNCE");
               }

           }
           if ($message) {
               @$tupload->remove();
               @unlink("$torrent_dir/$fname");
               Redirect::autolink(URLROOT . '/upload', $message);
           }

           //release name check and adjust
           if ($name == "") {
               $name = $internalname;
           }
           $name = str_replace(".torrent", "", $name);
           $name = str_replace("_", " ", $name);

           //upload images
           $allowed_types = ALLOWEDIMAGETYPES;
           $inames = array();
           for ($x = 0; $x < 2; $x++) {
               if (!($_FILES['image' . $x]['name'] == "")) {
                   $y = $x + 1;
                   if ($_FILES['image$x']['size'] > IMAGEMAXFILESIZE) {
                       Redirect::autolink(URLROOT . '/upload', Lang::T("INVAILD_FILE_SIZE_IMAGE"));
                   }
                   $uploaddir = UPLOADDIR . '/images/';
                   $ifile = $_FILES['image' . $x]['tmp_name'];
                   $im = getimagesize($ifile);
                   if (!$im[2]) {
                       Redirect::autolink(URLROOT . '/upload', sprintf(Lang::T("INVALID_IMAGE")));
                   }
                   if (!array_key_exists($im['mime'], $allowed_types)) {
                       Redirect::autolink(URLROOT . '/upload', Lang::T("INVALID_FILETYPE_IMAGE"));
                   }
                   $row = DB::run("SHOW TABLE STATUS LIKE 'torrents'")->fetch();
                   $next_id = $row['Auto_increment'];
                   $ifilename = $next_id . $x . $allowed_types[$im['mime']];
                   $copy = copy($ifile, $uploaddir . $ifilename);
                   if (!$copy) {
                       Redirect::autolink(URLROOT . '/upload', sprintf(Lang::T("IMAGE_UPLOAD_FAILED")));
                   }
                   $inames[] = $ifilename;
               }

           }

           //anonymous upload
           $anonyupload = Input::get("anonycheck");
           if ($anonyupload == "yes") {
               $anon = "yes";
           } else {
               $anon = "no";
           }

           $filecounts = (int) $filecount;
           // Insert Torrent
           try {
               DB::run("INSERT INTO torrents (filename, owner, name, vip, descr, image1, image2, category, tube, added, info_hash, size, numfiles, save_as, announce, external, nfo, torrentlang, anon, last_action, freeleech, tmdb)
                        VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)",
                       [$fname, $_SESSION['id'], $name, $vip, $descr, $inames[0], $inames[1], $catid, $tube, TimeDate::get_date_time(), $infohash, $torrentsize, $filecounts, $fname, $announce, $external, $nfo, $langid, $anon, TimeDate::get_date_time(), $free, $tmdb]);
           } catch (PDOException $e) {
               rename("$torrent_dir/$fname", "$torrent_dir/duplicate.torrent"); // todo
               Redirect::to(URLROOT . '/exceptions');
           }

           $id = DB::lastInsertId();

           if ($id == 0) {
               unlink("$torrent_dir/$fname");
               Redirect::autolink(URLROOT . '/upload', Lang::T("UPLOAD_NO_ID"));
           }
           rename("$torrent_dir/$fname", "$torrent_dir/$id.torrent");

           if (is_array($filelist)) {
               foreach ($filelist as $file) {
                   $dir = '';
                   $size = $file["length"];
                   $count = count($file["path"]);
                   for ($i = 0; $i < $count; $i++) {
                       if (($i + 1) == $count) {
                           $fname = $dir . $file["path"][$i];
                       } else {
                           $dir .= $file["path"][$i] . "/";
                       }

                   }
                   Files::insertFiles($id, $fname, $size);
               }
           } else {
               Files::insertFiles($id, $internalname, $torrentsize);
           }

           if ($nfo == 'yes') {
               move_uploaded_file($nfofilename, "$nfo_dir/$id.nfo");
           }
           // Log Upload
           Logs::write(sprintf(Lang::T("TORRENT_UPLOADED"), htmlspecialchars($name), $_SESSION["username"]));
           // Shout new torrent
           $msg_shout = "New Torrent: [url=" . URLROOT . "/torrent?id=" . $id . "]" . $torrent . "[/url] has been uploaded " . ($anon == 'no' ? "by [url=" . URLROOT . "/profile?id=" . $_SESSION['id'] . "]" . $_SESSION['username'] . "[/url]" : "") . "";
           Shoutboxs::insertShout(0, TimeDate::get_date_time(), 'System', $msg_shout);
           //Uploaded ok message
           if ($external == 'no') {
               $message = sprintf(Lang::T("TORRENT_UPLOAD_LOCAL"), $name, $id, $id);
           } else {
               $message = sprintf(Lang::T("TORRENT_UPLOAD_EXTERNAL"), $name, $id);
               // scrape external
               Tscraper::ScrapeId($id);
           }

           Redirect::autolink(URLROOT . "/torrent?id=$id", $message);
       } else {
           Redirect::autolink(URLROOT, Lang::T("ERROR"));
       }
   }

}


create torrent with https://XXX/TorrentTraderMVC/announce.php and upload
Last edited by M-jay warn on 2021-12-22 19:28:05
2021-12-23 09:10:49
is in /app/controllers/user ;)

upload work for :

ALLOWEXTERNAL' => 0
torrent created with announce
upload work
seed not work ->   Tracker: [Failure reason "wrong option input"]


for the best upload add announce auto

exemple :
//ADD ANNOUNCE AUTO
if (empty($announce_urls)){
  $announce_urls = ''.ANNOUNCELIST.'';
}


Ubuntu Linux 20.04.3 | MySQL 8 | Apache 2.4.41 | PHP 8.1.1

Last edited by kiki2020 on 2021-12-23 10:10:25
2021-12-23 10:35:14
Try in app/libraries/announce.php

foreach (['numwant', 'corrupt', 'no_peer_id', 'compact'] as $key) {
           if (!is_numeric($client[$key]) || $client[$key] < 0) {
               die(self::response("wrong option input"));
           }
       }


Just uncomment for now see if it works

/*
foreach (['numwant', 'corrupt', 'no_peer_id', 'compact'] as $key) {
           if (!is_numeric($client[$key]) || $client[$key] < 0) {
               die(self::response("wrong option input"));
           }
       }
*/
2021-12-23 16:53:30
The following error for the code just downloaded (commit 252945e), 23rd Dec

Error

Static analysis:

3 errors were found during analysis.

   A symbol name was expected! (near "," at position 172)
   Unexpected beginning of statement. (near "10" at position 191)
   Unrecognized statement type. (near "NOT NULL" at position 195)

SQL query: Copy

-- -------------------------------------------------------- -- -- Table structure for table `tmdb` -- CREATE TABLE `tmdb` ( `id` int(10) NOT NULL AUTO_INCREMENT,, `id_tmdb` int(10) NOT NULL DEFAULT 0, `title` varchar(200) DEFAULT NULL, `genre` varchar(200) DEFAULT NULL, `plot` text DEFAULT NULL, `actor` longtext DEFAULT NULL, `date` datetime DEFAULT NULL, `image` varchar(50) DEFAULT NULL, `url` varchar(150) DEFAULT NULL, `trailer` varchar(100) DEFAULT NULL, `duration` varchar(100) DEFAULT NULL, `producer` varchar(200) DEFAULT NULL, `season` int(10) DEFAULT NULL, `episodes` int(10) DEFAULT NULL, `status` varchar(100) DEFAULT NULL, `creator` varchar(200) DEFAULT NULL, `type` varchar(35) DEFAULT NULL, UNIQUE KEY `id` (`id`) ) ENGINE=MyISAM

MySQL said: Documentation
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '
 `id_tmdb` int(10) NOT NULL DEFAULT 0,
 `title` varchar(200) DEFAULT NUL...' at line 8


Checked, and looks to be a double comma after the AUTO INCREMENT
If It Ain't Dutch, It Ain't Much!!
Last edited by Propaganda on 2021-12-23 16:57:27
2021-12-23 17:47:02
cheers updated sql - i also added some new css to bottom of default/custom.css for new pagelink function (look under here) you may need to add to your theme if colour is wrong. Got 2 week off now so hoping to move all remaining sql into models - the theme wont be changed  :thumb
2021-12-23 17:59:19
M-jay:
cheers updated sql - i also added some new css to bottom of default/custom.css for new pagelink function (look under here) you may need to add to your theme if colour is wrong. Got 2 week off now so hoping to move all remaining sql into models - the theme wont be changed  :thumb  


My time will be limited to long weekends. No work stop next week.
Will do my best to check check check.

I have updated the code on my test site to latest.
Working on my footer file, gonna try some experimenting there using examples I have seen on: https://www.youtube.com/kepowob

Nice >> https://youtu.be/rg7Fvvl3taU  Learn CSS Grid the easy way

If It Ain't Dutch, It Ain't Much!!
Last edited by Propaganda on 2021-12-23 18:13:41
2021-12-23 18:06:15
For columns like the latest forum posts, or the latest torrents post - you can see that the column headers are not aligning to the content.
This should always be the case - in all screen sizes.
If It Ain't Dutch, It Ain't Much!!
Last edited by Propaganda on 2021-12-23 18:06:29
2021-12-24 07:24:32
uncomment

/*
foreach (['numwant', 'corrupt', 'no_peer_id', 'compact'] as $key) {
          if (!is_numeric($client[$key]) || $client[$key] < 0) {
              die(self::response("wrong option input"));
          }
      }
*/


seed working ;)




Ubuntu Linux 20.04.3 | MySQL 8 | Apache 2.4.41 | PHP 8.1.1

Last edited by kiki2020 on 2021-12-24 07:24:41
2021-12-24 09:34:03
Which tracker client are you using so I can check what caused the error - that code does not do anything its just to debug clients easier

If you notice any thing else let me know still fine tuning but very close to complete :thumb

2022-01-05 13:33:22
https://torrenttrader.uk/group/members    not loading, gives error

same for https://torrenttrader.uk/rules

same for https://torrenttrader.uk/profile    user profiles

same for https://torrenttrader.uk/adminmessages/masspm

same for https://torrenttrader.uk/adminbonus

In short, maybe good to check if all pages work. A lot throwing up errors still


Also, after you have edited your topic response, you should be leaded back to that response - instead to top of the page.
Also, why is there a auto refresh on the reporting of a post page?
If It Ain't Dutch, It Ain't Much!!
Last edited by Propaganda on 2022-01-05 13:41:18
2022-01-05 20:19:50
https://torrenttrader.uk/group/members   ===========> working
https://torrenttrader.uk/rulessame   ===============> working
https://torrenttrader.uk/profile   =================> working
https://torrenttrader.uk/adminmessages/masspmsame   => error
https://torrenttrader.uk/teams/index   =============> error
https://torrenttrader.uk/search/needseed   ==========> error


www.exyusubs.com
TorrentTrader V3.8.3 (SE)
OS: AlmaLinux 9.9 (BC)
Apache version: 2.4.71
PHP version: 8.5.13 (PHP-FPM)
MySQL version: 10.11.18-MariaDB
Last edited by Botanicar on 2022-01-05 20:23:37
2022-01-06 06:46:52
Cheers guys, one of the user querys had a spelling mistake which fixed most of them,  all sql querys has been redone ill be spending next week just checking everything over  👍
2022-01-07 18:43:55
When watching the profile of a user on your phone, or any smaller screen - the profile avatar will overlap the text of the next column.

https://torrenttrader.uk/admingroups/groups   >> Throws error
If It Ain't Dutch, It Ain't Much!!
Last edited by Propaganda on 2022-01-07 19:08:45
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