$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);
} <?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();
?> $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/"; $username = $CURUSER['username'];$uploadPath = $currentDirectory . $uploadDirectory . $username . '_' . basename($fileName);<?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();
?>
datetime DEFAULT NULL CREATE TABLE funds (
id INT NOT NULL AUTO_INCREMENT,
cash DECIMAL(10, 2),
month INT,
year INT,
PRIMARY KEY (id)
);
<input type="text" name="seedbonus" autocomplete="off" size="20" pattern="\d*" title="Only numbers are allowed."> ALTER TABLE `torrents` ADD `genre` varchar(10) DEFAULT NULL; ////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);
}////////////// 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 /////////////////////$LANG["SIMILAR_GENRE_HEADER"] = "Similar torrents in the %s category";