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
User Posts

Go to Profile

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>
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;
still wondering what this is
column `forum_tg`.`commonpot`.`id`
have you tried removing the database parts and re-importing them?
what is this? Did you edit something? Those column names are not mentioned in this mod code anywhere. Check your edits
column `forum_tg`.`commonpot`.`id` 
No worries. Thanks again for sharing. Very cool mod. I made some edits for myself on the index. I figure if you can give hours, you can also give days for freeleech. Still have to use hours as the config number, eg: 24 hours = 1 day, 72 hours = 3 days, etc. and it will not show the history button if nobody has participated (its set to .001 for 1 seed point) I was just having fun playing around.
index.php
//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 >= 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 = "[ <a href='commonpot.php'>participate</a> ]"; }
 
  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 <= 50)
  $pic = "loadbarred.gif";
  elseif ($percent <= 70)
  $pic = "loadbaryellow.gif";
  else
  $pic = "loadbargreen.gif";
  $width = $percent * 5;

  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;'><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;'>[ <a href='commonpot-history.php'>History</a> ]</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)
one more thing, this code goes into the backend/functions.php file in case someone hasnt figured it out. I think the OP made a typo
find
		$expandrows = array_map("trim", $expandrows);
}

below put
	//Common Pot (By OXYDE - torrenttrader.uk)
$res_pot = SQL_Query_exec("SELECT status FROM commonpot_status");
$pot = mysqli_fetch_assoc($res_pot);
//End Common Pot (By OXYDE - torrenttrader.uk)
cool. Thanks for sharing. I was tinkering, and for testing I wanted a quick way to reset it, so I added a button in the admincp to clear it and reset. You can fix up the language file as you see fit
///////////////// CLEAR COMMON POOL /////////////////////////////

if ($action == "clearpool") {

   stdhead(T_("CLEAR_COMMON_POOL"));
   error_reporting(E_ALL);
   
   begin_frame("".T_("CLEAR_COMMON_POOL")."");
   
   if ($do != "clearpoolforreal") {
       ?>
       <br /><br />
       <font size ='3'><center><?php echo T_("CLEAR_COMMON_POOL_MESSAGE"); ?></center></font>
       <br /><br />
       
       <form enctype="multipart/form-data" method="post" action="admincp.php">
       <input type="hidden" name="action" value="clearpool" />
       <input type="hidden" name="do" value="clearpoolforreal" />
       <table class="f-border" cellspacing="0" cellpadding="5" width="100%" align="center">
       <tr><td colspan="2" align="center"><input type="submit" value="<?php echo T_("CLEAR_COMMON_POOL");?>" /></td></tr>
       </table></form>
       <?php
   }
   
   if ($do == "clearpoolforreal") {
       SQL_Query_exec("UPDATE commonpot_status SET status='stopped', start_date=NULL, stop_date=NULL");
       SQL_Query_exec("TRUNCATE TABLE commonpot");
       write_log("Common Pool cleared by $CURUSER[username]");
       autolink ("admincp.php", "<b><font color='#ff0000'> Common Pool Cleared....</font></b>");
   }
   
   end_frame();
   navmenu();
   stdfoot();
}
   ///////////////END CLEAR COMMON POOL //////////////////////////////////////////////


my lang
$LANG["CLEAR_COMMON_POOL"] = "Clear Common Pool";
$LANG["CLEAR_COMMON_POOL_MESSAGE"] = "Are you sure you want to reset the pool?";
$LANG["COMMON_POOL_CLEARED_MESSAGE"] = "Common Pot cleared and reset";

the button in admincp (you have to get an image to use if you like)
  <td align="center"><a href="admincp.php?action=clearpool"><img src="images/admin/poolclear.png" border="0" width="118" height="80" alt="" /><br /><?php echo T_("CLEAR_COMMON_POOL"); ?><br /></a></td>
Unconnectable — 2023-02-03 00:03:19 in v3 Support
and just for clarity, here is the unesc function in announce.php
function unesc($x) {
mysqli_real_escape_string($GLOBALS["DBconnector"],$x);
return $x;
}
unless you have a responsive theme, it doesnt really work well on mobile. Try a different theme
rtorrent — 2023-01-27 08:12:54 in v3 Support
Since I dont use rutorrent, I cant say much, but I have to ask the question, What changed from the last version to the version you are using? It went from working to not working right?
this works better. That one above works great, just doesn't use plurals. I didnt think of that. I have 3 time functions in my code lol. I need to clean this mess up and pick one to use for crying out loud haha
function timeAgo($time_ago) {
   $time_ago = new DateTime($time_ago);
   $now = new DateTime();
   $interval = $now->diff($time_ago);

   if ($interval->y > 0) {
       $years = $interval->format("%y");
       return $years . " year" . ($years > 1 ? "s" : "") . " ago";
   } elseif ($interval->m > 0) {
       $months = $interval->format("%m");
       return $months . " month" . ($months > 1 ? "s" : "") . " ago";
   } elseif ($interval->d > 0) {
       $days = $interval->format("%d");
       return $days . " day" . ($days > 1 ? "s" : "") . " ago";
   } elseif ($interval->h > 0) {
       $hours = $interval->format("%h");
       return $hours . " hour" . ($hours > 1 ? "s" : "") . " ago";
   } elseif ($interval->i > 0) {
       $minutes = $interval->format("%i");
       return $minutes . " minute" . ($minutes > 1 ? "s" : "") . " ago";
   } else {
       return "just now";
   }
}
Im testing this one. Seems reasonable and makes sense I think. I will keep it running and see
function timeAgo($time_ago) {
   $time_ago = new DateTime($time_ago);
   $now = new DateTime();
   $interval = $now->diff($time_ago);

   if ($interval->y > 0) {
       return $interval->format("%y years ago");
   } elseif ($interval->m > 0) {
       return $interval->format("%m months ago");
   } elseif ($interval->d > 0) {
       return $interval->format("%d days ago");
   } elseif ($interval->h > 0) {
       return $interval->format("%h hours ago");
   } elseif ($interval->i > 0) {
       return $interval->format("%i minutes ago");
   } else {
       return "just now";
   }
}
I thought this used to be here, but I couldnt find it. If I missed it, let me know. This makes local torrents automatically private on upload. In torrents-upload.php, put anywhere. Works for 2.08 as well
	// Make torrent private
  if ($external == "no") {
   require_once("backend/BDecode.php");
   require_once("backend/BEncode.php");
   $dict = BDecode(file_get_contents("$torrent_dir/$fname"));
   $dict["info"]["private"] = 1;
   $fs = fopen("$torrent_dir/$fname", "w");
   fwrite($fs, BEncode($dict));
   fclose($fs);
   $TorrentInfo = array();
   $TorrentInfo = ParseTorrent("$torrent_dir/$fname");
   $infohash = $TorrentInfo[1];
  }
  // End add make torrent private
also, you can add this to your torrents-upload file to make local torrents private without having to tick any boxes in your client. Pretty simple
	// Make torrent private
  if ($external == "no") {
   require_once("backend/BDecode.php");
   require_once("backend/BEncode.php");
   $dict = BDecode(file_get_contents("$torrent_dir/$fname"));
   $dict["info"]["private"] = 1;
   $fs = fopen("$torrent_dir/$fname", "w");
   fwrite($fs, BEncode($dict));
   fclose($fs);
   $TorrentInfo = array();
   $TorrentInfo = ParseTorrent("$torrent_dir/$fname");
   $infohash = $TorrentInfo[1];
  }
  // End add make torrent private
Icon on file list — 2023-01-17 22:16:59 in Old v2 Tpoics
just wanted to post this in case its useful to anyone. You can add more as you need, it will also cover all RAR files, as .r00, .r01, .r02 etc. This is much better than everything we were trying in previous posts.  Get some flaticons here https://www.flaticon.com/ or just use your own, just change it below to fit your needs
echo "<br /><br /><b>".T_("FILE_LIST").":</b> <img src='images/plus.gif' id='pic1' onclick='klappe_torrent(1)' alt='' /><div id='k1' style='display: none;'><table align='center' cellpadding='0' cellspacing='0' class='table_table' border='1' width='100%'><tr><th width='50' class='table_head'> ".T_("TYPE")."</th><th class='table_head' align='left'> ".T_("FILE")."</th><th width='50' class='table_head'> ".T_("SIZE")."</th></tr>";
$fres = SQL_Query_exec("SELECT * FROM `files` WHERE `torrent` = $id ORDER BY `path` ASC");
if (mysqli_num_rows($fres)) {
   while ($frow = mysqli_fetch_assoc($fres)) {
$ext = pathinfo($frow['path'], PATHINFO_EXTENSION);
$filetype_icons = [
"mp3" => "/images/filetype-icons/mp3.png",
"iso" => "/images/filetype-icons/iso.png",
"mp4" => "/images/filetype-icons/mp4.png",
"png" => "/images/filetype-icons/png.png",
"jpg" => "/images/filetype-icons/jpg.png",
"mkv" => "/images/filetype-icons/mkv.png",
"rar" => "/images/filetype-icons/rar.png",
"avi" => "/images/filetype-icons/avi.png",
"nfo" => "/images/filetype-icons/nfo.png"
 ];
 if(preg_match("/^r\d{2}$/", $ext)) {
$filetype_icon = "<img width=40 height=40 src='/images/filetype-icons/rar.png'>";
} elseif(isset($filetype_icons[$ext])) {
$filetype_icon = "<img width=40 height=40 src='" . $filetype_icons[$ext] . "'>";
} else {
$filetype_icon = "<img width=40 height=40 src='/images/filetype-icons/unknown.png'>";
}
 

       echo "<tr><td class='table_col1'>".$filetype_icon."</td><td class='table_col1'>".htmlspecialchars($frow['path'])."</td><td class='table_col2'>".mksize($frow['filesize'])."</td></tr>";
   }
I appologise. I was not understanding the order of these posts and completely missed what you asked about (fr language). I created this code in response to what ExtremelyM asked. I humbly appologise to the french speakers. For some reason I thought you guys were asking for the same thing......my bad. Where is the *facepalm* when you need it. I guess if extremelyM ever sees this post, I didnt do that for nothing lol. TMDB should work for 2.08 tho
Help with regex? — 2023-01-17 07:57:10 in v3 Support
yea, I used that thing to build the regex I posted above. I only needed that one to grab proper imdb. That site really helped. I was pulling the entire URL in the one I needed, not just inserting the videoID. Yours works great tho for defined string, the one I was messing with is for pulling that URL from the descrition of a torrent, but usually at least http(s):// www imdb etc...... Thanks for the help tho, you guys are great :)
Help with regex? — 2023-01-16 23:52:31 in v3 Support
well, sometimes an imdb link can look like this
https://www.imdb.com/title/tt8593824/?ref_=nv_sr_srsg_3

or this
https://www.imdb.com/title/tt14642626/

and I was looking for a "catch all", which the regex I managed to work out above does, but yes, this was for a insert. I dont use it, someone asked and I was curious about it, so I made that after pulling my hair out. Sometimes in the torrent description, there is an imdb link, and that was what that person asked for. I assume its for mass torrent imports with descriptions and rather than adding links to the DB for each, it will autoload on torrents-details
well, try this. I tested it on 1 test torrent as that is the only thing I can do. I inserted multiple URL in the description as well as plain text, and it only accepts the imdb as the URL. torrents-details. Backup files in case. Test and let me know. Consider this "in progress"
//Get any IMDB link from descr and load it into the DB under imdb
$timdb = SQL_Query_exec("SELECT descr FROM torrents WHERE id = $id");
$bang = mysqli_fetch_assoc($timdb);
$bang2 = implode(" ",$bang);
preg_match_all('/\b(https?):\/\/(www).(imdb.com)[-A-Z0-9+&@#\/%?=~_|$!:,.;]*[A-Z0-9+&@#\/%=~_|$]/i', $bang2, $matches);
$urls = $matches[0];

function array_map_callback($url)
{
return mysqli_real_escape_string($GLOBALS["DBconnector"], $url);
}
array_map('array_map_callback', $urls);
foreach ($urls as $url) {
  SQL_Query_exec("UPDATE `torrents` SET `imdb`= '".$url."' WHERE id = $id");
}

for 2.08
//Get any IMDB link from descr and load it into the DB under imdb
$timdb = SQL_Query_exec("SELECT descr FROM torrents WHERE id = $id");
$bang = mysqli_fetch_assoc($timdb);
$bang2 = implode(" ",$bang);
preg_match_all('/\b(https?):\/\/(www).(imdb.com)[-A-Z0-9+&@#\/%?=~_|$!:,.;]*[A-Z0-9+&@#\/%=~_|$]/i', $bang2, $matches);
$urls = $matches[0];

function array_map_callback($url)
{
return mysql_real_escape_string($url);
}
array_map('array_map_callback', $urls);
foreach ($urls as $url) {
  SQL_Query_exec("UPDATE `torrents` SET `imdb`= '".$url."' WHERE id = $id");
}
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