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
[SOLVED] SQL error on torrent upload
Controls ·  Search New posts · Mark unread

You are in: Forum / Forum / Torrent Trader / v3 Support

Unknown User
2019-11-07 19:14:50
Hi now!

What this error means and how to fix it?

[ICODE]Database Error in torrents-upload.php on line 203: Data truncated for column 'vip' at row 1. Query was: INSERT INTO torrents (filename, owner, name, descr, vip, image1, image2, category, added, info_hash, size, numfiles, save_as, announce, external, nfo, torrentlang, anon, last_action) VALUES ('Armin_Van_Buuren_-_A_State_Of_Trance_4_Part_1.mp3.torrent', '1', 'TESTIKAS tornjuha', 'Hiljem kustutamiseks', '', '10.jpg', '', '22', '2019-11-07 19:11:41', 'dfdf9d55528cc44bcf762b6401d957befe0b2986', '57596371', '1', 'Armin_Van_Buuren_-_A_State_Of_Trance_4_Part_1.mp3.torrent', 'https://omade.link/announce.php', 'no', 'yes', '1','no', '2019-11-07 19:11:41').[/ICODE]
Unknown User
2019-11-08 07:32:15
for future support requests post whats on line 203 in torrents-upload

you need to move the vip from were it is and place it were its value is im guessing just before last_action


$ret = SQL_Query_exec("INSERT INTO torrents (filename, owner, name, descr, image1, image2, category, added, info_hash, size, numfiles, save_as, announce, external, nfo, torrentlang, anon, vip, last_action)


on line 203 torrents-upload.php

you cannot just add code werever it needs to match the values you put vip next to descr, but its values are next to last_action
so the vip was looking for a yes/no and was given somting else


VALUES ('Armin_Van_Buuren_-_A_State_Of_Trance_4_Part_1.mp3.torrent', '1', 'TESTIKAS tornjuha', 'Hiljem kustutamiseks', '', '10.jpg', '', '22', '2019-11-07 19:11:41', 'dfdf9d55528cc44bcf762b6401d957befe0b2986', '57596371', '1', 'Armin_Van_Buuren_-_A_State_Of_Trance_4_Part_1.mp3.torrent', 'https://omade.link/announce.php', 'no', 'yes', '1','no', '2019-11-07 19:11:41').
Unknown User
2019-11-08 15:17:12
Thank you for your reply.

But can remove this VIP at all, I don't need it . It could be deleted from the database and elsewhere?
2019-11-08 15:38:48
You can remove the edits on torrent-upload.php and keep the mod or remove all if you wish, heres the mod
[URL unfurl="true"]https://www.torrenttrader.xyz/index.php?threads/vip-only-torrents-ttv3.9882/#post-67361[/url]

In the next release all mods will be able to be turned on and off  in config.php and most will be in a  seperete folder so wont be part of the main code
Unknown User
2019-11-08 16:32:43
It worked and the upload works (y) but now is problem "Missing key: passkey
qBitTorrent client
[ATTACH]5229[/ATTACH]

My account no passkey
[ATTACH]5230[/ATTACH]

Im redownload torrent and im tried to reset passkey but nothing changed !?

Mu config.php


[ATTACH]5231[/ATTACH]

Im tried this

$site_config['PASSKEYURL'] = "$site_config[SITEURL]/announce.php?passkey=%s"; // Announce URL to use for passkey
qbittorrent-passkey.png
qbittorrent-passkey.png
my-account.png
my-account.png
konfig-file.png
konfig-file.png
2019-11-08 18:39:18
Looking at the config picture it looks like capital s is missing
$site_config[SITEURL]/announce.php?passkey=%s
On qbit at the bottom if you click on the torrent is the pass key on the tracker
Unknown User
2019-11-08 18:59:16
im just done a clean installation and still the same problem "Missing key: passkey"    :cry: I tried TTv3 and TorrentTrader 3.0 versions but same problem.
I'm completely confused. What's the problem?
2019-11-08 19:20:27
Are you deleting the torrent on qbit ?
Once you create and upload a torrent, download the torrent from your site then delete it in qbit before running the downloaded file, sometimes the tracker is not re added with the passkey, let's rule that out first

what does qbit look like
Untitled.png
Untitled.png
Unknown User
2019-11-08 19:40:44
I always deleted torrents and files from everywhere from qbitorrent, database and server @ uploads folder BUT...
I found a problem, but how do I solve it? Only then can the torrent work if this VIP torrent is marked.
2019-11-08 20:08:51
Post your torrent-upload.php and a pic of qbit like the one above and I'll take a look
Unknown User
2019-11-08 20:21:30
[ATTACH]5233[/ATTACH]

all 4 torrents works perfectly @ VIP status

<?php
require_once($_SERVER["DOCUMENT_ROOT"]."/backend/functions/functions.php");
dbconn();

// check access and rights
if ($site_config["MEMBERSONLY"]){
   loggedinonly();

   if($CURUSER["can_upload"]=="no")
       show_error_msg(T_("ERROR"), T_("UPLOAD_NO_PERMISSION"), 1);
   if ($site_config["UPLOADERSONLY"] && $CURUSER["class"] < 4)
       show_error_msg(T_("ERROR"), T_("UPLOAD_ONLY_FOR_UPLOADERS"), 1);
}

$announce_urls = explode(",", strtolower($site_config["announce_list"]));  //generate announce_urls[] from config.php

if ($_POST["takeupload"] == "yes") {
   

   // Check form data.
   if ( ! isset($_POST['type'], $_POST['name'], $_FILES['torrent']) )
         $message = T_('MISSING_FORM_DATA');
   
   if (($num = $_FILES['torrent']['error']))
        show_error_msg(T_('ERROR'), T_("UPLOAD_ERR[$num]"), 1);

   $f = $_FILES["torrent"];
   $fname = $f["name"];

   if (empty($fname))
       $message = T_("EMPTY_FILENAME");

   $nfo = 'no';
       
   if ($_FILES['nfo']['size'] != 0) {
       $nfofile = $_FILES['nfo'];

       if ($nfofile['name'] == '')
           $message = T_("NO_NFO_UPLOADED");
           
       if (!preg_match('/^(.+)\.nfo$/si', $nfofile['name'], $fmatches))
           $message = T_("UPLOAD_NOT_NFO");

       if ($nfofile['size'] == 0)
           $message = T_("NO_NFO_SIZE");

       if ($nfofile['size'] > 65535)
           $message = T_("NFO_UPLOAD_SIZE");

       $nfofilename = $nfofile['tmp_name'];

       if (($num = $_FILES['nfo']['error']))
            $message = T_("UPLOAD_ERR[$num]");
       
       $nfo = 'yes';
   }

   // vip
   $vip = $_POST["vip"];
   
   $descr = $_POST["descr"];

   if (!$descr)
       $descr = T_("UPLOAD_NO_DESC");

   $langid = (int) $_POST["lang"];
   
   /*if (!is_valid_id($langid))
       $message = "Please be sure to select a torrent language";*/

   $catid = (int) $_POST["type"];

   if (!is_valid_id($catid))
       $message = T_("UPLOAD_NO_CAT");

   if (!validfilename($fname))
       $message = T_("UPLOAD_INVALID_FILENAME");

   if (!preg_match('/^(.+)\.torrent$/si', $fname, $matches))
       $message = T_("UPLOAD_INVALID_FILENAME_NOT_TORRENT");

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

   if (!empty($_POST["name"]))
       $name = $_POST["name"];
       
   $tmpname = $f['tmp_name'];

   //end check form data

   if (!$message) {
   //parse torrent file
   $torrent_dir = $site_config["torrent_dir"];  
   $nfo_dir = $site_config["nfo_dir"];  

   //if(!copy($f, "$torrent_dir/$fname"))
   if(!move_uploaded_file($tmpname, "$torrent_dir/$fname"))
       show_error_msg(T_("ERROR"), T_("ERROR"). ": " . T_("UPLOAD_COULD_NOT_BE_COPIED")." $tmpname - $torrent_dir - $fname",1);

   $TorrentInfo = array();
   $TorrentInfo = ParseTorrent("$torrent_dir/$fname");


   $announce = $TorrentInfo[0];
   $infohash = $TorrentInfo[1];
   $creationdate = $TorrentInfo[2];
   $internalname = $TorrentInfo[3];
   $torrentsize = $TorrentInfo[4];
   $filecount = $TorrentInfo[5];
   $annlist = $TorrentInfo[6];
   $comment = $TorrentInfo[7];
   $filelist = $TorrentInfo[8];

/*
//for debug...
   print ("<br /><br />announce: ".$announce."");
   print ("<br /><br />infohash: ".$infohash."");
   print ("<br /><br />creationdate: ".$creationdate."");
   print ("<br /><br />internalname: ".$internalname."");
   print ("<br /><br />torrentsize: ".$torrentsize."");
   print ("<br /><br />filecount: ".$filecount."");
   print ("<br /><br />annlist: ".$annlist."");
   print ("<br /><br />comment: ".$comment."");
*/
   
   //check announce url is local or external
   if (!in_array($announce, $announce_urls, 1)){
       $external='yes';
   }else{
       $external='no';
   }

   //if externals is turned off
   if (!$site_config["ALLOWEXTERNAL"] && $external == 'yes')
       $message = T_("UPLOAD_NO_TRACKER_ANNOUNCE");
   }
   if ($message) {
       @unlink("$torrent_dir/$fname");
       @unlink($tmpname);
       @unlink("$nfo_dir/$nfofilename");
       show_error_msg(T_("UPLOAD_FAILED"), $message,1);
   }

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

   //upload images
   $allowed_types = &$site_config["allowed_image_types"];

   $inames = array();
   for ($x=0; $x < 2; $x++) {
       if (!($_FILES['image'.$x]['name'] == "")) {
           $y = $x + 1;

           //if (!preg_match('/^(.+)\.(jpg|gif|png)$/si', $_FILES[image.$x]['name']))
           //    show_error_msg(T_("INVAILD_IMAGE"), T_("THIS_FILETYPE_NOT_IMAGE"), 1);

           if ($_FILES['image$x']['size'] > $site_config['image_max_filesize'])
               show_error_msg(T_("ERROR"), T_("INVAILD_FILE_SIZE_IMAGE"), 1);

           $uploaddir = $site_config["torrent_dir"]."/images/";

           $ifile = $_FILES['image'.$x]['tmp_name'];

           $im = getimagesize($ifile);

           if (!$im[2])
               show_error_msg(T_("ERROR"), sprintf(T_("INVALID_IMAGE"), $y), 1);

           if (!array_key_exists($im['mime'], $allowed_types))
               show_error_msg(T_("ERROR"), T_("INVALID_FILETYPE_IMAGE"), 1);

           $ret = SQL_Query_exec("SHOW TABLE STATUS LIKE 'torrents'");
           $row = mysqli_fetch_array($ret);
           $next_id = $row['Auto_increment'];

           $ifilename = $next_id . $x . $allowed_types[$im['mime']];

           $copy = copy($ifile, $uploaddir.$ifilename);

           if (!$copy)
               show_error_msg(T_("ERROR"), sprintf(T_("IMAGE_UPLOAD_FAILED"), $y), 1);

           $inames[] = $ifilename;

       }

   }
   //end upload images

   //anonymous upload
   $anonyupload = $_POST["anonycheck"];
   if ($anonyupload == "yes") {
       $anon = "yes";
   }else{
       $anon = "no";
   }

   $ret = SQL_Query_exec("INSERT INTO torrents (filename, owner, name, descr, image1, image2, category, added, info_hash, size, numfiles, save_as, announce, external, nfo, torrentlang, anon, vip, last_action) VALUES (".sqlesc($fname).", '".$CURUSER['id']."', ".sqlesc($name).", ".sqlesc($descr).",  '".$inames[0]."', '".$inames[1]."', '".$catid."', '" . get_date_time() . "', '".$infohash."', '".$torrentsize."', '".$filecount."', ".sqlesc($fname).", '".$announce."', '".$external."', '".$nfo."', '".$langid."','$anon', '".$vip."', '".get_date_time()."')");

   $id = mysqli_insert_id($GLOBALS["DBconnector"]);
   
   if (mysqli_errno($GLOBALS["DBconnector"]) == 1062)
       show_error_msg(T_("UPLOAD_FAILED"), T_("UPLOAD_ALREADY_UPLOADED"), 1);

   //Update the members uploaded torrent count
   /*if ($ret){
       SQL_Query_exec("UPDATE users SET torrents = torrents + 1 WHERE id = $userid");*/
       
   if($id == 0){
       unlink("$torrent_dir/$fname");
       $message = T_("UPLOAD_NO_ID");
       show_error_msg(T_("UPLOAD_FAILED"), $message, 1);
   }
   
   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]."/";
           }
           SQL_Query_exec("INSERT INTO `files` (`torrent`, `path`, `filesize`) VALUES($id, ".sqlesc($fname).", $size)");
       }
   } else {
       SQL_Query_exec("INSERT INTO `files` (`torrent`, `path`, `filesize`) VALUES($id, ".sqlesc($TorrentInfo[3]).", $torrentsize)");
   }

   if (!is_array($annlist)) {
       $annlist = array(array($announce));
   }
   foreach ($annlist as $ann) {
       foreach ($ann as $val) {
           if (strtolower(substr($val, 0, 4)) != "udp:") {
               SQL_Query_exec("INSERT INTO `announce` (`torrent`, `url`) VALUES($id, ".sqlesc($val).")");
           }
       }
   }

   if ($nfo == 'yes') {
           move_uploaded_file($nfofilename, "$nfo_dir/$id.nfo");
   }

   //EXTERNAL SCRAPE
   if ($external=='yes' && $site_config['UPLOADSCRAPE']){
       $tracker=str_replace("/announce","/scrape",$announce);  
       $stats             = torrent_scrape_url($tracker, $infohash);
       $seeders         = (int) strip_tags($stats['seeds']);
       $leechers         = (int) strip_tags($stats['peers']);
       $downloaded     = (int) strip_tags($stats['downloaded']);

       SQL_Query_exec("UPDATE torrents SET leechers='".$leechers."', seeders='".$seeders."',times_completed='".$downloaded."',last_action= '".get_date_time()."',visible='yes' WHERE id='".$id."'");
   }
   //END SCRAPE

   write_log( sprintf(T_("TORRENT_UPLOADED"), htmlspecialchars($name), $CURUSER["username"]) );

// shout new
$msg_shout = sqlesc("New Torrent: [url=".$site_config['SITEURL']."/torrents-details.php?id=".$id."]".$torrent."[/url] has been uploaded ".($anon == 'no' ? "by [url=".$site_config['SITEURL']."/account-details.php?id=".$CURUSER['id']."]" .$CURUSER['username']. "[/url]" : "")."");
   SQL_Query_exec("INSERT INTO shoutbox (userid, date, user, message) VALUES(0,NOW(), 'System' ,".$msg_shout.")");
   //end

   //Uploaded ok message (update later)
   if ($external=='no')
       $message = sprintf( T_("TORRENT_UPLOAD_LOCAL"), $name, $id, $id );
   else
       $message = sprintf( T_("TORRENT_UPLOAD_EXTERNAL"), $name, $id );
   show_error_msg(T_("UPLOAD_COMPLETE"), $message, 1);

   die();
}//takeupload


///////////////////// FORMAT PAGE ////////////////////////

stdhead(T_("UPLOAD"));

begin_frame(T_("UPLOAD_RULES"));
   echo "<b>".stripslashes($site_config["UPLOADRULES"])."</b>";
   echo "<br />";
end_frame();

begin_frame(T_("UPLOAD"));
?>
<form name="upload" enctype="multipart/form-data" action="torrents-upload.php" method="post">
<input type="hidden" name="takeupload" value="yes" />
<table border="0" cellspacing="0" cellpadding="6" align="center">
<?php
print ("<tr><td align='right' valign='top'>" . T_("ANNOUNCE_URL") . ": </td><td align='left'>");

while (list($key,$value) = thisEach($announce_urls)) {
   echo "<b>$value</b><br />";
}

if ($site_config["ALLOWEXTERNAL"]){
   echo "<br /><b>".T_("THIS_SITE_ACCEPTS_EXTERNAL")."</b>";
}
print ("</td></tr>");
print ("<tr><td align='right'>" . T_("TORRENT_FILE") . ": </td><td align='left'> <input type='file' name='torrent' size='50' value='" . $_FILES['torrent']['name'] . "' />\n</td></tr>");
print ("<tr><td align='right'>" .T_("NFO"). ": </td><td align='left'> <input type='file' name='nfo' size='50' value='" . $_FILES['nfo']['name'] . "' /><br />\n</td></tr>");
print ("<tr><td align='right'>" . T_("TORRENT_NAME") . ": </td><td align='left'><input type='text' name='name' size='60' value='" . $_POST['name'] . "' /><br />".T_("THIS_WILL_BE_TAKEN_TORRENT")." \n</td></tr>");
print ("<tr><td colspan='2' align='center'>".T_("MAX_FILE_SIZE").": ".mksize($site_config['image_max_filesize'])."<br />".T_("ACCEPTED_FORMATS").": ".implode(", ", array_unique($site_config["allowed_image_types"]))."<br /></td></tr><tr><td align='right'>".T_("IMAGE")." 1:&nbsp;&nbsp;</td><td><input type='file' name='image0' size='50' /></td></tr><tr><td align='right'>".T_("IMAGE")." 2:&nbsp;&nbsp;</td><td><input type='file' name='image1' size='50' /></td></tr>");

$category = "<select name=\"type\">\n<option value=\"0\">" . T_("CHOOSE_ONE") . "</option>\n";

$cats = genrelist();
foreach ($cats as $row)
   $category .= "<option value=\"" . $row["id"] . "\">" . htmlspecialchars($row["parent_cat"]) . ": " . htmlspecialchars($row["name"]) . "</option>\n";

$category .= "</select>\n";
print ("<tr><td align='right'>" . T_("CATEGORY") . ": </td><td align='left'>".$category."</td></tr>");


$language = "<select name=\"lang\">\n<option value=\"0\">".T_("UNKNOWN_NA")."</option>\n";

$langs = langlist();
foreach ($langs as $row)
   $language .= "<option value=\"" . $row["id"] . "\">" . htmlspecialchars($row["name"]) . "</option>\n";

$language .= "</select>\n";
print ("<tr><td align='right'>".T_("LANGUAGE").": </td><td align='left'>".$language."</td></tr>");

// vip only
if (get_user_class() > 4)
print ("<tr><td align='right'>VIP: </td><td align=left><input type='checkbox' name='vip' " .
(($row["vip"] == "yes") ? " checked='checked' " : "" ) . " value='yes'>Check this box if you want the torrent for only for VIP.</td></tr>");


if ($site_config['ANONYMOUSUPLOAD'] && $site_config["MEMBERSONLY"] ){ ?>
   <tr><td align="right"><?php echo T_("UPLOAD_ANONY");?>: </td><td><?php printf("<input name='anonycheck' value='yes' type='radio' " . ($anonycheck ? " checked='checked'" : "") . " />".T_("YES")." <input name='anonycheck' value='no' type='radio' " . (!$anonycheck ? " checked='checked'" : "") . " />".T_("NO").""); ?> &nbsp;<i><?php echo T_("UPLOAD_ANONY_MSG");?></i>
   </td></tr>
   <?php
}

print ("<tr><td align='center' colspan='2'>" . T_("DESCRIPTION") . "</td></tr></table>");

require_once($_SERVER["DOCUMENT_ROOT"]."/backend/functions/bbcode.php");
print textbbcode("upload","descr","$descr");
?>

<br /><br /><center><input type="submit" value="<?php echo T_("UPLOAD_TORRENT"); ?>" /><br />
<i><?php echo T_("CLICK_ONCE_IMAGE");?></i>
</center>
</form>

<?php
end_frame();
stdfoot();
?>
OK-qbit.png
OK-qbit.png
Unknown User
2019-11-09 09:46:36
Im reinstall server and install without Let's Encrypt certificates our TTv3  and all works fine.
2020-02-28 16:59:53
Your trying to establish a http(s) announce url, which is not supported in clients. It will timeout forever. That strange bit about this script, is announce.php

if ($MEMBERSONLY){
...
}

This literally shuts off common features needed for private torrents (announce.php), if MEMBERSONLY = false in config.php (it assumes a strictly-private-only site. Not always the case for people. Comment out the lines above in 2 occurrences and try again. You'll start to see actual pear stats instantly, and Missing Passkey is due to a improper url to the client. It is looking for a passkey, which is not available. if you pass /announce.php?passkey=123456, this will work in any combination because of the code above is not allowing clients to check the passkey, so returns true which is actually not working the way it was designed.

I figured this out the hard way, and really assumed my SSL was the problem. announce.php was the problem. Now it validates all passkeys perfectly (I used random string to verify, it checks out). Ensure http is strictly used for announce. HTTPS is not supported, nor any other announce url out there with that prefix. If one does work, please message me with the link.
2020-02-28 22:57:48
movie-torrentz uses https, unless I am misunderstanding whats going on here. Here is an announce in my client https://m2g.link/announce?passkey=blahblah. They use TT also, but I suspect its highly modified
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)
2020-02-29 07:50:23
???? ?

[ATTACH type="full" alt="5387"]5387[/ATTACH]
screenshot.png
screenshot.png
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: 3
  • Members: 0
  • Guests online: 3
  • Comments: 3
  • Messages: 1,728