mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-24 12:07:23 +08:00
downhash
This commit is contained in:
+2
-1
@@ -38,6 +38,7 @@ if (!$row) {
|
||||
) {
|
||||
permissiondenied();
|
||||
} else {
|
||||
$torrentRep = new \App\Repositories\TorrentRepository();
|
||||
$torrentUpdate = [];
|
||||
if (!empty($_GET["hit"])) {
|
||||
$torrentUpdate[] = 'views = views + 1';
|
||||
@@ -127,7 +128,7 @@ if (!$row) {
|
||||
else $download = "";
|
||||
|
||||
tr($lang_details['row_action'], $download. ($owned == 1 ? "<$editlink><img class=\"dt_edit\" src=\"pic/trans.gif\" alt=\"edit\" /> <b><font class=\"small\">".$lang_details['text_edit_torrent'] . "</font></b></a> | " : ""). (get_user_class() >= $askreseed_class && $row['seeders'] == 0 ? "<a title=\"".$lang_details['title_ask_for_reseed']."\" href=\"takereseed.php?reseedid=$id\"><img class=\"dt_reseed\" src=\"pic/trans.gif\" alt=\"reseed\"> <b><font class=\"small\">".$lang_details['text_ask_for_reseed'] ."</font></b></a> | " : "") . "<a title=\"".$lang_details['title_report_torrent']."\" href=\"report.php?torrent=$id\"><img class=\"dt_report\" src=\"pic/trans.gif\" alt=\"report\" /> <b><font class=\"small\">".$lang_details['text_report_torrent']."</font></b></a>", 1);
|
||||
tr($lang_details['torrent_dl_url'],sprintf('<a title="%s" href="%s/download.php?id=%u&passkey=%s">%s</a>',$lang_details['torrent_dl_url_notice'],getSchemeAndHttpHost(),$id,$CURUSER['passkey'], $lang_details['torrent_dl_url_text']),1);
|
||||
tr($lang_details['torrent_dl_url'],sprintf('<a title="%s" href="%s/download.php?downhash=%s">%s</a>',$lang_details['torrent_dl_url_notice'], getSchemeAndHttpHost(), $torrentRep->encryptDownHash($row['id'], $CURUSER), $lang_details['torrent_dl_url_text']),1);
|
||||
|
||||
// ---------------- start subtitle block -------------------//
|
||||
$r = sql_query("SELECT subs.*, language.flagpic, language.lang_name FROM subs LEFT JOIN language ON subs.lang_id=language.id WHERE torrent_id = " . sqlesc($row["id"]). " ORDER BY subs.lang_id ASC") or sqlerr(__FILE__, __LINE__);
|
||||
|
||||
+20
-7
@@ -1,15 +1,25 @@
|
||||
<?php
|
||||
require_once("../include/bittorrent.php");
|
||||
dbconn();
|
||||
$id = (int)$_GET["id"];
|
||||
if (!$id)
|
||||
httperr();
|
||||
$passkey = $_GET['passkey'] ?? '';
|
||||
if ($passkey){
|
||||
$res = sql_query("SELECT * FROM users WHERE passkey=". sqlesc($passkey)." LIMIT 1");
|
||||
|
||||
if (!empty($_REQUEST['downhash'])){
|
||||
$torrentRep = new \App\Repositories\TorrentRepository();
|
||||
try {
|
||||
$params = $torrentRep->decryptDownHash($_REQUEST['downhash']);
|
||||
} catch (\Exception $exception) {
|
||||
do_log("downhash: " . $_REQUEST['downhash'] . " invalid: " . $exception->getMessage());
|
||||
die("invalid downhash, decrypt fail");
|
||||
}
|
||||
if ($params['date'] != date('Ymd')) {
|
||||
die("invalid downhash, expires");
|
||||
}
|
||||
$id = $params['id'];
|
||||
$uid = $params['uid'];
|
||||
|
||||
$res = sql_query("SELECT * FROM users WHERE id=". sqlesc($uid)." LIMIT 1");
|
||||
$user = mysql_fetch_array($res);
|
||||
if (!$user)
|
||||
die("invalid passkey");
|
||||
die("invalid downhash, payload invalid");
|
||||
elseif ($user['enabled'] == 'no' || $user['parked'] == 'yes')
|
||||
die("account disabed or parked");
|
||||
$oldip = $user['ip'];
|
||||
@@ -18,6 +28,9 @@ if ($passkey){
|
||||
}
|
||||
else
|
||||
{
|
||||
$id = (int)$_GET["id"];
|
||||
if (!$id)
|
||||
httperr();
|
||||
loggedinorreturn();
|
||||
parked();
|
||||
$letdown = intval($_GET['letdown'] ?? 0);
|
||||
|
||||
Reference in New Issue
Block a user