diff --git a/library/includes/functions.php b/library/includes/functions.php index da2b6faaf..a265810f6 100644 --- a/library/includes/functions.php +++ b/library/includes/functions.php @@ -2066,6 +2066,8 @@ function hash_search($hash) bb_die(sprintf($lang['HASH_INVALID'], $hash)); } + $info_hash = DB()->escape(pack('H*', $hash)); + // Check info_hash version if (mb_strlen($hash, 'UTF-8') == 40) { $info_hash_where = "WHERE info_hash = '$info_hash'"; @@ -2075,8 +2077,6 @@ function hash_search($hash) bb_die(sprintf($lang['HASH_INVALID'], $hash)); } - $info_hash = DB()->escape(pack('H*', $hash)); - if ($row = DB()->fetch_row("SELECT topic_id FROM " . BB_BT_TORRENTS . " $info_hash_where")) { redirect(TOPIC_URL . $row['topic_id']); } else {