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

oh, I apparently already updated github a while back for sql security on the username and password. https://github.com/MicrosoulV3/TorrentTrader-v3
unsure. Here is my entire login page. I use recaptcha and IP checks, but you can ignore that and see if you can mix and match some code to fit your needs. My HTML is different, so just look at the code and see if anything is useful for you. I dont knwo why you would see a blank page. I tested it and that isnt what I saw, but I am using custom code, so things may not match up always. This also has my terrible attempt at password visibility toggle. I like yours better. I will play with that more when I have more time.
<?php
//crap mainly. filter username and pass. Prepare, bind and other assorted stupid shit
require_once("backend/functions.php");
dbconn();
session_start();

$site_config["LEFTNAV"] = $site_config["MIDDLENAV"] = $site_config["RIGHTNAV"] = false;

if (isset($_POST["username"]) && isset($_POST["password"])) {
   if (!empty($_POST["username"]) && !empty($_POST["password"])) {
       $username = filter_var($_POST["username"], FILTER_SANITIZE_STRING);
       $password = filter_var($_POST["password"], FILTER_SANITIZE_STRING);
       $password_hash = passhash($password);

$stmt = $GLOBALS["DBconnector"]->prepare("SELECT id, password, secret, status, enabled FROM users WHERE username = ? LIMIT 1");
$stmt->bind_param("s", $username);
$stmt->execute();

if ($stmt->error) {
die("Query failed: " . $stmt->error);
}

$res = $stmt->get_result();
$row = $res->fetch_assoc();

if ($row) {
if ($row["password"] !== $password_hash) {
$message = T_("LOGIN_INCORRECT");
} elseif ($row["status"] === "pending") {
$message = T_("ACCOUNT_PENDING");
} elseif ($row["enabled"] === "no") {
$message = T_("ACCOUNT_DISABLED");
} else {
// CAPTCHA validation
if (isset($_POST['g-recaptcha-response'])) {
$captcha = $_POST['g-recaptcha-response'];
if (!$captcha) {
echo "<script>alert('Please Check the Captcha box');</script>";
} else {
$secretKey = $site_config['SECRET'];
$ip = $_SERVER['REMOTE_ADDR'];
$response = file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=$secretKey&response=$captcha&remoteip=$ip");
$response = json_decode($response);

if ($response->success === true) {
// Login successful
logincookie($row["id"], $row["password"], $row["secret"]);

// IP history edits
$now = get_date_time();
$stmt = $GLOBALS["DBconnector"]->prepare("INSERT INTO iplog (ip, userid, added, lastused) VALUES (?, ?, ?, ?) ON DUPLICATE KEY UPDATE timesused=timesused+1, lastused=?");
$stmt->bind_param("sissi", getip(), $row["id"], $now, $now, $now);
$stmt->execute();

if (!empty($_POST["returnto"])) {
header("Location: " . $_POST["returnto"]);
} else {
header("Location: index.php");
}
die();
} else {
echo "<script>alert('CAPTCHA_INVALID');</script>";
}
}
} else {
echo "<script>alert('CAPTCHA_MISSING');</script>";
}

}
} else {
$message = T_("LOGIN_INCORRECT");
}
} else {
$message = T_("NO_EMPTY_FIELDS");
}

if ($message) {
show_error_msg(T_("ACCESS_DENIED"), $message, 1);
}
}

logoutcookie();
?>


<!DOCTYPE html>
<html lang="en">
<head>
   <meta charset="UTF-8">
   <meta name="viewport" content="width=device-width, initial-scale=1.0">
   <title><?php echo $site_config['SITENAME']; ?></title>
   <link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">
   <link rel="stylesheet" type="text/css" href="css/fontawesome-all.min.css">
   <link rel="stylesheet" type="text/css" href="css/iofrm-style.css">
   <link rel="stylesheet" type="text/css" href="css/iofrm-theme14.css">
   <style>
       body {
           min-height: 100vh;
       }
   </style>
</head>
<body>
   <div class="form-body" class="container-fluid">
       <div class="row">
           <div class="form-holder">
               <div class="form-content">
                   <div class="form-items">
                       <div class="website-logo-inside">
                           <a href="index.html">
                           </a>
                       </div>
                       <h3>Please log in to your account.</h3>
                       <div class="page-links">
                           <a href="account-login.php" class="active">Login</a>
                           <a href="account-signup.php">Register</a>
                           <a href="account-recover.php">Recover Account</a>
                           <!-- <a href="contact.php">Contact us with problems</a> -->
                       </div>
                       <form method="post" action="account-login.php">
                           <input class="form-control" type="text" name="username" placeholder="Username" required>
                           <div class="password-container">
                               <input class="form-control" type="password" name="password" id="password" placeholder="Password" required>
                               <button type="button" id="togglePassword" class="password-toggle-btn" onclick="togglePasswordVisibility()">
                                   Show
                               </button>
                           </div>
                           <center><div class="g-recaptcha" data-theme="light" data-sitekey="<?php echo $site_config['SITEKEY']; ?>"></div></center>
                           <?php
                           if (!empty($_REQUEST["returnto"])) {
                               print("<input type=\"hidden\" name=\"returnto\" value=\"" . cleanstr($_REQUEST["returnto"]) . "\" />\n");
                           }
                           ?>
                           <div class="form-button">
                               <button id="submit" type="submit" class="ibtn">Login</button>
                           </div>
                       </form>
                   </div>
               </div>
           </div>
       </div>
   </div>

   <script type="text/javascript" src="js/jquery.min.js"></script>
   <script type="text/javascript" src="js/popper.min.js"></script>
   <script type="text/javascript" src="js/bootstrap.min.js"></script>
   <script type="text/javascript" src="js/main.js"></script>
   <script src="https://www.google.com/recaptcha/api.js" async defer></script>
<script>
   function togglePasswordVisibility() {
       var passwordInput = document.getElementById("password");
       var toggleButton = document.getElementById("togglePassword");

       if (passwordInput.type === "password") {
           passwordInput.type = "text";
           toggleButton.textContent = "Hide";
       } else {
           passwordInput.type = "password";
           toggleButton.textContent = "Show";
       }
   }
</script>
</body>
</html>
thats pretty nice Botanicar. I need to try this. Just for fun tho, since I do this in mine, do you think filtering username and password is good? I do it on mine, so I figured I would post this. I think its correct. Mine has more code than the original, but I think I inserted what is correct for this specific code. If Im wrong, let me know. Just wanted to add some help to this code for filtering username and pass for more security I think
<?php

#================================#
#       TorrentTrader 3.00       #
#  https://torrenttrader.uk      #
#--------------------------------#
#       Modified by Botanicar    #
#================================#

require_once("backend/functions.php");
dbconn();

if (isset($_POST["username"]) && isset($_POST["password"])) {
   if (!empty($_POST["username"]) && !empty($_POST["password"])) {
       $username = filter_var($_POST["username"], FILTER_SANITIZE_STRING);
       $password = filter_var($_POST["password"], FILTER_SANITIZE_STRING);
       $password_hash = passhash($password);

$stmt = $GLOBALS["DBconnector"]->prepare("SELECT id, password, secret, status, enabled FROM users WHERE username = ? LIMIT 1");
$stmt->bind_param("s", $username);
$stmt->execute();

if ($stmt->error) {
die("Query failed: " . $stmt->error);
}

$res = $stmt->get_result();
$row = $res->fetch_assoc();

if ($row) {
if ($row["password"] !== $password_hash) {
$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"], $_POST["remember"]);
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 ($nowarn)
show_error_msg("Error", $nowarn, 0);
?>
Icon on file list — 2023-06-26 20:42:10 in Old v2 Tpoics
yea, I noticed that when you click on the forum, it takes you to the first page then you have to click the next page to see the latest posts. The code I have posted a few posts up works perfectly and its fast and covers anything you want to add. I even added code in there to know if you have rar files in a tree, like .r00, .r01, etc, you've seen them before, its a bit more old school raring, but they still exist sometimes
Icon on file list — 2023-06-25 02:25:14 in Old v2 Tpoics
heres some icons. I was going through files and I thought I should share these in case they are useful to someone. These match with my code above
Server Load help — 2023-06-05 21:59:37 in General Chat
there can be many reasons for that, no way to pinpoint specifically. That amount isnt high, but it seems you only have 4GB total. If you have a dual channel board, installing more RAM to atleast 16GB would be best
Ajax Shoutbox V3 — 2023-05-27 18:03:16 in v3 Mods in Progress
this was the original code. It used to be mysql_result which is no longer a function, so I researched a fix, which is
function mysqli_result($res,$row=0,$col=0){
   $numrows = mysqli_num_rows($res);
   if ($numrows && $row <= ($numrows-1) && $row >=0){
       mysqli_data_seek($res,$row);
       $resrow = (is_numeric($col)) ? mysqli_fetch_row($res) : mysqli_fetch_assoc($res);
       if (isset($resrow[$col])){
           return $resrow[$col];
       }
   }
   return false;
}


      $query = SQL_Query_exec ("SELECT id FROM users WHERE username = " . sqlesc ($Data));
     if (0 < mysqli_num_rows ($query))
     {
       $Userid = mysqli_result ($query, 0, 'id');  
       (SQL_Query_exec ("delete from ajshoutbox where uid = " . sqlesc ($Userid)) OR sqlerr (__FILE__, 293));
       execcommand_message ();
     }
Ajax Shoutbox V3 — 2023-05-25 23:28:27 in v3 Mods in Progress
removed mysqli_result (the original quick-fix) in getshout.php
      $query = SQL_Query_exec("SELECT id FROM users WHERE username = " . sqlesc($Data));

     if (mysqli_num_rows($query) > 0) {
       $row = mysqli_fetch_assoc($query);
       $Userid = $row['id'];
       (SQL_Query_exec("DELETE FROM ajshoutbox WHERE uid = " . sqlesc($Userid)) OR sqlerr(__FILE__, 293));
       execcommand_message();
     }
New getip function — 2023-05-21 19:58:27 in v3 Support
cool. Thanks for sharing
Server Load help — 2023-05-21 14:51:44 in General Chat
seems to work fine on ubuntu. Im not sure why it dont work for you. I used this code as a block.
Database error — 2023-04-21 10:51:27 in v3 Support
ahh, I see that, I missed that enum part. Try removing the (int) to make it $sort = $_POST["sort"];
Database error — 2023-04-20 22:34:00 in v3 Support
int is correct for the auto_increment. If his code is being truncated, then he is exceeding the data int(10) being inserted into $sort somehow. It just leads me back to turning off mysql strict mode. Doing that usually fixes almost every single problem in v3
Database error — 2023-04-19 21:29:16 in v3 Support
I think its more the no zero date thing honestly, but I did null the datetime in TTv3, but some other things may still have an issue, I cant remember, I just know it was just good practice to set you whole DB to no engine substitution only with no other things
Database error — 2023-04-19 10:36:33 in v3 Support
by default, if I remember correctly, there are several modes set, like no engine substitution, no zero in date, etc, yo just want it to one be set at no engine subs.
Database error — 2023-04-18 22:48:21 in v3 Support
make sure mysql strict mode is turned off it should be NO_ENGINE_SUBSTITUTION, run the check file, I updated it to include a sql mode check
I found out that if you use this in your project in multiple places, meaning you have this php command executing in your code, they will clash with each other and throw your timestamps off and make your head spin. If you want to use this command in a separate file for some part of your project, do this in the new part of your code that you want a different timezone displayed or used and it wont interfere with your main datetime
// Store original timezone
$original_timezone = date_default_timezone_get();

// Set the new timezone to use in this block of project code
date_default_timezone_set('America/New_York'); // Change to fit your needs

// Execute the block of code that uses the new timezone
$local_time = date('M d, Y - g:i a');  // Adjust to what format you prefer
echo "<b>Local Server Time: </b>" . $local_time . "<br /><hr />"; // This is what I used it for, adjust accordingly.

// Restore the original timezone back to not interfere with other timezone functions
date_default_timezone_set($original_timezone);
IMDb Mod [TTv3] — 2023-03-27 23:06:59 in v3 Mods Completed
I didnt think it would a drop in replacement for anything. You can reference it, and see what I did on this file, and adjust using snippets for your specific needs rather than rewriting it. Its hard for me to take my custom code and downgrade it to match clean code for easy use, all I can do is provide the raw code and maybe some help as you go if I can. There are some things that are semi original, but alot of things that are not. I appologise and I hope you can get it working. Here is my full torrents-details page. https://pastebin.com/CVdvdkkB One thing you can try if you want to, is download my older micro edition. It has alot of this already done, and I can help with my updated edits, since I have done quite a bit since I shared that. But that copy is still available on sourceforge. Check the downloads area for TTv3
IMDb Mod [TTv3] — 2023-03-26 19:22:32 in v3 Mods Completed
not sure if this helps, but heres my entire code. lIke I mentioned, mine is custom, but its reasonably similar
$TTIMDB = new TTIMDB;

if ((($_data = $TTCache->Get("imdb/$id", 900)) === false) && ($_data = $TTIMDB->Get($row['imdb'])))
{
        $_data->Poster = $TTIMDB->getImage($_data->Poster, $id);
// $updateset[] = "image1 = " . sqlesc($image);

        if ( ! isset( $_data->imdbTime ) )
        {
                $_data->imdbTime = time();
               
                $_data->Alias = 'N/A';
               
                $_data->imdbVideo = null;
        }


//SQL_Query_exec("UPDATE `torrents` SET `image1` = '" . $_data->Poster . "' WHERE `id` = $id");
// below is how the posters get added to the image 1 of the imdb
         if (($imdb_image = $TTIMDB->getImage_1($_data->Poster, $site_config['torrent_dir'] . "/images/", $id))) {
           SQL_Query_exec("UPDATE `torrents` SET `image1` = '" . $imdb_image . "' WHERE `id` = $id");
 }

/////ADD a description pulled from the IMDB plot and put it in mysql as the descr
if ($row['descr'] === DEFAULT_DESCRIPTION) {
$stmt = $GLOBALS['DBconnector']->prepare('UPDATE `torrents` SET `descr` = ? WHERE `id` = ?');
$stmt->bind_param('si', $_data->Plot, $id);
$stmt->execute();
$stmt->close();
}

////ADD genre pulled from the IMDB and put it in the stupid database as genre
if (is_null($row["genre"])) {
   $genre = explode(',', $_data->Genre)[0];
   $stmt = $GLOBALS["DBconnector"]->prepare("UPDATE `torrents` SET `genre` = ? WHERE `id` = ?");
   $stmt->bind_param("si", $genre, $id);
   $stmt->execute();
$stmt->close();
}
// 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);
}

/////IMDB details layout
if ( is_object($_data) ): ?>
<fieldset class="download">
<legend><b><?php echo T_("IMDB_SHORT"); ?> - <?php echo $_data->Title; ?></b></legend>                                                          
<table border="0" cellpadding="3" cellspacing="2" width="100%">
<tr>
        <td width="230"><img src="<?php echo $_data->Poster; ?>" class="youtube" alt="<?php echo $_data->Title; ?>" title="<?php echo $_data->Title; ?>" height="317px" width="214px" /></td>
        <td valign="top">
        <b><?php echo T_("IMDB_LINK"); ?></b><br /> <a href="<?php echo $row['imdb']; ?>" target="_blank"><?php echo htmlspecialchars($row['imdb']); ?></a><br /><br />
        <b><?php echo T_("IMDB_RATED"); ?></b><br /> <?php echo $TTIMDB->getRated( $_data->Rated ); ?><br /><br />  
        <b><?php echo T_("IMDB_RELEASED"); ?></b><br /> <?php echo $TTIMDB->getReleased($_data->Released); ?><br /><br />
        <b><?php echo T_("IMDB_YEAR"); ?></b><br /> <?php echo $_data->Year; ?><br /><br />
        <b><?php echo T_("IMDB_RUNTIME"); ?></b><br /> <?php echo $_data->Runtime; ?><br /><br />
        <b><?php echo T_("IMDB_GENRE"); ?></b><br /> <?php echo $_data->Genre; ?><br /><br />
        <b><?php echo T_("IMDB_DIRECTOR"); ?></b><br /> <?php echo $_data->Director; ?><br /><br />
        <b><?php echo T_("IMDB_WRITER"); ?></b><br /> <?php echo $_data->Writer; ?><br /><br />
        <b><?php echo T_("IMDB_ACTORS"); ?></b><br /> <?php echo $_data->Actors; ?><br /><br />
        <b><?php echo T_("IMDB_PLOT"); ?></b><br /> <?php echo $_data->Plot; ?>
        </td>
<!-- below is commented to only use the star images. If reversing, dont forget to remove one endif; located below -->
        <!-- <?php // if  (($rating = $TTIMDB->getRating($_data->imdbRating)) !== null): ?>
        <td valign="top" align="right">
<?php /*?>         <?php echo $rating; ?><br />
<?php */?>
<b><?php echo T_("IMDB_RATING"); ?></b> <?php echo $_data->imdbRating; ?><br />
        <br />
        <b><?php echo T_("IMDB_VOTES"); ?></b> <?php echo $_data->imdbVotes; ?><br /><br /><b><b> -->
<!-- end comments -->

<?php $imdb_star = ("/images/imdb/imdb_gold_star.png"); ?>
        <td valign="top" align="right">
        <?php echo '<div style="font-size:2.75em;font-weight:bold;"><img width="60" height="60" style="vertical-align:middle" src='.$imdb_star.'>'.$_data->imdbRating.'</div>'?>
        <b><?php echo T_("IMDB_VOTES"); ?></b> <?php echo $_data->imdbVotes; ?><br /><br /><b><b>

<!--trailer code for both IMDB and traileraddicts -->
       
<style>
.tablet {
   width:488px;
   height: 326px;
   background-size: 100% 100%;
   background-repeat: no-repeat;
   background-image: url(images/imdb/tv.png)  
}

.tablet iframe {
 position: relative;
 top: 34px;
 left: 0px;
 width: 442px;
 height: 235px;
 border: 0 none;
 }
</style>

        <?php

  if ($row["trailers"]) { //eg: https://www.imdb.com/video/vi612877081?playlistId=tt7991608
$IMDBurl = $row["trailers"];
$trailer = explode('/', $IMDBurl);
$video2 = strtok($trailer[4],'?');
?>
      <div class="tablet">
  <center><iframe src="https://www.imdb.com/videoembed/<?php echo $video2; ?>"></iframe></center><br />
</div><?php
  }
   else {
$imdb_image = ("/images/imdb_trailers.png");
echo '<p valign="top" align="right"><img width="271" height="159" src='.$imdb_image.'></p>';
echo '<p align="center">'.'<br><br>'.'</p>';  
}
/*
$string=$_data->imdbID;
$string=substr($string,2);
$trailerkey = $site_config['TRAILERADDICT'];
$upcoming = simplexml_load_file("http://api.traileraddict.com/?imdb=".$string."&count=1&width=480&k=".$trailerkey."");

foreach($upcoming->trailer as $x => $updates)
{

echo '<p valign="top" align="left">'.$updates->embed.'</p>';
echo '<p valign="top" align="right">'.$updates->title.'</p>';
echo '<p align="center">'.'<br><br>'.'</p>';  
   }} */
/////end trailer code

   ?>
        </b></b>
        </td>

</tr>
<tr>
        <td align="right" colspan="3">
        <b><?php echo T_("IMDB_LASTUPDATED"); ?></b> <i><?php echo $TTIMDB->getUpdated($_data->imdbTime); ?></i>
        </td>
</tr>
</table>
</fieldset><br />

<?php  endif;
?>
IMDb Mod [TTv3] — 2023-03-26 17:13:00 in v3 Mods Completed
It would be something like this. you need a trailer table in the database that you would post the imdb video url into. There is no way that I know to pull any trailers from the OMDB, so your var $_data->imdbVideo has no value. My code is custom all over the place so its kind of hard to show you exactly what I've done, but this will get you going
   if ($row["trailers"]) { //eg: https://www.imdb.com/video/vi612877081?playlistId=tt7991608
$IMDBurl = $row["trailers"];
$trailer = explode('/', $IMDBurl);
$video2 = strtok($trailer[4],'?');
?>
      <div class="tablet">
  <center><iframe src="https://www.imdb.com/videoembed/<?php echo $video2; ?>"></iframe></center><br />
</div><?php
  }
   else {
$imdb_image = ("/images/imdb_trailers.png");
echo '<p valign="top" align="right"><img width="271" height="159" src='.$imdb_image.'></p>';
echo '<p align="center">'.'<br><br>'.'</p>';  
}
Script for upload — 2023-03-24 19:53:39 in General Chat
the only one I am familiar with is janhouse, but I dont have it.  I believe its a paid script
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