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

first post updated. Lemme know if it can be improved
thanks buddy, I appreciate the info.  😊
Thanks for the suggestions. Are you meaning using isset on $GLOBALS["DBconnector"] ? I havent gotten any errors or warning on mine, but its a bit different than this one. this is the stock login page that comes with TTv3. That is defined in the functions file and it is the entire sql connection for the whole script. like this
    $GLOBALS["DBconnector"] = new mysqli($mysql_host, $mysql_user, $mysql_pass, $mysql_db);    // Check connection
   if ($GLOBALS["DBconnector"]->connect_error) {
      die("Connection failed: " . $GLOBALS["DBconnector"]->connect_error);
}
Thanks Botanicar. I will have a look at that.
This is an updated copy of the account-login.php file from github of TTv3. I cant test this exactly just now, but I updated my own copy, which is more modified than this, so I tried to bring over some key items to see if this is more secure than the old one. This should be prepared statements on the username and password. I think at the very least the prepared login is a big step in a better direction.  Let me know if you see any problems
<?php
// Updated login for sql injection security March 2023
require_once("backend/functions.php");
dbconn();
session_start();

if (!empty($_REQUEST["returnto"])) {
   if (!isset($_GET["nowarn"])) {
       $nowarn = T_("MEMBERS_ONLY");
   }
}

if (isset($_POST["username"]) && isset($_POST["password"])) {
   $password = passhash($_POST["password"]);

   if (!empty($_POST["username"]) && !empty($_POST["password"])) {
       $stmt = $GLOBALS["DBconnector"]->prepare("SELECT id, password, secret, status, enabled FROM users WHERE username = ?");
       $stmt->bind_param("s", $_POST["username"]);
       $stmt->execute();
       $res = $stmt->get_result();
       $row = $res->fetch_assoc();

       if (!$row || ($_POST["password"] == $row["password"])) {
           $message = T_("LOGIN_INCORRECT");
       } elseif ($row["status"] == "pending") {
           $message = T_("ACCOUNT_PENDING");
       } elseif ($row["enabled"] == "no") {
           $message = T_("ACCOUNT_DISABLED");
       }
   } else {
       $message = T_("NO_EMPTY_FIELDS");
   }

   if (!$message) {
       logincookie($row["id"], $row["password"], $row["secret"]);
       if (!empty($_POST["returnto"])) {
           header("Refresh: 0; url=" . $_POST["returnto"]);
           die();
       } else {
           header("Refresh: 0; url=index.php");
           die();
       }
   } else {
       show_error_msg(T_("ACCESS_DENIED"), $message, 1);
   }
}

logoutcookie();

stdhead(T_("LOGIN"));

if (isset($nowarn)) {
   show_error_msg(T_("ERROR"), $nowarn, 0);
}


begin_frame(T_("LOGIN"));
?>

<form method="post" action="account-login.php">
   <table border="0" cellpadding="3" align="center">
       <tr>
           <td align="center">
               <b><?php echo T_("USERNAME"); ?>:</b>
               <input type="text" size="40" name="username" />
           </td>
       </tr>
       <tr>
           <td align="center">
               <b><?php echo T_("PASSWORD"); ?>:</b>
               <input type="password" size="40" name="password" />
           </td>
       </tr>
       <tr>
           <td colspan="2" align="center">
               <input type="submit" value="<?php echo T_("LOGIN"); ?>" />
               <br />
               <br />
               <i><?php echo T_("COOKIES");?></i>
           </td>
       </tr>
   </table>

   <?php
   if (!empty($_REQUEST["returnto"])) {
       ?>
       <input type="hidden" name="returnto" value="<?php echo cleanstr($_REQUEST["returnto"]); ?>" />
       <?php
   }
   ?>

</form>

<p align="center">
   <a href="account-signup.php"><?php echo T_("SIGNUP"); ?></a> |
   <a href="account-recover.php"><?php echo T_("RECOVER_ACCOUNT"); ?></a>
</p>

<?php
end_frame();
stdfoot();
?>
@Botanicar. I wasnt aware of that mod existing, or I would have probably used it lol. Is this it? https://torrenttrader.uk/post?id=4362
@Storrents, I tried that, and it does work, but if you want to make the upload smaller then the max, you can. I also noticed for some reason that when I used that ini setting and maxxed out the size, it would just die with no error. May have been a mistake I was making tho.
I was only testing the mime types
I put this on github since Im sure I'll keep fooling with it, and its just simpler for me https://github.com/MicrosoulV3/TTv3-Simple-File-Uploader
thanks spirit. If its not known, you can move these settings to config.php and remove them from all files. You can just use them as they are and paste them in, or if you want, you can change them to site_config[], but why bother. When I was figuring this out, thats why all those are in each one. Im sure there is more cleanup that can be done since it was put together in pieces.
$fileExtensionsAllowed = ['jpeg', 'jpg', 'png', 'rar', 'zip', 'txt', 'gif','mp4','mp3','wav']; // Allowed filetypes
$maxFileSize = 500 * 1024 * 1024; // Change the first number to desired size eg: 100 = 100MB. Cannot exceed php.ini upload_max_filesize and post_max_size setting
$uploadDirectory = "/uploadedfiles/";
I added in fileUploadScript at the top someplace
$username = $CURUSER['username'];

Then I changed this line.
$uploadPath = $currentDirectory . $uploadDirectory . $username . '_' . basename($fileName);

will add the username to the front of the filename. Just a simple thing
ok. i'll check that stuff. I was researching and pulling things from all over the place to put that together. I had a basic start point, but had to fiddle for a while changing things, screwing it up, reverting haha because I wasnt quite sure where I wanted to go with it. That is one thing that I didnt put alot of thought into because its mainly just for me and some trusted people, but It makes sense to be correct. Thanks as always for the info
Better version with sanity check and file validator. It makes the error message about being too large much simpler since that error was giving me a hard time haha
I cobbled this together because I needed a simpler way for me and a few people to share small files quickly without having to use a service like dropbox or google drive. Put the 3 files in root, create a new folder for the files called uploadedfiles and link or visit yoursite.com/uploader.php. It could be set to only allow admin or vip groups to use it, but I have the delete button set to only allow admin to delete any file and anyone can use it. You can change it as you see fit. I figured I would share it in case its of any use to others. I added this to github, go there for this https://github.com/MicrosoulV3/TTv3-Simple-File-Uploader
donate_block.php — 2023-02-22 20:50:40 in v3 Support
try this. I think you also need a donor column in your user table too? Im not completely sure, but try this.
donate_block.php — 2023-02-22 19:49:57 in v3 Support
line 87 niki
donate_block.php — 2023-02-21 21:10:27 in v3 Support
I have this if all you needed was a progress bar that only an admin can manually enter donation amounts into. Its nothing fancy and doesnt give credit to any particular users. I probably spent more time on this than I should have, but I was having fun and learning a few things about post data. Its fun to tinker. BTW, I used @Botanicar SQL, this block dont use all the fields, but works fine. Did I mention that autocomplete is garbage? hahaha

donate_block.php
<?php
if(isset($CURUSER) && $CURUSER['id']>0){
begin_block(T_("DONATE_BLOCK_MESSAGE"));

$totalneeded = "420"; //=== set this to your monthly wanted amount
$totalneeded3 ="$".sprintf("%01.2f", $totalneeded);

// Get the total funds from the database
$month1 = sqlesc(gmdate("m"));
$year1 = sqlesc(gmdate("Y"));
$total_funds1 = SQL_Query_exec("SELECT sum(cash) as total_funds FROM `funds` WHERE year <= $year1");
$arr_funds = mysqli_fetch_array($total_funds1);
$funds_so_far = $arr_funds["total_funds"];

// Get the new donation amount from the user input
if(isset($_POST['donation_amount'])) {
 $donation_amount = floatval($_POST['donation_amount']);
 if($donation_amount > 0) {
   // Add the new donation amount to the existing funds
   $funds_so_far += $donation_amount;
   
   // Insert the new donation amount into the database
   $insert = "INSERT INTO `funds` (cash, month, year) VALUES ($donation_amount, $month1, $year1)";
   SQL_Query_exec($insert);
 }
}

$funds_difference = $totalneeded - $funds_so_far;
$Progress_so_far = $funds_so_far / $totalneeded * 100;

$Percent = $Progress_so_far;
$Percent = floor(($Percent) * 100 + .5) * .01;

if($Progress_so_far >= $totalneeded)
$Progress_so_far = "100";
$Progress_so_far2 = $Progress_so_far;
if ($funds_so_far / $totalneeded * 100 <= 30) {
   $pic = "images/loadbar/loadbarred.gif";
   $Progress_so_far2 = 20;
} elseif ($funds_so_far / $totalneeded * 100 <= 50) {
   $pic = "images/loadbar/loadbaryellow.gif";
} else {
   $pic = "images/loadbar/loadbargreen.gif";
}

if($totalneeded >= $funds_so_far) {
$monthly_goal = " ".round($Progress_so_far)."%";
$monthly_goal22 = "";
}
else
$monthly_goal = "Donation goal of ".$totalneeded." met!";


print("<center><table cellpadding=3 class=main border=0>".
     "<td class=row3 align=center><p align=center>".
     "<table width=220 hight=17 border=2>".
     "<td width=$Progress_so_far2% height=15 background=$pic align=center valign=middle>".
     "<span style='color: blue;'>$monthly_goal</span></td>".
     "<td style='padding: 0px; background-image: url(images/loadbar/loadbarbg.gif); background-repeat: repeat-x'>".
     "<span style='color: red;'>$monthly_goal22</span></td></tr></table>");
end_block();

// Display a form for the user to input the donation amount
if (get_user_class() >= 6) {
   begin_block(T_("ADMIN_DONATE_INPUT"));
   print("<form method='post'>");
   print("<p>Enter donation amount: <input type='text' name='donation_amount' autocomplete='off' pattern='[0-9]+' title='Whole numbers only'></p><br>");
   print("<input type='submit' value='Submit'>");
   print("   ");

   // Add a clear_donations button
   print("<input type='submit' name='clear_donations' value='Clear Donations' onclick='if (confirm(\"Are you sure you want to clear all donations?\")) { document.getElementsByName(\"confirmation\")[0].value = \"Yes\"; return true; } else { return false; }'>");
   
   // Add a hidden input field for the confirmation parameter
   print("<input type='hidden' name='confirmation' value=''>");
   print("</form>");
   print("</td></tr></table></center>");
   
   // Check if the "clear_donations" button was clicked
   if(isset($_POST['clear_donations'])) {
       // Get confirmation from the user before truncating the table
       $confirmation = $_POST['confirmation'];
   
       if ($confirmation === 'Yes') {
         // Truncate the "funds" table
         SQL_Query_exec("TRUNCATE TABLE `funds`");
     
         // Show a pop-up message to the user that the table was truncated
         echo "<script>alert('Donations were cleared.');</script>";
     } else {
         // Show a message to the user that the table was not truncated
         echo "<script>alert('Donations were <span style=\"color:red; font-weight:bold;\">NOT</span> cleared.');</script>";

     }
     
   }

}
}
end_block();
?>
donate_block.php — 2023-02-20 23:33:00 in v3 Support
thanks @Botanicar. Can you share the one you use? Also, I think to avoid the zero in date issue, shouldnt the datetime be
datetime DEFAULT NULL
donate_block.php — 2023-02-20 21:00:20 in v3 Support
is this the correct sql for that block?
CREATE TABLE funds (
 id INT NOT NULL AUTO_INCREMENT,
 cash DECIMAL(10, 2),
 month INT,
 year INT,
 PRIMARY KEY (id)
);

I dont have this block
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.">
Just wanted to post my code for "similar genre" of torrent. It is something different, and feel free to use it if you want to. This requires the IMDB mod https://torrenttrader.uk/post?id=12&page=1 . and you would also have to create a new table in the database for "genre".
SQL for genre
ALTER TABLE `torrents` ADD `genre` varchar(10) DEFAULT NULL; 

Add this to torrents-details.php somewhere
////ADD genre pulled from the IMDB and put it in the stupid database as genre
if ($row["genre"] === NULL) {
$genre = explode(',', $_data->Genre)[0];
$escapedGenre = mysqli_real_escape_string($GLOBALS["DBconnector"], $genre);
SQL_Query_exec("UPDATE `torrents` SET `genre` = '$escapedGenre' WHERE `id` = $id");
 }
 $TTCache->Set("imdb/$id", $_data, 900);
}


and then the mod
////////////// Similar Torrents mod /////////////////////
begin_frame(sprintf(T_("SIMILAR_GENRE_HEADER"), " $genre "));
$char1 = 50;
$name = htmlspecialchars($a["name"]);
$genre = htmlspecialchars($a["genre"]);
$shortname = CutName($name, $char1);
$shortgenre = CutName($genre, $char1);
$searchname = substr($name, 0, 9);
$searchgenre = substr($genre, 0, 9);
$queryname1 = str_replace(" ", ".", sqlesc("%$searchname%"));
$queryname2 = str_replace(".", " ", sqlesc("%$searchname%"));
$querygenre1 = sqlesc("$searchgenre");


$r = SQL_Query_exec("SELECT id, name, genre, size, added, seeders, leechers, category, image1
                    FROM torrents
                    WHERE (genre LIKE {$querygenre1} OR name LIKE {$queryname1} OR name LIKE {$queryname2})
                    AND (genre = (SELECT genre FROM torrents WHERE id = '$id') OR name = (SELECT name FROM torrents WHERE id = '$id'))
                    AND seeders > '0' AND id <> '$id'
                    ORDER BY RAND() DESC
                    LIMIT 5");


   if (mysqli_num_rows($r) > 0) {
           echo "<table width=100% class=main border=1 cellspacing=0 cellpadding=0 class=table_table>\n" . "
           <tr>
                   <td class='table_head' width='20'>Type</td>
                   <td class='table_head'>Name</td>
<td class='table_head' align='center'>Genre</td>
                   <td class='table_head' align='center'>Size</td>
                   <td class='table_head' align='center'>Added</td>
                   <td class='table_head' align='center'>S</td>
                   <td class='table_head' align='center'>L</td></tr>\n";
 
   while ($a = mysqli_fetch_assoc($r)) {
         $r2 = SQL_Query_exec("SELECT name, image FROM categories WHERE id=$a[category]");
         $a2 = mysqli_fetch_assoc($r2);
           $cat = "<img class=glossy src=\"images/categories/$a2[image]\" alt=\"$a2[name]\" title=\"$row[cat_parent] : $row[cat_name]\"\>";
           $name = $a["name"];
 
           echo"<tr><td class='table_col1' style='padding: 1px' align='center'>$cat</td>
                    <td class='table_col1'><a title=".$a["name"]." href=torrents-details.php?id=" . $a["id"] . "&hit=1><b>" . CutName(htmlspecialchars($a["name"]), $char1) . "</b><br/></a></td>
<td class='table_col1' style='padding: 1px' align='center'>$a[genre]</td>
                    <td class='table_col1' style='padding: 1px' align='center'>" . mksize($a['size']) . "</td>
                    <td class='table_col1' style='padding: 1px' align='center'>$a[added]</td>
                    <td class='table_col1' style='padding: 1px' align='center'><span style='color:Chartreuse'>$a[seeders]</span></td>
                    <td class='table_col1' style='padding: 1px' align=center><span style='color:red'>$a[leechers]</span></td></tr>\n";
   }
     
   echo "</table>";
     
   }
               else {
                   print(T_("NO_SIMILAR_TORRENT_FOUND"));
               }
end_frame();
////////////// End Similar Torrents mod /////////////////////

language file
$LANG["SIMILAR_GENRE_HEADER"] = "Similar torrents in the %s category";
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