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
Common Pool with FreeLeech (Pot commun)
Controls ·  Search New posts · Mark unread

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

2023-02-04 10:39:50
have you tried removing the database parts and re-importing them?
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)
2023-02-04 10:45:11
yes I deleted the two parts and put them back and still the same thing, I always get this error message when adding the points to the cagnote

Database Error. Please report this to an administrator.
2023-02-04 20:28:05
still wondering what this is
column `forum_tg`.`commonpot`.`id`

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)
2023-02-04 20:48:48
forum_tg is the name of the database
2023-02-04 21:20:47
Would it have anything to do with the database collation? Im not a sql expert. I use unicode_ci. Would the charset make a difference? I use utf8mb4 on the whole database so this sql matches my stuff anyway. Do we have any sql experts here? I do know that InnoDB and MyISAM can be mixed, so that isnt an issue
/*********************************************/
/*     By OXYDE - torrenttrader.uk (2023)    */
/*                                           */
/*            Torrent Trader v3              */
/*********************************************/

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- Table structure for commonpot
-- ----------------------------
DROP TABLE IF EXISTS `commonpot`;
CREATE TABLE `commonpot`  (
 `id` int(6) NOT NULL AUTO_INCREMENT,
 `userid` int(6) NULL DEFAULT NULL,
 `points` decimal(25, 0) NULL DEFAULT NULL,
 `added` datetime NULL DEFAULT NULL,
 PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of commonpot
-- ----------------------------

-- ----------------------------
-- Table structure for commonpot_status
-- ----------------------------
DROP TABLE IF EXISTS `commonpot_status`;
CREATE TABLE `commonpot_status`  (
 `status` enum('stopped','started') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'stopped',
 `start_date` datetime NULL DEFAULT NULL,
 `stop_date` datetime NULL DEFAULT NULL
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of commonpot_status
-- ----------------------------
INSERT INTO `commonpot_status` VALUES ('stopped', NULL, NULL);

SET FOREIGN_KEY_CHECKS = 1;

perhaps this would be better? I dont know your sql, so I took a guess
DROP TABLE IF EXISTS `commonpot`;
CREATE TABLE `commonpot`  (
`id` int(6) NOT NULL AUTO_INCREMENT,
`userid` int(6) NULL DEFAULT NULL,
`points` decimal(25, 0) NULL DEFAULT NULL,
`added` datetime NULL DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE
) ENGINE = MyISAM AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci;

DROP TABLE IF EXISTS `commonpot_status`;
CREATE TABLE `commonpot_status`  (
`status` enum('stopped','started') CHARACTER SET utf8 NOT NULL DEFAULT 'stopped',
`start_date` datetime NULL DEFAULT NULL,
`stop_date` datetime NULL DEFAULT NULL
) ENGINE = MyISAM CHARACTER SET = utf8 COLLATE = utf8_General_ci;

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)
Last edited by MicroMonkey on 2023-02-04 21:31:11
2023-02-05 08:04:09
partially sanitize the input on the commonpot.php file. Will only accept 0 thru 9 numeric. I was able to cause errors using decimals and random numbers, like .004.4.4.  and it would allow the rest of the keyboard keys, which is just silly.
<form name="commonpot" enctype="multipart/form-data" action="commonpot.php" method="post">
 <input type="hidden" name="takebonus" value="yes" />
 <table border="0" cellspacing="0" cellpadding="6" align="center">
   <tr>
     <td align='right'><b>How much you wasting on this?</b>: </td>
     <td align='left'>
       <input type="text" name="seedbonus" autocomplete="off" size="20" pattern="\d*" title="Only numbers are allowed.">
       <br />
       <font style='font-size: 10px;color:#d7bd2e'>
         <i><b>*</b> Amount entered will be added to the pool with the other idiots points.</i>
       </font>
     </td>
   </tr>
 </table>
 <br />
 <center>
   <input type="button" value="Go Back" onclick="history.back()" />  
   <input type="submit" value="Submit" />
   <br />
 </center>
</form>

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)
Last edited by MicroMonkey on 2023-02-05 09:20:47
2023-02-05 09:42:08
Thank you very much for your help and I have started all over again and always the same thing with the same error message so I will test again at the end of the week because no time today   😲
2023-02-11 19:15:13
Is this mod not working? Do we need a rewrite from scratch? I got some time.
2023-02-12 08:14:39
It works fine it seems. I havent had any issues. I posted some code above to sanitize the input because I was able to create errors by typing jibberish into the input box, but if you use that, it seems to be working fine. I am thinking niki was having an issue due to collation or some database discrepancy. Thats my guess. This line here is what matters. autocomplete sucks, and use pattern to limit the input to numbers only
<input type="text" name="seedbonus" autocomplete="off" size="20" pattern="\d*" title="Only numbers are allowed.">

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)
Last edited by MicroMonkey on 2023-02-12 08:26:51
2023-02-13 02:46:27
I’ve never seen that attribute before, interesting!

I know for file, you can use accept=“image/*”
2023-03-10 19:46:16
I always get this error when I click on "participate!" after adding 20 points

Database Error. Please report this to an administrator.




and in ladmin cp SQL Error in the error log I have the following error message

Database Error in commonpot.php on line 39: Incorrect integer value: '' for column `.`commonpot`.`id` at row 1. Query was: INSERT INTO commonpot (id, userid, points, added) VALUES('', 1, 20, '2023-03-10 19:26:10').







and when I delete the line of code below in the commonpot.php folder I don't get the error message anymore and my account is credited with 20 points but the points are not added to the kitty

SQL_Query_exec("INSERT INTO commonpot (id, userid, points, added) VALUES('', $CURUSER[id], $_POST[seedbonus], '" . get_date_time() . "')");




so it's certainly a small problem but I don't see where it comes from at all  😲  😲  😲

I attach the commonpot.php file
commonpot.php
Download
Last edited by niki on 2023-03-10 20:07:14
2023-03-10 21:46:53
I know that my file is not set for your french language, but it works. You can try this to test if you like. I included both files. Also, my files use this in config to turn it off or on.  
$site_config["COMMONPOT"] = false; // Common Pot on/off
commonpot.zip
Download

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)
Last edited by MicroMonkey on 2023-03-10 22:25:28
2023-03-10 22:29:37
also, I made some edits to the index.php code edits. I feel its better, but just my opinion. Also the input is sanitized for numbers only in the files above. Avoid potential issues. Thanks to OXYDE for creating this mod
//Common Pot (By OXYDE - torrenttrader.uk)
if ($site_config['COMMONPOT']){
  begin_frame(T_("COMMONPOT"));
 
  $res_commonpot = SQL_Query_exec("SELECT SUM(points) AS total FROM commonpot");
  $pot = mysqli_fetch_array($res_commonpot);
  $percent = (($pot["total"] / $site_config["COMMONPOT_SIZE"]) * 100);
 
  $res_commonpot_status = SQL_Query_exec("SELECT * FROM commonpot_status");
  $pot_status = mysqli_fetch_array($res_commonpot_status);
 
  $now = get_date_time();
  $delay = $site_config["FREELEECH_TIME"];
 
  if ($delay >= 8760) {
     $delay = floor($delay / 8760);
     $unit = "years";
  } elseif ($delay >= 720) {
     $delay = floor($delay / 720);
     $unit = "months";
  } elseif ($delay >= 24) {
     $delay = floor($delay / 24);
     $unit = "days";
  } else {
     $unit = "hours";
  }
 
  $duration = date("M j, Y g:i a", strtotime(" + $delay $unit"));
  $stop_date = date("M j, Y g:i a", strtotime("+ $delay $unit", strtotime($pot_status['start_date'])));
 
  if ($pot_status["status"] == "stopped" && $pot["total"] == $site_config["COMMONPOT_SIZE"]) {
     $status_text = "<font color='#00FF00'>The pot is full and freeleech will start in the next few minutes!</font>";
     $participate = "";
  }
 
  elseif ($pot_status["status"] == "started" && $stop_date <= $now) { $status_text = "<font color='#00FF00'>FreeLeech is over and pot will be reset in the next few minutes.</font>"; $participate = ""; }
 
  elseif ($pot_status["status"] == "started") { $status_text = "The pot is full and freeleech is <font color='#BFFF00'><b>ACTIVE</b></font> for <font color='#ffcd03'><b> $delay $unit</b></font> for everyone!<br>It will end on  </b><font color='#FFA500'><b>" . date( "M j, Y g:i a", utc_to_tz_time( $pot_status['stop_date'] ) ) . "</b>"; $participate = "";
   } else {
     $status_text = "$delay $unit of freeleech will be offered for everyone when the common pot is 100% full. Help increase the pot!";
     $participate = "<input type='button' value='Add to the pool' onclick='window.location.href = \"commonpot.php\"'>";
      }
 
  if (empty($pot["total"])) { $pot_total = "0"; } else { $pot_total = $pot["total"]; }
 
  ?>
  <table align='center'><tr><td style='padding: 0px; width: 500px; background-image: url(<?= $site_config["LOADBAR_IMG"] ?>loadbarbg.gif); background-repeat: repeat-x'>
  <?php
  if ($percent <= 40)
  $pic = "loadbarred.gif";
  elseif ($percent <= 70)
  $pic = "loadbaryellow.gif";
  else
  $pic = "loadbargreen.gif";
  $width = $percent * 5;
  $history = "<input type='button' value='Who else contributed?' onclick='window.location.href = \"commonpot-history.php\"'>";

  if ($percent >= .001) {
     echo "<img src='" . $site_config["LOADBAR_IMG"] . $pic . "' height='15' width='$width' alt='$percent%'><div style='position:relative;top:-15px;margin:auto;width:50%;color:#000;text-align:center;font-weight:bold;'>" . $pot_total . " / " . $site_config["COMMONPOT_SIZE"] . " [" . rtrim(rtrim((string)number_format($percent, 3, ".", ""), "0"), ".") . "%]</div><div style='float:right;'><br /><p align='right' style='font-size:13px;color:#FFF;font-weight:bold;'>" . $participate . "</p><p align='right' style='font-size:13px;color:#FFF;font-weight:bold;'><br />".$history."</p></div>" . $status_text;
 } else {
     echo "<img src='" . $site_config["LOADBAR_IMG"] . $pic . "' height='15' width='$width' alt='$percent%'><div style='position:relative;top:-15px;margin:auto;width:50%;color:#000;text-align:center;font-weight:bold;'>" . $pot_total . " / " . $site_config["COMMONPOT_SIZE"] . " [" . rtrim(rtrim((string)number_format($percent, 3, ".", ""), "0"), ".") . "%]</div><div style='float:right;'><p align='right' style='font-size:13px;color:#FFF;font-weight:bold;'>" . $participate . "</p></div>" . $status_text;
 }
  echo "</td></tr>";
  echo "</table>";
 
  end_frame();
  }
  //End Common Pot (By OXYDE - torrenttrader.uk)

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)
Last edited by MicroMonkey on 2023-03-10 22:37:12
2023-03-10 22:38:47
Database Error. Please report this to an administrator.

error log in the

thanks MicroMonkey a lot and still this damn error message

Database Error in commonpot.php on line 39: Incorrect integer value: '' for column .`commonpot`.`id` at row 1. Query was: INSERT INTO commonpot (id, userid, points, added) VALUES('', 1, 30, '2023-03-10 22:34:42').
2023-03-10 23:49:20
very odd, try this. remove the id, its set to auto increment anyway, so this *should* work. Test and see, but im still confused. Did you try the SQL I posted above? If you are not using utf8mb4, then maybe you would want the sql I posted, but I cant say for 100% certainty. For some reason your id is returning empty string
SQL_Query_exec("INSERT INTO commonpot (userid, points, added) VALUES('', $CURUSER[id], $_POST[seedbonus], '" . get_date_time() . "')");

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)
Last edited by MicroMonkey on 2023-03-11 00:08:15
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