Bravo List

Bravo List (http://www.bvlist.com/index.php)
-   Torrent Trader (http://www.bvlist.com/forumdisplay.php?f=29)
-   -   Edit or torrent update error (http://www.bvlist.com/showthread.php?t=12332)

Botanicar 10th February 2021 23:15

Edit or torrent update error
 
Hi guys,
some idea about this error when I try to editing / updating my torrent:

Code:

Database Error in torrents-edit.php on line 188:
Data truncated for column 'freeleech' at row 1.
Query was: UPDATE torrents SET name = 'Deps.1974.HDTV.1080p.x264',
url = 'https://www.imdb.com/title/tt0181468/',
descr = 'Torrent description',
category = 4,
sticky = 'yes',
recommended = 'no',
torrentlang = 10,
torrentgenres = 1,
banned = 'no',
visible = 'yes',
tube = 'https://www.youtube.com/watch?v=kuTBea8_-LY',
freeleech = '',
anon = 'no',
webseed = '',
image1 = '7140.jpg' WHERE id = 714.


darkalchemy 10th February 2021 23:23

Whats the column definition for freeleech? It's expecting something and getting a string. I suspect it's supposed to be an int.

So, the query should probably be freeleech = 0, not freeleech = ''.

Botanicar 10th February 2021 23:27

Quote:

Originally Posted by darkalchemy (Post 55310)
Whats the column definition for freeleech? It's expecting something and getting a string. I suspect it's supposed to be an int.

So, the query should probably be freeleech = 0, not freeleech = ''.


Row 188: SQL_Query_exec("UPDATE torrents SET " . join(",", $updateset) . " WHERE id = $id");

https://i.postimg.cc/htggTKH4/Untitled.png

mogo 10th February 2021 23:29

:)
 
Quote:

Originally Posted by Botanicar (Post 55308)
Hi guys,
some idea about this error when I try to editing / updating my torrent:

Code:

Database Error in torrents-edit.php on line 188:
Data truncated for column 'freeleech' at row 1.
Query was: UPDATE torrents SET name = 'Deps.1974.HDTV.1080p.x264',
url = 'https://www.imdb.com/title/tt0181468/',
descr = 'Torrent description',
category = 4,
sticky = 'yes',
recommended = 'no',
torrentlang = 10,
torrentgenres = 1,
banned = 'no',
visible = 'yes',
tube = 'https://www.youtube.com/watch?v=kuTBea8_-LY',
freeleech = '',
anon = 'no',
webseed = '',
image1 = '7140.jpg' WHERE id = 714.



Very general would look like the code of i3on and TTCE

darkalchemy 10th February 2021 23:34

Quote:

Originally Posted by Botanicar (Post 55311)
Row 188: SQL_Query_exec("UPDATE torrents SET " . join(",", $updateset) . " WHERE id = $id");

This actually does not show me the query itself or the column definition.

I suspect the value of $updatedset is what you posted. The column definition can be found by running, in mysql:

Code:

SHOW CREATE TABLE torrents
and look at the freeleech column.

Botanicar 10th February 2021 23:42

Quote:

Originally Posted by darkalchemy (Post 55313)
This actually does not show me the query itself or the column definition.


This is resultate



Code:

CREATE TABLE `torrents` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `info_hash` varchar(40) DEFAULT NULL,
  `name` varchar(255) NOT NULL DEFAULT '',
  `filename` varchar(255) NOT NULL DEFAULT '',
  `save_as` varchar(255) NOT NULL DEFAULT '',
  `descr` text NOT NULL,
  `image1` text NOT NULL,
  `image2` text NOT NULL,
  `category` int(10) unsigned NOT NULL DEFAULT 0,
  `size` bigint(20) unsigned NOT NULL DEFAULT 0,
  `added` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `type` enum('single','multi') NOT NULL DEFAULT 'single',
  `numfiles` int(10) unsigned NOT NULL DEFAULT 0,
  `comments` int(10) unsigned NOT NULL DEFAULT 0,
  `views` int(10) unsigned NOT NULL DEFAULT 0,
  `hits` int(10) unsigned NOT NULL DEFAULT 0,
  `times_completed` int(10) unsigned NOT NULL DEFAULT 0,
  `leechers` int(10) unsigned NOT NULL DEFAULT 0,
  `seeders` int(10) unsigned NOT NULL DEFAULT 0,
  `last_action` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `visible` enum('yes','no') NOT NULL DEFAULT 'yes',
  `banned` enum('yes','no') NOT NULL DEFAULT 'no',
  `owner` int(10) unsigned NOT NULL DEFAULT 0,
  `anon` enum('yes','no') NOT NULL DEFAULT 'no',
  `numratings` int(10) unsigned NOT NULL DEFAULT 0,
  `ratingsum` int(10) unsigned NOT NULL DEFAULT 0,
  `nfo` enum('yes','no') NOT NULL DEFAULT 'no',
  `announce` varchar(255) NOT NULL DEFAULT '',
  `external` enum('yes','no') NOT NULL DEFAULT 'no',
  `torrentlang` int(10) unsigned NOT NULL DEFAULT 1,
  `freeleech` enum('0','1') NOT NULL DEFAULT '0',
  `url` varchar(80) CHARACTER SET utf8 DEFAULT NULL,
  `tube` varchar(100) DEFAULT NULL,
  `sticky` enum('yes','no') DEFAULT 'no',
  `thanks` longtext DEFAULT NULL,
  `webseed` enum('0','1') NOT NULL DEFAULT '0',
  `recommended` enum('yes','no') NOT NULL DEFAULT 'no',
  `torrentgenres` int(10) unsigned NOT NULL DEFAULT 100,
  PRIMARY KEY (`id`),
  UNIQUE KEY `info_hash` (`info_hash`(20)),
  KEY `owner` (`owner`),
  KEY `visible` (`visible`),
  KEY `category_visible` (`category`,`visible`),
  FULLTEXT KEY `name` (`name`)
) ENGINE=MyISAM AUTO_INCREMENT=717 DEFAULT CHARSET=latin1


darkalchemy 10th February 2021 23:45

As you can see it requires freeleech to be either 0 or 1 not and empty string.

In you code, change freeleech = '' to freeleech = 0

Botanicar 10th February 2021 23:57

If freeleech (or other options) is not checked I have that error.
Like that:
Freeleech -> unckecked = error
Freeleech -> ckecked = OK
Webseed -> unckecked = error
Webseed -> ckecked = OK
Recommended -> unckecked = error
Recommended -> ckecked = OK
....
....
....

darkalchemy 11th February 2021 00:00

Quote:

Originally Posted by Botanicar (Post 55316)
If freeleech (or other options) is not checked I have that error.
Like that:
Freeleech -> unckecked = error
Freeleech -> ckecked = OK
Webseed -> unckecked = error
Webseed -> ckecked = OK
Recommended -> unckecked = error
Recommended -> ckecked = OK
....
....
....

Each of those have a default in the database, so unless you setting 'yes' or 1, remove it from the query as they are not needed. Otherwise, they must be set to either 0 or 1 for the first 2 and yes or no for the last one.

joeroberts 11th February 2021 00:52

well First off lets start with what version of Torrent Trader are you working with?
fast way please show the file torrents-edit.php
seems like this file is trying to enter yes no rather then 0 1 so the error needs to be traced down.

Botanicar 11th February 2021 11:21

torrent-edit
 
Hi to all, here comes torrent-edit.php, torrents-upload.php and function.php

Version: 2.5
PHP: 5.6.4
Apache: 2.4.39
MariaDB: 10.2.36



torrent-edit.php
Code:


if ($CURUSER["edit_torrents"] == "yes")
$updateset[] = "freeleech = '".$_POST["freeleech"]."'";

//webseed
if ($CURUSER["edit_torrents"] == "yes")
$updateset[] = "webseed = '".$_POST["webseed"]."'";
//webseed
stdfoot();

?>


joeroberts 11th February 2021 14:42

fined
Code:

$updateset[] = "freeleech = '".$_POST["freeleech"]."'";
and replace with
Code:

$updateset[] = "freeleech = " . ($_POST["freeleech"] ? '1' : '0');
now find
Code:

$updateset[] = "webseed = '".$_POST["webseed"]."'";
and replace with
Code:

$updateset[] = "webseed = " . ($_POST["webseed"] ? '1' : '0');

Botanicar 11th February 2021 20:27

Thanks Joe and other guys
Have fixed that on my own way, don't ask how and whay but it works right now

Code:

$updateset[] = "freeleech = '" . ($_POST["freeleech"] ? "1" : "0") . "'";

Code:

$updateset[] = "webseed = '" . ($_POST["webseed"] ? "1" : "0") . "'";

MicroMonkey 16th March 2021 01:12

just for a future reference to whomever may read this. My torrents-upload.php has this
Quote:

$updateset[] = "freeleech = '".intval($_POST["freeleech"])."'";
SQL_Query_exec("UPDATE torrents SET " . join(",", $updateset) . " WHERE id = $id");
and torrents-edit.php
Quote:

$updateset[] = "freeleech = '".intval($_POST["freeleech"])."'";

joeroberts 19th March 2021 21:30

Quote:

Originally Posted by MicroMonkey (Post 55365)
just for a future reference to whomever may read this. My torrents-upload.php has this

and torrents-edit.php

Maybe because you have a different version then what he is using!
So that makes your post not needed or helpful in any way!

MicroMonkey 19th March 2021 22:36

Ok then Mr happy. Just posted some code that I thought could be useful. Sorry for that. I wont do it again. geez this place is volatile

joeroberts 19th March 2021 22:41

Your Post seems like your trying to make hem Look like he don't know what he is doing or posting the wrong code because your file dose not have the same code as what his has with out stating the fact that you are using a different or maybe a newer version then what he is using. What your post may have said was that maybe this was repaired in a later version and that he may want to look into upgrading.

MicroMonkey 20th March 2021 22:57

ok, fair enough, but I can promise you I wasnt trying to make him look bad. Why would I do that? I was just thinking I was helping, but I guess Its not perceived that way sadly. I have done a slew of editing over the years on this script, so apparently the intval was put there by me some time ago, so its not a different version, it was apparently a problem that I must have found some time ago and was just passing some info along. But no worries, all is well :)

Botanicar 26th March 2021 19:20

OK guys think I have to get involved in this discussion a little bit, thanks to you both, you are both right in your statement, it is true that I myself use a "modified" version of TT and it does not differ much of the original version with some things I have modified myself for my own needs.
Sometimes it is the case that some posts help and sometimes it is not in life as well.
I have tested both scripts you are involved in and think you do an extremely strong job in this area and really appreciate it

I have chosen one of them and think it works according to my needs

Wish you all the best in further script development

JohnHasher 28th March 2021 15:08

hey guys , can anyone send me the latest torrent trader source , let me see what i can do in it.

Bump: is there a version that will support php 7.4 ?

MicroMonkey 3rd April 2021 01:32

Try this JohnHasher. Im running a modded copy of this on 7.4.3, but the base code is basically the same https://github.com/MicrosoulV3/TorrentTrader-v3


All times are GMT +2. The time now is 00:49.

Powered by vBulletin® Version 3.8.11 Beta 3
Copyright ©2000 - 2024, vBulletin Solutions Inc.