<?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> <?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);
?> 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 ();
} $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();
} // 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); $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;
?> 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>';
}