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
Make torrents private
Controls ·  Search New posts · Mark unread

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

2023-01-20 01:05:15
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

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-01-20 01:05:56
2023-08-08 12:11:41
Good morning
can we put your code in the "torrents-import.php"
Last edited by SLy on 2023-08-08 12:14:11
2023-08-08 18:53:43
Yes. I dont use torrent-import, but at some point in the past I added it, so feel free to try it out. Here is my copy to compare.
<?php
require_once("backend/functions.php");
dbconn();

$dir = "import";

//ini_set("upload_max_filesize",$max_torrent_size);

$files = array();
$dh = opendir("$dir/");
while (false !== ($file=readdir($dh))) {
if (preg_match("/\.torrent$/i", $file))
$files[] = $file;
}
closedir($dh);


// check access and rights
if ($CURUSER["edit_torrents"] != "yes")
show_error_msg(T_("ERROR"), T_("ACCESS_DENIED"), 1);

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

if ($_POST["takeupload"] == "yes") {
set_time_limit(0);
require_once("backend/parse.php");
stdhead(T_("UPLOAD_COMPLETE"));
begin_frame(T_("UPLOAD_COMPLETE"));
echo "<center>";

//check form data
$catid = (int)$_POST["type"];

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

if (empty($message)) {
$r = SQL_Query_exec("SELECT name, parent_cat FROM categories WHERE id=$catid");
$r = mysqli_fetch_row($r);

echo "<b>Category:</b> ".htmlspecialchars($r[1])." -> ".htmlspecialchars($r[0])."<br />";
for ($i=0;$i<count($files);$i++) {
$fname = $files[$i];

$descr = T_("UPLOAD_NO_DESC");

$langid = (int)$_POST["lang"];

preg_match('/^(.+)\.torrent$/si', $fname, $matches);
$shortfname = $torrent = $matches[1];

//parse torrent file
$torrent_dir = $site_config["torrent_dir"];

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


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

$message = "<br /><br /><hr /><br /><b>$internalname</b><br /><br />fname: ".htmlspecialchars($fname)."<br />message: ";

//check announce url is local or external
if (!in_array($announce, $announce_urls, 1))
$external='yes';
else
$external='no';

if (!$site_config["ALLOWEXTERNAL"] && $external == 'yes') {
$message .= T_("UPLOAD_NO_TRACKER_ANNOUNCE");
echo $message;
continue;
}

$name = $internalname;
$name = str_replace(".torrent","",$name);
$name = str_replace("_", " ", $name);

// 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

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

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

$id = mysqli_insert_id($GLOBALS["DBconnector"]);

if (mysqli_errno($GLOBALS["DBconnector"]) == 1062) {
$message .= T_("UPLOAD_ALREADY_UPLOADED");
echo $message;
continue;
}

if($id == 0){
$message .= T_("UPLOAD_NO_ID");
echo $message;
continue;
}
   
copy("$dir/$files[$i]", "uploads/$id.torrent");

//EXTERNAL SCRAPE
if ($external=='yes' && $site_config['UPLOADSCRAPE']) {  
$tracker        = str_replace("/announce","/scrape",$announce);
$stats = torrent_scrape_url($tracker, $infohash);
$seeders = strip_tags($stats['seeds']);
$leechers = strip_tags($stats['peers']);
$downloaded = 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("Torrent $id ($name) was Uploaded by $CURUSER[username]");

$message .= "<br /><b>".T_("UPLOAD_OK")."</b><br /><a href='torrents-details.php?id=".$id."'>".T_("UPLOAD_VIEW_DL")."</a><br /><br />";
echo $message;
@unlink("$dir/$fname");
}
echo "</center>";
end_frame();
stdfoot();
die;
}else
show_error_msg(T_("UPLOAD_FAILED"), $message, 1);

}//takeupload


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

stdhead(T_("UPLOAD"));

begin_frame(T_("UPLOAD"));
?>
<form name="upload" enctype="multipart/form-data" action="torrents-import.php" method="post">
<input type="hidden" name="takeupload" value="yes" />
<table border="0" cellspacing="0" cellpadding="6" align="center">
<tr><td align="right" valign="top"><b>File List:</b></td><td align="left"><?php
if (!count($files))
echo T_("NOTHING_TO_SHOW_FILES") ." $dir";
else{
foreach ($files as $f)
echo htmlspecialchars($f)."<br />";
echo "<br />Total files: ".count($files);
}?></td></tr>
<?php
$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\">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'>Language: </td><td align='left'>".$language."</td></tr>");

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

<?php } ?>
<tr><td align="center" colspan="2"><input type="submit" value="<?php echo T_("UPLOAD")?>" /><br />
<i><?php echo T_("CLICK_ONCE_IMAGE");?></i></td></tr></table></form>
<?php
end_frame();
stdfoot();
?>

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-08-12 17:43:54
Good morning,
I would need some advice.
My problem is related to this Mod: https://torrenttrader.uk/post/10286
Let me explain:
when I import mkv, ie a folder with 20 torrents in it.
No problem.
https://imgur.com/a/GSRCymt
But when I import several folders with 1 mkv+1 nfo,
https://imgur.com/lcXpJ2h
The Mod https://torrenttrader.uk/post/10286 bug
Last edited by SLy on 2023-08-12 18:12:21
2023-08-12 18:35:21
my code in torrents-imports.php

<?php
//
//  TorrentTrader v2.x
require_once("backend/functions.php");
dbconn();
loggedinonly();
$dir = "import";


function typelist1() {
   $ret = array();
   $res = SQL_Query_exec("SELECT name FROM genre WHERE type='Film' ORDER BY name ASC");
   while ($row = mysql_fetch_assoc($res))
       $ret[] = $row;
   return $ret;
}



//ini_set("upload_max_filesize",$max_torrent_size);

$files = array();
$dh = opendir("$dir/");
while (false !== ($file=readdir($dh))) {
  if (preg_match("/\.torrent$/i", $file))
     $files[] = $file;
}
closedir($dh);


// check access and rights
if ($CURUSER["edit_torrents"] != "yes")
  show_error_msg(T_("ERROR"), T_("ACCESS_DENIED"), 1);

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

if ($_POST["takeupload"] == "yes") {
  set_time_limit(0);
  require_once("backend/parse.php");
  stdhead(T_("UPLOAD_COMPLETE"));
  begin_frame(T_("UPLOAD_COMPLETE"));
  echo "<center>";

  //check form data
  $catid = (int)$_POST["type"];

  if (!is_valid_id($catid))
     $message = T_("UPLOAD_NO_CAT");
 
  if (empty($message)) {
     $r = SQL_Query_exec("SELECT name, parent_cat FROM categories WHERE id=$catid");
     $r = mysql_fetch_row($r);

     echo "<b>Category:</b> ".htmlspecialchars($r[1])." -> ".htmlspecialchars($r[0])."<br />";
     for ($i=0;$i<count($files);$i++) {
        $fname = $files[$i];

       
 
        preg_match('/^(.+)\.torrent$/si', $fname, $matches);
        $shortfname = $torrent = $matches[1];

        //parse torrent file
        $torrent_dir = $site_config["torrent_dir"];  

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


        $announce = strtolower($TorrentInfo[0]);
        $infohash = $TorrentInfo[1];
        $creationdate = $TorrentInfo[2];
        $internalname = $TorrentInfo[3];
        $torrentsize = $TorrentInfo[4];
        $filecount = $TorrentInfo[5];
        $annlist = $TorrentInfo[6];
        $comment = $TorrentInfo[7];
       
        $message = "<br /><br /><hr /><br /><b>$internalname</b><br /><br />fname: ".htmlspecialchars($fname)."<br />message: ";

        //check announce url is local or external
        if (!in_array($announce, $announce_urls, 1))
           $external='yes';
        else
           $external='no';

        if (!$site_config["ALLOWEXTERNAL"] && $external == 'yes') {
           $message .= T_("UPLOAD_NO_TRACKER_ANNOUNCE");
           echo $message;
           continue;
        }
  $name = $internalname;
  $name = str_replace(".torrent","",$name);
  $name = str_replace(".avi", "", $name);
  $name = str_replace(".mkv", "", $name);
  $name = str_replace(".mp4", "", $name);
  $name = str_replace(".mp3", "", $name);
  $name = str_replace(".flac", "", $name);
  $name = str_replace("_", " ", $name);
  $name = str_replace(".", " ", $name);
  $name = str_replace("'", " ", $name);


  if ($_POST["nomc"]=="")
  $nomc = $name;
  else $nomc= $_POST["nomc"];
  $nomc = str_replace(".torrent","",$nomc);
  $nomc = str_replace(".avi", "", $nomc);
  $nomc = str_replace(".mkv", "", $nomc);
  $nomc = str_replace(".mp4", "", $nomc);
  $nomc = str_replace(".mp3", "", $nomc);
  $nomc = str_replace(".flac", "", $nomc);
  $nomc = str_replace("_", " ", $nomc);
  $nomc = str_replace(".", " ", $nomc);
 
// nfo
      $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';
 }
        //anonymous upload
        $anonyupload = $_POST["anonycheck"];
        if ($anonyupload == "yes")
           $anon = "yes";
        else
           $anon = "no";
  $genre = $_POST["genre"];
  $serietv = $_POST["serietv"];
  $exclu = $_POST["exclu"];
  $freeleech = $_POST["freeleech"];
  $emission = $_POST["emission"];
  $soustitre = $_POST["soustitre"];
  $saisontv = $_POST["saisontv"];
  $annee = $_POST["annee"];
  $langid = $_POST["lang"];
  $highspeed = $_POST["highspeed"];


$fin = $_POST["fin"];

$avant1 = $_POST["avant"];
if ($_POST["avant"]!="")
$avant = "$avant1 ";
else $avant="";
$name1= "$avant$name $fin";

if ($_POST["qui"]=="")
$qui = $CURUSER['id'];
else
$qui = $_POST["qui"];

// 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 = mysql_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;
     }}
 

        $ret = SQL_Query_exec("INSERT INTO torrents (valide, highspeed, nfo, soustitre, image1, image2, annee, saisontv, genre, serietv, nomc, emission, freeleech, exclu, filename, owner, name, category, added, info_hash, size, numfiles, save_as, announce, external, torrentlang, anon, last_action)
         VALUES ('yes', '$highspeed', ".sqlesc($nfo).", ".sqlesc($soustitre).", '".$inames[0]."', '".$inames[1]."', ".sqlesc($annee).", ".sqlesc($saisontv).", ".sqlesc($genre).", '$serietv', ".sqlesc($nomc).", '$emission', '$freeleech', '$exclu',".sqlesc($fname).", ".$qui.", ".sqlesc($name1).", '".$catid."', '" . get_date_time() . "', '".$infohash."', '".$torrentsize."', '".$filecount."', ".sqlesc($fname).", '".$announce."', '".$external."', '".$langid."','$anon', '".get_date_time()."')");

        $id = mysql_insert_id();
 
        if (mysql_errno() == 1062) {
           $message .= T_("UPLOAD_ALREADY_UPLOADED");
           echo $message;
           continue;
        }

        if($id == 0){
           $message .= T_("UPLOAD_NO_ID");
           echo $message;
           continue;
        }
   
        copy("$dir/$files[$i]", "uploads/$id.torrent");

        //EXTERNAL SCRAPE
        if ($external=='yes' && $site_config['UPLOADSCRAPE']) {  
           $tracker        = str_replace("/announce","/scrape",$announce);  
           $stats          = torrent_scrape_url($tracker, $infohash);
           $seeders       = strip_tags($stats['seeds']);
           $leechers       = strip_tags($stats['peers']);
           $downloaded    = 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("Torrent $id ($name) was Uploaded by $CURUSER[username]");

        $message .= "<br /><b>".T_("UPLOAD_OK")."</b><br /><a href='torrents-details.php?id=".$id."'>".T_("UPLOAD_VIEW_DL")."</a><br /><br />";
        echo $message;
        @unlink("$dir/$fname");
     }
  echo "</center>";
  end_frame();
  stdfoot();
  die;
  }else
     show_error_msg(T_("UPLOAD_FAILED"), $message, 1);

}//takeupload

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

stdhead(T_("UPLOAD"));

begin_frame(T_("UPLOAD"));
?>
<form name="upload" enctype="multipart/form-data" action="torrents-import.php" method="post">
<input type="hidden" name="takeupload" value="yes" />
<table border="0" cellspacing="0" cellpadding="6" align="center">
<tr><td align="right" valign="top"><b>File List:</b></td><td align="left"><?php
if (!count($files))
  echo T_("NOTHING_TO_SHOW_FILES")." $dir/.";
else{
  foreach ($files as $f)
     echo htmlspecialchars($f)."<br />";
  echo "<br />Total files: ".count($files);
}?></td></tr>
<?php
$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>");
print ("<tr><td align='right'>Nom court du torrent: </td><td align='left'><input type='text' name='nomc' size='60' value='" . $_POST['nomc'] . "' /> <font size=3 color=red>*</font><br /><font color=red>Merci de mettre le nom sans tiret, point, tag, annnée et sans apostrophe</font> \n</td></tr>");


$language = "<select name=\"lang\">\n<option value=\"0\">Inconnu/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'> Mettre a l'avant du nom: </td><td align='left'> <input type='text' name='avant' size='50' value='" . $_POST['avant'] ."'> </td></tr>");
print ("<tr><td align='right'> Mettre a la fin du nom: </td><td align='left'> <input type='text' name='fin' size='50' value='" . $_POST['fin'] ."'> </td></tr>");

print ("<tr><td align='right'>Language: </td><td align='left'>".$language."</td></tr>");
print ("<tr><td align='right'> Année Production: </td><td align='left'> <input type='text' name='annee' size='10' value='" . $_POST['annee'] ."'> <font size=3 color=red>*</font></td></tr>");
print ("<tr><td align='right'>".T_("IMAGE")." :&nbsp;</td><td><input type='file' name='image0' size='50' /><br /><font color=red>".T_("MAX_FILE_SIZE").": ".mksize($site_config['image_max_filesize'])."  ".T_("ACCEPTED_FORMATS").": ".implode(", ", array_unique($site_config["allowed_image_types"]))."</font></td></tr>");
print ("<tr><td align='right'>" .T_("NFO"). ": </td><td align='left'> <input type='file' name='nfo' size='50' value='" . $_FILES['nfo']['name'] . "' /> [<a href='nfogen.php' target='_blank'>" . T_("GENERATE_NFO") . "</a>]<br />\n</td></tr>");

print ("<tr><td align='right'> Qui upload: </td><td align='left'> <input type='text' name='qui' size='10' value='" . $_POST['qui'] ."'> TheFondateur = 1 si vide c'est ton nom</td></tr>");


$genre = "<select name=\"genre\">\n<option value=\"\">Selectionné un Genre</option>\n";
$gen = typelist1();
foreach ($gen as $row)
$genre .= "<option value=\"" . htmlspecialchars($row["name"]). "\">" . htmlspecialchars($row["name"]) . "</option>\n";
$genre .= "</select>\n";
print ("<tr><td align='right'>Genre: </td><td align='left'>".$genre."</td></tr>");
//print ("<tr><td align='right'>SeedBox: </td><td><input type=\"checkbox\" name=\"highspeed\"" .$highspeed. " value=\"1\" /> " .T_("HIGH_SPEED"). " </td></tr>");
print("<tr><td class='table_col2'align='right'>".T_("SEEDBOX").": </td><td class='table_col1' align='left'><input type=\"checkbox\" name=\"highspeed\"" .$highspeed. " value=\"1\" /> " .T_("SEEDBOX_MSG"). " </td></tr>");

print ("<tr><td align='right'>".T_("FREE_LEECH").": </td><td><input type=\"checkbox\" name=\"freeleech\"" .$freeleech. " value=\"1\" /> " .T_("FREE_LEECH_MSG"). " </td></tr>");

function typelists() {
   $ret = array();
   $res = SQL_Query_exec("SELECT id, nom, annee FROM serietv ORDER BY nom ASC");
   while ($row = mysql_fetch_assoc($res))
       $ret[] = $row;
   return $ret;
}
     $serietv = "<select name=\"serietv\">\n<option value=\"\">Sélectionner une série</option>\n";
$serietvs = typelists();
foreach ($serietvs as $row)
$serietv .= "<option value=\"" . $row["id"]. "\">".htmlspecialchars($row["nom"])." (".$row["annee"].")</option>\n";
$serietv .= "</select>\n";
print ("<tr><td align='right'>Serie: </td><td> ".$serietv." <font size=3 color=red>*</font> </td></tr> ");

function typelistss() {
   $ret = array();
   $res = SQL_Query_exec("SELECT saison FROM saisontv ORDER BY id ASC");
   while ($row = mysql_fetch_assoc($res))
       $ret[] = $row;
   return $ret;
}
$saisontv = "<select name=\"saisontv\">\n<option value=\"\">Sélectionner une Saison</option>\n";
$saisontvs = typelistss();
foreach ($saisontvs as $row)
$saisontv .= "<option value=\"" . htmlspecialchars($row["saison"]). "\">" . htmlspecialchars($row["saison"]) . "</option>\n";
$saisontv .= "</select>\n";
print ("<tr><td align=right>Saison: </td><td align='left'>".$saisontv." <font size=3 color=red>*</font> ");


  function emission1() {
   $ret = array();
   $res = SQL_Query_exec("SELECT id, nom FROM emission ORDER BY nom ASC");
   while ($row = mysql_fetch_assoc($res))
       $ret[] = $row;
   return $ret;
}
$emission = "<select name=\"emission\">\n<option value=\"\">Sélectionner une Emission</option>\n";
$emissions = emission1();
foreach ($emissions as $row)
$emission .= "<option value=\"" . $row["id"]. "\">" . htmlspecialchars($row["nom"]) . "</option>\n";
$emission .= "</select>\n";
print ("<tr><td align='right'>Emission: </td><td align='left'>".$emission."</td></tr>");

if ($site_config['ANONYMOUSUPLOAD']){ ?>
  <tr><td align="right"><?php echo T_("UPLOAD_ANONY");?>: </td><td><?php printf("<input name='anonycheck' value='yes' type='radio' " . ($anonycheck ? " checked='checked'" : "") . " />Yes <input name='anonycheck' value='no' type='radio' " . (!$anonycheck ? " checked='checked'" : "") . " />No"); ?> &nbsp;<?php echo T_("UPLOAD_ANONY_MSG");?>
  </td></tr>
   <tr><td align="right">Exclusivité: </td><td><?php printf("<input name='exclu' value='yes' type='radio' " . ($exclu ? " checked='checked'" : "") . " />".T_("YES")." <input name='exclu' value='no' type='radio' " . (!$exclu ? " checked='checked'" : "") . " />".T_("NO").""); ?> &nbsp;<i><font color=green>N'utiliser que si c'est le seul site où l'on trouvera cet Upload</font></i></td></tr>
   <tr><td align="right">Sous-Titre FR: </td><td><?php printf("<input name='soustitre' value='yes' type='radio' " . ($soustitre ? " checked='checked'" : "") . " />".T_("YES")." <input name='soustitre' value='no' type='radio' " . (!$soustitre ? " checked='checked'" : "") . " />".T_("NO").""); ?> &nbsp;<i><font color=green>N'utiliser que si sous-titre français au complet</font></i></td></tr>

<?php } ?>
<tr><td align="center" colspan="2"><input type="submit" value="<?php echo T_("UPLOAD")?>" /><br />
<i><?php echo T_("CLICK_ONCE_IMAGE");?></i></td></tr></table></form>
<?php
end_frame();
stdfoot();
?>




my code in torrents-details.php


// File List
//begin_frame(T_("FILE_LIST"));

echo "<fieldset width='65%' class='download'><b>".T_("FILE_LIST").":</b>&nbsp;<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='0' width='100%'><tr><th width='1%' class='table_head'>&nbsp;".T_("FILE_LIST_EXTENSION")."</th><th class='table_head' align='left'>&nbsp;".T_("FILE")."</th><th class='table_head'>&nbsp;".T_("SIZE")."</th></tr>";



$fres = SQL_Query_exec("SELECT * FROM `files` WHERE `torrent` = $id ORDER BY `path` ASC");
if (mysql_num_rows($fres)) {
   while ($frow = mysql_fetch_assoc($fres)) {
 $ext = pathinfo($frow['path'], PATHINFO_EXTENSION);
if ($ext !== false && $ext == 'mp3') {
$filetype_icon = "<img height=50  src=/themes/".$THEME."/images/torrents/mp3.png>";
}else if ($ext !== false && $ext == 'flac') {
$filetype_icon = "<img height=50  src=/themes/".$THEME."/images/torrents/flac.png>";
}else if ($ext !== false && $ext == 'URL') {
$filetype_icon = "<img height=50  src=/themes/".$THEME."/images/torrents/url.png>";
}else if ($ext !== false && $ext == 'pdf') {
$filetype_icon = "<img height=50  src=/themes/".$THEME."/images/torrents/pdf.png>";
}else if ($ext !== false && $ext == 'epub') {
$filetype_icon = "<img height=50  src=/themes/".$THEME."/images/torrents/epub.png>";
}else if ($ext !== false && $ext == 'm3u') {
$filetype_icon = "<img height=50  src=/themes/".$THEME."/images/torrents/m3u.png>";
}else if ($ext !== false && $ext == 'mp4') {
$filetype_icon = "<img height=50  src=/themes/".$THEME."/images/torrents/mp4.png>";
}else if ($ext !== false && $ext == 'png') {
$filetype_icon = "<img height=50  src=/themes/".$THEME."/images/torrents/png.png>";
}else if ($ext !== false && $ext == 'mkv') {
$filetype_icon = "<img height=50  src=/themes/".$THEME."/images/torrents/mkv.png>";
}else if ($ext !== false && $ext == 'iso') {
$filetype_icon = "<img height=50  src=/themes/".$THEME."/images/torrents/iso.png>";
}else if ($ext !== false && $ext == 'avi') {
$filetype_icon = "<img height=50  src=/themes/".$THEME."/images/torrents/avi.png>";
}else if ($ext !== false && $ext == 'nfo') {
$filetype_icon = "<img height=50  src=/themes/".$THEME."/images/torrents/nfo.png>";
}else if ($ext !== false && $ext == 'ape') {
$filetype_icon = "<img height=50  src=/themes/".$THEME."/images/torrents/ape.png>";
}else if ($ext !== false && $ext == 'cbr') {
$filetype_icon = "<img height=50  src=/themes/".$THEME."/images/torrents/cbr.png>";
}else if ($ext !== false && $ext == 'cbt') {
$filetype_icon = "<img height=50  src=/themes/".$THEME."/images/torrents/cbt.png>";
}else if ($ext !== false && $ext == 'divx') {
$filetype_icon = "<img height=50  src=/themes/".$THEME."/images/torrents/divx.png>";
}else if ($ext !== false && $ext == 'flv') {
$filetype_icon = "<img height=50  src=/themes/".$THEME."/images/torrents/flv.png>";
}else if ($ext !== false && $ext == 'mobi') {
$filetype_icon = "<img height=50  src=/themes/".$THEME."/images/torrents/mobi.png>";
}else if ($ext !== false && $ext == 'mov') {
$filetype_icon = "<img height=50  src=/themes/".$THEME."/images/torrents/mov.png>";
}else if ($ext !== false && $ext == 'mp2') {
$filetype_icon = "<img height=50  src=/themes/".$THEME."/images/torrents/mp2.png>";
}else if ($ext !== false && $ext == 'mpc') {
$filetype_icon = "<img height=50  src=/themes/".$THEME."/images/torrents/mpc.png>";
}else if ($ext !== false && $ext == 'mpg') {
$filetype_icon = "<img height=50  src=/themes/".$THEME."/images/torrents/mpg.png>";
}else if ($ext !== false && $ext == 'ogg') {
$filetype_icon = "<img height=50  src=/themes/".$THEME."/images/torrents/ogg.png>";
}else if ($ext !== false && $ext == 'rar') {
$filetype_icon = "<img height=50  src=/themes/".$THEME."/images/torrents/rar.png>";
}else if ($ext !== false && $ext == 'wav') {
$filetype_icon = "<img height=50  src=/themes/".$THEME."/images/torrents/wav.png>";
}else if ($ext !== false && $ext == 'wma') {
$filetype_icon = "<img height=50  src=/themes/".$THEME."/images/torrents/wma.png>";
}else if ($ext !== false && $ext == 'wmv') {
$filetype_icon = "<img height=50  src=/themes/".$THEME."/images/torrents/wmv.png>";
}else if ($ext !== false && $ext == 'zip') {
$filetype_icon = "<img height=50  src=/themes/".$THEME."/images/torrents/zip.png>";
}else if ($ext !== false && $ext == 'jpg') {
$filetype_icon = "<img height=50  src=/themes/".$THEME."/images/torrents/png.png>";
}      
echo "<tr><td class='table_col2' width='1%' align='center'>".$filetype_icon."</td><td class='table_col1' width='70%'>".htmlspecialchars($frow['path'])."</td><td class='table_col2' width='8%' align='center'>".mksize($frow['filesize'])."</td></tr>";
  }
}else{
  echo "<tr><td class='table_col1'>".htmlspecialchars($row["name"])."</td><td width='10%' class='table_col2'>".mksize($row["size"])."</td></tr>";
}
echo "</table></div>";
2023-08-17 20:32:07
use this. This code takes into account the different rar types in the preg_match (like .r01, r02). You can add more below in the array for different filetypes. Simple. This code is perfect
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>";
  }

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-08-20 13:37:27
2023-09-01 00:32:46
This conflicts with external. The lack of the private key in general should be a clear indication that the metadata is publicly tracked. Always perform this check before inserting a new key into the info dictionary.
2023-09-01 19:35:36
@Storrents, did you accidentally post in the wrong spot? Its fine if you did, no biggie, just wanted clarification  👍
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)
2024-01-07 17:17:19
thank you very much for your help  😊
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: 2
  • Members: 0
  • Guests online: 2
  • Comments: 3
  • Messages: 1,728