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

TT v 3.8.3 FINAL — 2026-11-29 11:28:37 in Download
Looks GREAT!
Congratulations!
Thank you to fozshell for sharing this mod, to MasterRoot at TBDev for the original hack, and to Daffy, walker1977, mostvotedplaya, spiritblue and Noname12 for the fixes and ideas in this topic. It is still a very useful addition after all these years.

Here is an updated version for PHP 8 that brings the fixes from all five pages together. Please take a backup of your files and database first.

Sending, answering, marking as answered and deleting were tested on PHP 8.5 with MariaDB 10.10 using a staff account. The check that keeps regular members out of staffbox.php was only reviewed in the code, so please try that with a test account.

What changed
- mysql_* calls, short open tags, $HTTP_POST_VARS, stderr, sqlerr and TYPE=MYISAM are gone
- Moderators and Super Moderators can use the staff box, because it checks the class and no longer depends on the Admin CP permission
- Staff can get a notice on the home page while messages are waiting, as requested earlier in this topic
- Unanswered messages no longer cause a query error on the empty answeredby value
- Messages from deleted members stay visible instead of disappearing from the list
- SQL injection through setanswered and the answer fields is closed, and subjects and names are escaped
- Marking and deleting now need a form submit, so a plain link cannot trigger them
- A double click or page refresh no longer sends the same message twice
- All language keys start with SC_, so they cannot change text elsewhere on the site

run SQL
CREATE TABLE IF NOT EXISTS `staffmessages` (
 `id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
 `sender` INT UNSIGNED NOT NULL DEFAULT 0,
 `added` DATETIME NULL DEFAULT NULL,
 `msg` TEXT NULL,
 `subject` VARCHAR(100) NOT NULL DEFAULT '',
 `answeredby` INT UNSIGNED NOT NULL DEFAULT 0,
 `answered` TINYINT(1) NOT NULL DEFAULT 0,
 `answer` TEXT NULL,
 KEY `answered` (`answered`)
) ENGINE=MyISAM;


Save this as contactstaff.php in your root
<?php
// Contact Staff: members write to the staff. Handled by takecontact.php and answered in staffbox.php.
// Hack by MasterRoot, edited for TorrentTrader by foz, with fixes from the community. Updated for PHP 8.

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

stdhead(T_("SC_TITLE"));
begin_frame(T_("SC_TITLE"));
?>
<p><?php echo T_("SC_INTRO"); ?></p>
<form method="post" action="takecontact.php">
   <p><label><?php echo T_("SC_SUBJECT"); ?><br /><input type="text" name="subject" size="60" maxlength="100" required /></label></p>
   <p><label><?php echo T_("SC_MESSAGE"); ?><br /><textarea name="msg" rows="12" style="width:100%" required></textarea></label></p>
   <input type="submit" value="<?php echo T_("SC_SEND"); ?>" />
</form>
<?php
end_frame();
stdfoot();
?>


Save this as takecontact.php in your root
<?php
// Contact Staff: saves a member's message for the staff. Updated for PHP 8.

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

if ($_SERVER["REQUEST_METHOD"] !== "POST") {
   header("Location: contactstaff.php");
   exit;
}

$subject = trim((string) ($_POST["subject"] ?? ""));
$msg = trim((string) ($_POST["msg"] ?? ""));

if ($subject === "" || $msg === "") {
   show_error_msg(T_("ERROR"), T_("SC_FILL_IN_BOTH"), 1);
}

$sender = (int) $CURUSER["id"];
$subject = substr($subject, 0, 100);

// a double click or page refresh does not send it twice
$since = get_date_time(time() - 600);
$same = mysqli_fetch_row(SQL_Query_exec("SELECT COUNT(*) FROM staffmessages WHERE sender = $sender AND subject = " . sqlesc($subject) . " AND added > '$since'"));
if (!$same || (int) $same[0] === 0) {
   SQL_Query_exec("INSERT INTO staffmessages (sender, added, msg, subject) VALUES ($sender, '" . get_date_time() . "', " . sqlesc($msg) . ", " . sqlesc($subject) . ")");
}

autolink("index.php", T_("SC_SENT"));
?>


Save this as staffbox.php in your root
Staff are class 5 and up on a default install; change SC_STAFF_CLASS at the top if yours differ.
<?php
//===========================================================================
// DO NOT EDIT THIS OUT
// Created by foz www.basslinebeats.co.uk foz@basslinebeats.co.uk
// Based on the hack by MasterRoot. Updated for PHP 8.
//===========================================================================

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

// lowest class that can read and answer messages to the staff
const SC_STAFF_CLASS = 5;

if ((int) get_user_class() < SC_STAFF_CLASS) {
   show_error_msg(T_("ERROR"), T_("SC_NOT_ALLOWED"), 1);
}

function sc_e($value) {
   return htmlspecialchars((string) $value, ENT_QUOTES);
}

function sc_user($id, $name) {
   return $name !== null ? "<a href='account-details.php?id=" . (int) $id . "'><b>" . sc_e($name) . "</b></a>" : "-";
}

function sc_ids($value) {
   return array_values(array_filter(array_map("intval", (array) $value)));
}

// ---- form actions
if ($_SERVER["REQUEST_METHOD"] === "POST") {
   $staff = (int) $CURUSER["id"];
   $do = (string) ($_POST["do"] ?? "");

   if ($do === "answer") {
       $id = (int) ($_POST["id"] ?? 0);
       $answer = trim((string) ($_POST["answer"] ?? ""));
       $row = mysqli_fetch_assoc(SQL_Query_exec("SELECT m.*, u.username FROM staffmessages m LEFT JOIN users u ON u.id = m.sender WHERE m.id = $id"));
       if (!$row || $answer === "") show_error_msg(T_("ERROR"), T_("SC_FILL_IN_ANSWER"), 1);

       SQL_Query_exec("UPDATE staffmessages SET answered = 1, answeredby = $staff, answer = " . sqlesc($answer) . " WHERE id = $id");
       if ($row["username"] !== null) {
           $pm = "
" . $row["username":
. "]" . $row["msg"] . "
\n" . $answer . "\n\n" . T_("SC_REGARDS");
           SQL_Query_exec("INSERT INTO messages (sender, receiver, added, subject, msg, poster) VALUES ($staff, " . (int) $row["sender"] . ", '" . get_date_time() . "', " . sqlesc("Re: " . $row["subject"]) . ", " . sqlesc($pm) . ", $staff)");
       }
       autolink("staffbox.php?action=viewpm&pmid=$id", T_("SC_ANSWER_SENT"));
   }

   $ids = sc_ids($_POST["ids"] ?? array());
   if (($do === "mark" || $do === "delete") && !$ids) {
       show_error_msg(T_("ERROR"), T_("SC_NOTHING_SELECTED"), 1);
   }
   if ($do === "mark") {
       SQL_Query_exec("UPDATE staffmessages SET answered = 1, answeredby = $staff WHERE answered = 0 AND id IN (" . implode(",", $ids) . ")");
       autolink("staffbox.php", T_("SC_MARKED"));
   }
   if ($do === "delete") {
       SQL_Query_exec("DELETE FROM staffmessages WHERE id IN (" . implode(",", $ids) . ")");
       autolink("staffbox.php", T_("SC_DELETED"));
   }
}

// ---- one message
if (($_GET["action"] ?? "") === "viewpm") {
   $id = (int) ($_GET["pmid"] ?? 0);
   $row = mysqli_fetch_assoc(SQL_Query_exec("SELECT m.*, s.username AS sender_name, a.username AS answer_name FROM staffmessages m LEFT JOIN users s ON s.id = m.sender LEFT JOIN users a ON a.id = m.answeredby WHERE m.id = $id"));

   stdhead(T_("SC_BOX_TITLE"));
   begin_frame(T_("SC_BOX_TITLE"));
   if (!$row) {
       echo "<p>" . T_("SC_NOT_FOUND") . "</p>";
   } else {
       ?>
       <table class="table_table" cellpadding="5" width="100%">
           <tr><th class="table_head" colspan="2"><?php echo sc_e($row["subject"]); ?></th></tr>
           <tr><td class="table_col1" width="140"><b><?php echo T_("SC_FROM"); ?></b></td><td class="table_col2"><?php echo sc_user($row["sender"], $row["sender_name"]); ?> &middot; <?php echo sc_e(utc_to_tz((string) $row["added"])); ?></td></tr>
           <tr><td class="table_col1"><b><?php echo T_("SC_MESSAGE"); ?></b></td><td class="table_col2"><div><?php echo format_comment((string) $row["msg"]); ?></div></td></tr>
           <tr><td class="table_col1"><b><?php echo T_("SC_STATUS"); ?></b></td><td class="table_col2"><?php
               echo $row["answered"] ? "<b style='color:green'>" . T_("SC_ANSWERED") . "</b> &middot; " . sc_user($row["answeredby"], $row["answer_name"]) : "<b style='color:red'>" . T_("SC_WAITING") . "</b>";
           ?></td></tr>
           <?php if ((string) $row["answer"] !== "") { ?>
           <tr><td class="table_col1"><b><?php echo T_("SC_ANSWER"); ?></b></td><td class="table_col2"><div><?php echo format_comment((string) $row["answer"]); ?></div></td></tr>
           <?php } ?>
           <?php if (!$row["answered"]) { ?>
           <tr><td class="table_col1"><b><?php echo T_("SC_REPLY"); ?></b></td><td class="table_col2">
               <form method="post" action="staffbox.php">
                   <input type="hidden" name="do" value="answer" /><input type="hidden" name="id" value="<?php echo $id; ?>" />
                   <textarea name="answer" rows="10" style="width:100%" required></textarea>
                   <div><a href="tags.php"><?php echo T_("SC_BBCODE_ALLOWED"); ?></a></div>
                   <input type="submit" value="<?php echo T_("SC_SEND_ANSWER"); ?>" />
               </form>
           </td></tr>
           <?php } ?>
       </table>
       <form method="post" action="staffbox.php">
           <input type="hidden" name="ids[]" value="<?php echo $id; ?>" />
           <?php if (!$row["answered"]) { ?><button type="submit" name="do" value="mark"><?php echo T_("SC_MARK_ANSWERED"); ?></button><?php } ?>
           <button type="submit" name="do" value="delete" onclick="return confirm('<?php echo sc_e(T_("SC_DELETE_CONFIRM")); ?>');"><?php echo T_("SC_DELETE"); ?></button>
       </form>
       <?php
   }
   echo "<p><a href='staffbox.php'>" . T_("SC_BACK_TO_LIST") . "</a></p>";
   end_frame();
   stdfoot();
   exit;
}

// ---- all messages
$count = get_row_count("staffmessages");
list($pagertop, $pagerbottom, $limit) = pager(20, $count, "staffbox.php?");
$res = SQL_Query_exec("SELECT m.id, m.added, m.subject, m.answered, m.sender, m.answeredby, s.username AS sender_name, a.username AS answer_name FROM staffmessages m LEFT JOIN users s ON s.id = m.sender LEFT JOIN users a ON a.id = m.answeredby ORDER BY m.answered ASC, m.id DESC $limit");

stdhead(T_("SC_BOX_TITLE"));
begin_frame(T_("SC_BOX_TITLE"));

if ($count == 0) {
   echo "<p align='center'>" . T_("SC_NO_MESSAGES") . "</p>";
} else {
   if ($count > 20) echo $pagertop;
   echo "<form method='post' action='staffbox.php' id='staffbox'><table class='table_table' cellpadding='5' width='100%'><tr>";
   foreach (array(T_("SC_SUBJECT"), T_("SC_FROM"), T_("ADDED"), T_("SC_STATUS")) as $heading) echo "<th class='table_head'>$heading</th>";
   echo "<th class='table_head'><input type='checkbox' name='checkall' onclick='checkAll(this.form.id)' /></th></tr>";
   while ($res && ($row = mysqli_fetch_assoc($res))) {
       $status = $row["answered"] ? "<b style='color:green'>" . T_("SC_ANSWERED") . "</b> &middot; " . sc_user($row["answeredby"], $row["answer_name"]) : "<b style='color:red'>" . T_("SC_WAITING") . "</b>";
       echo "<tr><td class='table_col1'><a href='staffbox.php?action=viewpm&pmid=" . (int) $row["id"] . "'><b>" . sc_e($row["subject"]) . "</b></a></td>"
           . "<td class='table_col2'>" . sc_user($row["sender"], $row["sender_name"]) . "</td>"
           . "<td class='table_col1' align='center'>" . sc_e(utc_to_tz((string) $row["added"])) . "</td>"
           . "<td class='table_col2'>$status</td>"
           . "<td class='table_col1' align='center'><input type='checkbox' name='ids[]' value='" . (int) $row["id"] . "' /></td></tr>";
   }
   echo "</table><p align='right'>";
   echo "<button type='submit' name='do' value='mark'>" . T_("SC_MARK_ANSWERED") . "</button> ";
   echo "<button type='submit' name='do' value='delete' onclick=\"return confirm('" . sc_e(T_("SC_DELETE_CONFIRM")) . "');\">" . T_("SC_DELETE") . "</button>";
   echo "</p></form>";
   if ($count > 20) echo $pagerbottom;
}

end_frame();
stdfoot();
?>


Add the links wherever they suit your theme
<a href="contactstaff.php">Contact Staff</a>
<a href="staffbox.php">Messages to Staff</a>

The first is for members and the second for staff. Moderators without Admin CP access need the staff link somewhere other than the Admin CP.

Optional: notice for staff in index.php, after stdhead
// Tells staff on the home page when messages to the staff are waiting.

if (!empty($CURUSER) && (int) $CURUSER["class"] >= 5) {
   $sc_res = SQL_Query_exec("SELECT COUNT(*) FROM staffmessages WHERE answered = 0");
   $sc_row = $sc_res ? mysqli_fetch_row($sc_res) : null;
   $sc_open = $sc_row ? (int) $sc_row[0] : 0;

   if ($sc_open > 0) {
       begin_frame(T_("SC_BOX_TITLE"));
       echo "<p>"
           . ($sc_open === 1 ? T_("SC_STAFF_NOTICE_ONE") : sprintf(T_("SC_STAFF_NOTICE_MANY"), $sc_open))
           . " <a href='staffbox.php'><b>" . T_("SC_STAFF_NOTICE_LINK") . "</b></a></p>";
       end_frame();
   }
}


Add to english.php
$LANG["SC_TITLE"] = 'Contact Staff';
$LANG["SC_BOX_TITLE"] = 'Messages to Staff';
$LANG["SC_INTRO"] = 'Have a question, suggestion or concern? Send a message to the staff and we will reply by private message as soon as we can.';
$LANG["SC_SUBJECT"] = 'Subject';
$LANG["SC_MESSAGE"] = 'Message';
$LANG["SC_SEND"] = 'Send message';
$LANG["SC_SENT"] = 'Thank you. Your message has been sent to the staff.';
$LANG["SC_FILL_IN_BOTH"] = 'Please fill in both the subject and your message.';
$LANG["SC_FILL_IN_ANSWER"] = 'Please enter an answer.';
$LANG["SC_NOT_ALLOWED"] = 'You do not have permission to view this page.';
$LANG["SC_NOT_FOUND"] = 'This message could not be found.';
$LANG["SC_NO_MESSAGES"] = 'There are no messages yet.';
$LANG["SC_NOTHING_SELECTED"] = 'Please select at least one message.';
$LANG["SC_FROM"] = 'From';
$LANG["SC_STATUS"] = 'Status';
$LANG["SC_ANSWERED"] = 'Answered';
$LANG["SC_WAITING"] = 'Waiting for an answer';
$LANG["SC_ANSWER"] = 'Answer';
$LANG["SC_REPLY"] = 'Reply';
$LANG["SC_SEND_ANSWER"] = 'Send answer';
$LANG["SC_ANSWER_SENT"] = 'Your answer has been sent to the member.';
$LANG["SC_MARK_ANSWERED"] = 'Mark as answered';
$LANG["SC_MARKED"] = 'The selected messages are marked as answered.';
$LANG["SC_DELETE"] = 'Delete';
$LANG["SC_DELETED"] = 'The selected messages have been deleted.';
$LANG["SC_DELETE_CONFIRM"] = 'Delete the selected messages? This cannot be undone.';
$LANG["SC_BACK_TO_LIST"] = 'Back to all messages';
$LANG["SC_BBCODE_ALLOWED"] = 'BB Code is allowed';
$LANG["SC_REGARDS"] = 'Kind regards, the Staff';
$LANG["SC_STAFF_NOTICE_ONE"] = 'There is 1 message to the staff waiting for an answer.';
$LANG["SC_STAFF_NOTICE_MANY"] = 'There are %d messages to the staff waiting for an answer.';
$LANG["SC_STAFF_NOTICE_LINK"] = 'Open messages to staff';


Thanks again!
Helpdesk tbdev — 2026-11-09 14:30:25 in v2.08 Mods Completed
Thank you to the original author of this Help Desk, and to ArcticWolf and UFFENO1 for improving it and sharing it here. It is a very useful addition.

coco asked whether this could work on TTv3 with MySQLi, so here is an updated version for PHP 8, based on UFFENO1's file. Please take a backup of your files and database first.

Asking, answering, closing without reply and deleting requests were tested on PHP 8.5 with MariaDB 10.10. The check that keeps regular members out of the staff pages was only reviewed in the code, so please try that with a test account.

What changed
- mysql_fetch_array() and the bare T_(SUCCESS1) crashed on PHP 8
- The posted SQL created a table called helpdesk while the code uses support_desk, which caused the Database Error coco reported
- Any logged-in member could delete requests, answer them or mark them ignored. Those actions are now staff only
- SQL injection through the id fields is closed, and titles and messages are escaped
- if ($solve = 'ignored') always set the status to ignored
- The time to answer now works without the zero dates, which strict mode can reject
- The language block had unescaped quotes that break english.php
- Generic keys such as OK, BAD and GREAT would change text elsewhere on the site, so every key now starts with HD_
- Standard replies and notices are reworded so they are friendly to members

run SQL
CREATE TABLE IF NOT EXISTS `support_desk` (
 `id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
 `title` VARCHAR(60) NOT NULL DEFAULT '',
 `msg_problem` TEXT NULL,
 `added` DATETIME NOT NULL,
 `added_by` INT UNSIGNED NOT NULL DEFAULT 0,
 `solved` ENUM('no','yes','ignored') NOT NULL DEFAULT 'no',
 `solved_by` INT UNSIGNED NOT NULL DEFAULT 0,
 `solved_date` DATETIME NULL DEFAULT NULL,
 `msg_answer` TEXT NULL,
 KEY `solved` (`solved`),
 KEY `added_by` (`added_by`)
) ENGINE=MyISAM;


Save this as helpdesk.php in your root
Staff are class 5 and up on a default install; change HD_STAFF_CLASS and HD_CLEANUP_CLASS at the top if yours differ.
<?php
// Help Desk (originally from TBDev, adapted for TorrentTrader by the community).
// Updated for PHP 8, with staff-only actions and a polite wording.

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

// lowest class that may answer tickets, and that may delete closed tickets
const HD_STAFF_CLASS = 5;
const HD_CLEANUP_CLASS = 7;

$class = (int) get_user_class();
$is_staff = $class >= HD_STAFF_CLASS;

function hd_e($value) {
   return htmlspecialchars((string) $value, ENT_QUOTES);
}

function hd_duration($seconds) {
   $seconds = (int) $seconds;
   foreach (array(array(604800, "HD_TIME_WEEK", "HD_TIME_WEEKS"), array(86400, "HD_TIME_DAY", "HD_TIME_DAYS"), array(3600, "HD_TIME_HOUR", "HD_TIME_HOURS"), array(60, "HD_TIME_MIN", "HD_TIME_MINS")) as $unit) {
       if ($seconds >= $unit[0]) {
           $n = intdiv($seconds, $unit[0]);
           return "$n " . T_($n == 1 ? $unit[1] : $unit[2]);
       }
   }
   return T_("HD_TIME_LESS");
}

function hd_user_link($id, $name) {
   return $name !== null ? "<a href='account-details.php?id=" . (int) $id . "'><b>" . class_user($name) . "</b></a>" : "-";
}

function hd_require_staff($is_staff) {
   if (!$is_staff) show_error_msg(T_("ERROR"), T_("HD_NOT_ALLOWED"), 1);
}

// ---- form actions
$do = $_POST["do"] ?? "";

if ($do === "ask") {
   $title = trim((string) ($_POST["title"] ?? ""));
   $problem = trim((string) ($_POST["msg_problem"] ?? ""));
   if ($title === "" || $problem === "") show_error_msg(T_("ERROR"), T_("HD_FILL_IN_BOTH"), 1);

   $user = (int) $CURUSER["id"];
   $since = get_date_time(time() - 600);
   $dupe = mysqli_fetch_row(SQL_Query_exec("SELECT COUNT(*) FROM support_desk WHERE added_by = $user AND title = " . sqlesc(substr($title, 0, 60)) . " AND added > '$since'"));
   if (!$dupe || (int) $dupe[0] === 0) {
       SQL_Query_exec("INSERT INTO support_desk (title, msg_problem, added, added_by) VALUES (" . sqlesc(substr($title, 0, 60)) . ", " . sqlesc($problem) . ", '" . get_date_time() . "', $user)");
   }
   autolink("index.php", T_("HD_SENT"));
}

if ($do === "answer") {
   hd_require_staff($is_staff);
   $id = (int) ($_POST["id"] ?? 0);
   $answer = trim((string) ($_POST["msg_answer"] ?? ""));
   $ticket = mysqli_fetch_assoc(SQL_Query_exec("SELECT d.*, u.username FROM support_desk d LEFT JOIN users u ON u.id = d.added_by WHERE d.id = $id"));
   if (!$ticket || $answer === "") show_error_msg(T_("ERROR"), T_("HD_FILL_IN_ANSWER"), 1);

   SQL_Query_exec("UPDATE support_desk SET solved = 'yes', solved_by = " . (int) $CURUSER["id"] . ", solved_date = '" . get_date_time() . "', msg_answer = " . sqlesc($answer) . " WHERE id = $id");
   $msg = "" . T_("HD_TITLE") . "\n\n
" . $ticket["username":
. "]" . $ticket["msg_problem"] . "
\n" . T_("HD_ANSWER") . ": $answer\n\n" . T_("HD_REGARDS");
   SQL_Query_exec("INSERT INTO messages (sender, receiver, added, subject, msg, poster) VALUES (" . (int) $CURUSER["id"] . ", " . (int) $ticket["added_by"] . ", '" . get_date_time() . "', " . sqlesc(T_("HD_TITLE")) . ", " . sqlesc($msg) . ", " . (int) $CURUSER["id"] . ")");
   autolink("helpdesk.php?action=problems", T_("HD_ANSWER_SENT"));
}

if ($do === "ignore") {
   hd_require_staff($is_staff);
   $id = (int) ($_POST["id"] ?? 0);
   SQL_Query_exec("UPDATE support_desk SET solved = 'ignored', solved_by = " . (int) $CURUSER["id"] . ", solved_date = '" . get_date_time() . "' WHERE id = $id AND solved = 'no'");
   autolink("helpdesk.php?action=problems", T_("HD_IGNORED_DONE"));
}

if ($do === "cleanup") {
   if ($class < HD_CLEANUP_CLASS) show_error_msg(T_("ERROR"), T_("HD_NOT_ALLOWED"), 1);
   SQL_Query_exec("DELETE FROM support_desk WHERE solved IN ('yes', 'ignored')");
   autolink("helpdesk.php?action=problems", T_("HD_CLEANED"));
}

// ---- staff: one ticket, or the list
if (($_GET["action"] ?? "") === "problems") {
   hd_require_staff($is_staff);
   $id = (int) ($_GET["id"] ?? 0);

   stdhead(T_("HD_TITLE"));
   begin_frame(T_("HD_TITLE"));

   if ($id > 0) {
       $ticket = mysqli_fetch_assoc(SQL_Query_exec("SELECT d.*, a.username AS added_name, s.username AS solved_name FROM support_desk d LEFT JOIN users a ON a.id = d.added_by LEFT JOIN users s ON s.id = d.solved_by WHERE d.id = $id"));
       if (!$ticket) {
           echo "<p>" . T_("HD_NOT_FOUND") . "</p>";
       } else {
           $replies = array(T_("HD_REPLY_FAQ_TEXT"), T_("HD_REPLY_FORUMS_TEXT"), T_("HD_REPLY_MORE_TEXT"));
           ?>
           <table class="table_table" cellpadding="5" width="100%">
               <tr><th class="table_head" colspan="2"><?php echo hd_e($ticket["title"]); ?></th></tr>
               <tr><td class="table_col1" width="140"><b><?php echo T_("ADDED"); ?></b></td><td class="table_col2"><?php echo hd_e(utc_to_tz($ticket["added"])); ?> &middot; <?php echo hd_user_link($ticket["added_by"], $ticket["added_name"]); ?></td></tr>
               <tr><td class="table_col1"><b><?php echo T_("HD_PROBLEM"); ?></b></td><td class="table_col2"><div class="hd-text"><?php echo nl2br(hd_e($ticket["msg_problem"])); ?></div></td></tr>
               <?php if ($ticket["solved"] === "no") { ?>
               <tr><td class="table_col1"><b><?php echo T_("HD_ANSWER"); ?></b></td><td class="table_col2">
                   <form method="post" action="helpdesk.php" id="hd-answer">
                       <input type="hidden" name="do" value="answer" />
                       <input type="hidden" name="id" value="<?php echo $id; ?>" />
                       <label><?php echo T_("HD_STANDARD_REPLIES"); ?>
                           <select id="hd-reply"><option value=""></option>
                               <option value="<?php echo hd_e($replies[0]); ?>"><?php echo T_("HD_REPLY_FAQ"); ?></option>
                               <option value="<?php echo hd_e($replies[1]); ?>"><?php echo T_("HD_REPLY_FORUMS"); ?></option>
                               <option value="<?php echo hd_e($replies[2]); ?>"><?php echo T_("HD_REPLY_MORE"); ?></option>
                           </select>
                       </label><br />
                       <textarea name="msg_answer" id="hd-answer-text" rows="10" class="hd-area" required></textarea>
                       <div><a href="tags.php"><?php echo T_("HD_BBCODE_ALLOWED"); ?></a></div>
                       <input type="submit" value="<?php echo T_("HD_SEND_ANSWER"); ?>" />
                   </form>
                   <form method="post" action="helpdesk.php" class="hd-inline" onsubmit="return confirm('<?php echo hd_e(T_("HD_IGNORE_CONFIRM")); ?>');">
                       <input type="hidden" name="do" value="ignore" /><input type="hidden" name="id" value="<?php echo $id; ?>" />
                       <input type="submit" value="<?php echo T_("HD_IGNORE"); ?>" />
                   </form>
                   <script>
                   document.getElementById("hd-reply").addEventListener("change", function () {
                       if (this.value) document.getElementById("hd-answer-text").value = this.value;
                   });
                   </script>
               </td></tr>
               <?php } else { ?>
               <tr><td class="table_col1"><b><?php echo T_("HD_STATUS"); ?></b></td><td class="table_col2"><b class="<?php echo $ticket["solved"] === "yes" ? "hd-good" : "hd-warn"; ?>"><?php echo T_($ticket["solved"] === "yes" ? "HD_SOLVED" : "HD_IGNORED"); ?></b> &middot; <?php echo hd_e(utc_to_tz((string) $ticket["solved_date"])); ?> &middot; <?php echo hd_user_link($ticket["solved_by"], $ticket["solved_name"]); ?></td></tr>
               <?php if ($ticket["solved"] === "yes") { ?>
               <tr><td class="table_col1"><b><?php echo T_("HD_ANSWER"); ?></b></td><td class="table_col2"><div class="hd-text"><?php echo nl2br(hd_e($ticket["msg_answer"])); ?></div></td></tr>
               <?php } ?>
               <?php } ?>
           </table>
           <?php
       }
       echo "<p><a href='helpdesk.php?action=problems'>" . T_("HD_BACK_TO_LIST") . "</a></p>";
   } else {
       $res = SQL_Query_exec("SELECT d.*, a.username AS added_name, s.username AS solved_name FROM support_desk d LEFT JOIN users a ON a.id = d.added_by LEFT JOIN users s ON s.id = d.solved_by ORDER BY (d.solved = 'no') DESC, d.added DESC");
       echo "<table class='table_table' cellpadding='5' width='100%'><tr>";
       foreach (array(T_("ADDED"), T_("HD_ADDED_BY"), T_("HD_PROBLEM"), T_("HD_STATUS"), T_("HD_HANDLED_BY"), T_("HD_SOLVED_IN")) as $heading) echo "<th class='table_head'>$heading</th>";
       echo "</tr>";
       $any = false;
       while ($res && ($row = mysqli_fetch_assoc($res))) {
           $any = true;
           $took = "-";
           $speed = "";
           if ($row["solved_date"] !== null) {
               $seconds = strtotime($row["solved_date"]) - strtotime($row["added"]);
               $took = hd_duration($seconds);
               $speed = $seconds <= 1800 ? "hd-good" : ($seconds <= 7200 ? "hd-warn" : "hd-bad");
           }
           $status = array("no" => array("HD_OPEN", "hd-bad"), "yes" => array("HD_SOLVED", "hd-good"), "ignored" => array("HD_IGNORED", "hd-warn"))[$row["solved"]];
           echo "<tr align='center'><td class='table_col1'>" . hd_e(utc_to_tz($row["added"])) . "</td>"
               . "<td class='table_col2'>" . hd_user_link($row["added_by"], $row["added_name"]) . "</td>"
               . "<td class='table_col1'><a href='helpdesk.php?action=problems&id=" . (int) $row["id"] . "'><b>" . hd_e($row["title"]) . "</b></a></td>"
               . "<td class='table_col2'><b class='$status[1]'>" . T_($status[0]) . "</b></td>"
               . "<td class='table_col1'>" . hd_user_link($row["solved_by"], $row["solved_name"]) . "</td>"
               . "<td class='table_col2'><b class='$speed'>$took</b></td></tr>";
       }
       if (!$any) echo "<tr><td class='table_col1' colspan='6' align='center'>" . T_("HD_NO_TICKETS") . "</td></tr>";
       echo "</table>";
       echo "<p class='hd-legend'>" . T_("HD_RESPONSE_TIME") . ": <b class='hd-good'>" . T_("HD_GREAT") . "</b>, <b class='hd-warn'>" . T_("HD_ACCEPTABLE") . "</b>, <b class='hd-bad'>" . T_("HD_SLOW") . "</b></p>";
       if ($class >= HD_CLEANUP_CLASS) {
           echo "<form method='post' action='helpdesk.php' onsubmit=\"return confirm('" . hd_e(T_("HD_DELETE_CONFIRM")) . "');\"><input type='hidden' name='do' value='cleanup' /><input type='submit' value='" . T_("HD_DELETE_CLOSED") . "' /></form>";
       }
   }
   end_frame();
   stdfoot();
   exit;
}

// ---- members: ask for help
stdhead(T_("HD_TITLE"));
begin_frame(T_("HD_TITLE"));

if ($is_staff) {
   echo "<p><a href='helpdesk.php?action=problems'><b>" . T_("HD_TROUBLE_TICKETS") . "</b></a></p>";
}
?>
<div class="hd-info">
   <p><?php echo T_("HD_INFO1"); ?></p>
   <p><?php echo T_("HD_INFO2"); ?></p>
   <p><?php echo T_("HD_INFO3"); ?></p>
</div>
<form method="post" action="helpdesk.php" class="hd-form">
   <input type="hidden" name="do" value="ask" />
   <label><?php echo T_("HD_SUBJECT"); ?>
       <input type="text" name="title" maxlength="60" required />
   </label>
   <label><?php echo T_("HD_PROBLEM"); ?>
       <textarea name="msg_problem" rows="12" class="hd-area" required></textarea>
   </label>
   <input type="submit" value="<?php echo T_("HD_HELP_ME"); ?>" />
</form>
<?php
end_frame();
stdfoot();
?>


Add to your theme CSS
.hd-good { color: green; }
.hd-warn { color: darkorange; }
.hd-bad { color: red; }
.hd-area { width: 100%; box-sizing: border-box; }
.hd-form { display: flex; flex-direction: column; gap: 12px; max-width: 760px; }
.hd-form label { display: flex; flex-direction: column; gap: 4px; font-weight: bold; }


on the admincp.php find
<td align="center"><a href="admincp.php?action=sqlerr"><img src="images/admin/sql_error.png" border="0" width="118" width="80" alt="" /><br />SQL Error<br /></a></td>

add after (use any 32x32 image)
<td align="center"><a href="helpdesk.php?action=problems"><img src="images/admin/help-desk.png" border="0" width="32" height="32" alt="" /><br />Helpdesk</a></td>


Optional: notice for staff in index.php, after stdhead
// Tells staff on the home page when Help Desk requests are waiting.

if (!empty($CURUSER) && (int) $CURUSER["class"] >= 5) {
   $hd_res = SQL_Query_exec("SELECT COUNT(*) FROM support_desk WHERE solved = 'no'");
   $hd_row = $hd_res ? mysqli_fetch_row($hd_res) : null;
   $hd_open = $hd_row ? (int) $hd_row[0] : 0;

   if ($hd_open > 0) {
       begin_frame(T_("HD_TITLE"));
       echo "<p>"
           . ($hd_open === 1 ? T_("HD_STAFF_NOTICE_ONE") : sprintf(T_("HD_STAFF_NOTICE_MANY"), $hd_open))
           . " <a href='helpdesk.php?action=problems'><b>" . T_("HD_STAFF_NOTICE_LINK") . "</b></a></p>";
       end_frame();
   }
}


Add to english.php
$LANG["HD_TITLE"] = 'Help Desk';
$LANG["HD_TROUBLE_TICKETS"] = 'View open support requests';
$LANG["HD_INFO1"] = 'Before asking, please check the <a href="faq.php">FAQ</a> and search the <a href="forums.php">Forums</a>, as your question may already be answered there.';
$LANG["HD_INFO2"] = 'Please give as much detail as you can so we can help you quickly. Requests are answered in the order they are received. Please treat our volunteers with respect.';
$LANG["HD_INFO3"] = 'If you are asking for a reseed, please include the link to the torrent.';
$LANG["HD_SUBJECT"] = 'Subject';
$LANG["HD_PROBLEM"] = 'Your question';
$LANG["HD_HELP_ME"] = 'Send request';
$LANG["HD_SENT"] = 'Thank you. Your request has been sent, and you will receive the answer by private message.';
$LANG["HD_FILL_IN_BOTH"] = 'Please fill in both the subject and your question.';
$LANG["HD_FILL_IN_ANSWER"] = 'Please enter an answer.';
$LANG["HD_NOT_ALLOWED"] = 'You do not have permission to do this.';
$LANG["HD_NOT_FOUND"] = 'This request could not be found.';
$LANG["HD_ADDED_BY"] = 'Asked by';
$LANG["HD_ANSWER"] = 'Answer';
$LANG["HD_STATUS"] = 'Status';
$LANG["HD_HANDLED_BY"] = 'Handled by';
$LANG["HD_SOLVED_IN"] = 'Time to answer';
$LANG["HD_OPEN"] = 'Open';
$LANG["HD_SOLVED"] = 'Solved';
$LANG["HD_IGNORED"] = 'Closed without reply';
$LANG["HD_IGNORE"] = 'Close without reply';
$LANG["HD_IGNORE_CONFIRM"] = 'Close this request without replying?';
$LANG["HD_IGNORED_DONE"] = 'The request has been closed.';
$LANG["HD_SEND_ANSWER"] = 'Send answer';
$LANG["HD_ANSWER_SENT"] = 'Your answer has been sent to the member.';
$LANG["HD_BACK_TO_LIST"] = 'Back to all requests';
$LANG["HD_NO_TICKETS"] = 'There are no support requests.';
$LANG["HD_STANDARD_REPLIES"] = 'Standard replies:';
$LANG["HD_BBCODE_ALLOWED"] = 'BB Code is allowed';
$LANG["HD_REPLY_FAQ"] = 'See the FAQ';
$LANG["HD_REPLY_FAQ_TEXT"] = 'Thank you for your question. You can find the answer in our [url=faq.php]FAQ[/url]. Please let us know if anything is still unclear.';
$LANG["HD_REPLY_FORUMS"] = 'Search the forums';
$LANG["HD_REPLY_FORUMS_TEXT"] = 'Thank you for your question. This has been covered before, so a search of our [url=forums.php]Forums[/url] should help. Please let us know if you cannot find it.';
$LANG["HD_REPLY_MORE"] = 'Ask for more details';
$LANG["HD_REPLY_MORE_TEXT"] = 'Thank you for your question. Could you please give us a little more detail so that we can help you?';
$LANG["HD_REGARDS"] = 'Kind regards, the Help Desk team';
$LANG["HD_RESPONSE_TIME"] = 'Response time';
$LANG["HD_GREAT"] = 'under 30 minutes';
$LANG["HD_ACCEPTABLE"] = 'under 2 hours';
$LANG["HD_SLOW"] = 'over 2 hours';
$LANG["HD_DELETE_CLOSED"] = 'Delete solved and closed requests';
$LANG["HD_DELETE_CONFIRM"] = 'Delete all solved and closed requests? This cannot be undone.';
$LANG["HD_CLEANED"] = 'Solved and closed requests have been deleted.';
$LANG["HD_TIME_WEEK"] = 'week';
$LANG["HD_TIME_WEEKS"] = 'weeks';
$LANG["HD_TIME_DAY"] = 'day';
$LANG["HD_TIME_DAYS"] = 'days';
$LANG["HD_TIME_HOUR"] = 'hour';
$LANG["HD_TIME_HOURS"] = 'hours';
$LANG["HD_TIME_MIN"] = 'minute';
$LANG["HD_TIME_MINS"] = 'minutes';
$LANG["HD_TIME_LESS"] = 'less than a minute';
$LANG["HD_STAFF_NOTICE_ONE"] = 'There is 1 Help Desk request waiting for an answer.';
$LANG["HD_STAFF_NOTICE_MANY"] = 'There are %d Help Desk requests waiting for an answer.';
$LANG["HD_STAFF_NOTICE_LINK"] = 'Open the Help Desk';


Members can reach the page at helpdesk.php, so add a link to it in your menu.

Thanks again!
Thank you M-Jay and the original author for this mod, and for keeping it available all these years. Thanks also to Gollum for the Hit and Run count fix, and to x7razor and everyone else who reported problems in this topic.

Here is an updated version for PHP 8, following the same steps as the first post. Please take a backup of your files and database first.

Files pass a PHP syntax check and the cleanup step runs without database errors on PHP 8.5 with MariaDB 10.10. It has not been through real downloads yet, so please try it on a test account first. Bans are automatic, so check the numbers in config.php before you enable it.

What changed from the first post
- $row[ip] and $row[ltime] crashed the admin list on PHP 8 (undefined constant)
- $site_config["hnr_disabled"] was used but never set, so warnings expired at once and members were banned at the next cleanup
- Members could be warned again at every cleanup, because the check read their first warning of any type
- A warning was not removed when a member got down to 0 Hit and Runs
- Apostrophes in mod comments broke the ban query
- Staff (class 5 and up on a default install) are no longer warned or banned automatically
- The ban email pointed to contact.php, which does not exist on a default install
- The checkboxes in the admin list sent a formatted size instead of the id, so Delete did nothing
- The Hit and Run count now uses Gollum's fix
- Language strings that were missing from the first post are added
- The snatched table is not dropped, so existing data is kept

You must have Snatchlist installed (see the fixes for it at the end of this post).

SQL:
(On MySQL remove IF NOT EXISTS.)
ALTER TABLE `snatched` ADD COLUMN IF NOT EXISTS `done` enum('yes','no') NOT NULL DEFAULT 'no';


Add in config.php :
// Anti Hit & Run
$site_config["hnr_deadline"] = 7*86400; // time to reach the seed target (7 days)
$site_config["hnr_seedtime"] = 172800; // the seed target (48 hours)
$site_config["hnr_warn"] = 5; // warned at this many hit & runs
$site_config["hnr_disabled"] = 7*86400; // a warned member has this long before being banned (7 days)
$site_config["hnr_stop_dl"] = 5; // not used by the mod yet
$site_config["hnr_ban"] = 50; // banned at this many hit & runs


in admincp.php find
<td align="center"><a href="admincp.php?action=sqlerr"><img src="images/admin/sql_error.png" border="0" width="118" width="80" alt="" /><br />SQL Error<br /></a></td>

add after
<td align="center"><a href="admincp.php?action=hnr"><img src="images/admin/hitnrun.png" border="0" width="32" height="32" alt="" /><br />List of Hit and Run</a><br /></td>

add before last ?>
#======================================================================#
# List of Hit and Run
#======================================================================#
if ($action == "hnr")
{
   if (($_POST["do"] ?? "") == "delete")
   {
       $ids = array_map("intval", (array) ($_POST["ids"] ?? array()));
       if (!$ids) show_error_msg(T_("ERROR"), "Nothing Selected.", 1);
       SQL_Query_exec("UPDATE snatched SET ltime = '86400', hnr = 'no', done = 'yes' WHERE sid IN (" . implode(",", $ids) . ")");
       autolink("admincp.php?action=hnr", "Entries deleted.");
   }

   stdhead("List of Hit and Run");
   navmenu();

   $count = get_row_count("snatched", "WHERE hnr = 'yes'");
   list($pagertop, $pagerbottom, $limit) = pager(50, $count, "admincp.php?action=hnr&");

   begin_frame("List of Hit and Run");
   echo "<div align='center'>We have <b>" . (int) $count . "</b> Hit and Run" . ($count == 1 ? "" : "s") . "</div><br />";

   $result = SQL_Query_exec("SELECT s.sid, s.uid, s.tid, s.uload, s.dload, s.ltime, s.stime, s.utime, u.username, t.name FROM snatched s LEFT JOIN users u ON u.id = s.uid LEFT JOIN torrents t ON t.id = s.tid WHERE s.hnr = 'yes' ORDER BY s.uid DESC $limit");

   if ($result && mysqli_num_rows($result) > 0)
   {
       $when = function ($time) { return $time > 0 ? htmlspecialchars(utc_to_tz(get_date_time((int) $time))) : "---"; };

       echo $pagertop;
       echo "<form id='snatched' method='post' action='admincp.php?action=hnr'><input type='hidden' name='do' value='delete' />";
       echo "<table cellpadding='5' class='table_table' width='100%'><tr>";
       foreach (array("User", "Torrent", "Uploaded", "Downloaded", "Seed&nbsp;Time", "Started", "Last&nbsp;Action") as $heading) echo "<th class='table_head'>$heading</th>";
       echo "<th class='table_head'><input type='checkbox' name='checkall' onclick='checkAll(this.form.id)' /></th></tr>";

       while ($row = mysqli_fetch_assoc($result))
       {
           $user = $row["username"] !== null ? "<a href='account-details.php?id=" . (int) $row["uid"] . "'><b>" . class_user($row["username"]) . "</b></a>" : "ID " . (int) $row["uid"];
           $torrent = $row["name"] !== null ? "<a href='torrents-details.php?id=" . (int) $row["tid"] . "'>" . htmlspecialchars(CutName($row["name"], 35)) . "</a>" : "ID " . (int) $row["tid"];

           echo "<tr><td class='table_col1'>$user</td><td class='table_col2'>$torrent</td>";
           echo "<td class='table_col1'>" . mksize($row["uload"]) . "</td><td class='table_col2'>" . mksize($row["dload"]) . "</td>";
           echo "<td class='table_col1'>" . ($row["ltime"] > 0 ? mkprettytime($row["ltime"]) : "0") . "</td>";
           echo "<td class='table_col2' align='center'>" . $when($row["stime"]) . "</td><td class='table_col1' align='center'>" . $when($row["utime"]) . "</td>";
           echo "<td class='table_col2' align='center'><input type='checkbox' name='ids[]' value='" . (int) $row["sid"] . "' /></td></tr>";
       }

       echo "</table><br /><center><input type='submit' value='Delete' /></center></form>";
       echo $pagerbottom;
   }
   else
   {
       echo "<center><b>" . T_("THERE_ARE_NO_RECORDINGS") . "</b></center><br />";
   }

   end_frame();
   stdfoot();
}
#======================================================================#
# End List of Hit and Run
#======================================================================#


in cleanup.php
Do not replace the Poor Ratio warning block from the first post, because that stops ratio warnings being removed. If your cleanup.php has a // REMOVE WARNINGS block with type != 'Poor Ratio', add this line below that condition:
AND type != 'HnR'

find
function do_cleanup() {

add above
// Anti Hit & Run: flags torrents not seeded enough, then warns and bans. Staff (class 5+) are never warned or banned.
function do_hnr_cleanup() {
global $site_config;

$timenow = gmtime();
$now_utc = gmdate("Y-m-d H:i:s", $timenow);
$deadline = (int) $site_config["hnr_deadline"];
$seedtime = (int) $site_config["hnr_seedtime"];
$warn_at = (int) $site_config["hnr_warn"];
$ban_at = (int) $site_config["hnr_ban"];
$warn_time = (int) $site_config["hnr_disabled"];

SQL_Query_exec("UPDATE snatched SET hnr = 'yes' WHERE completed = '1' AND hnr = 'no' AND uload < dload AND stime < " . ($timenow - $deadline) . " AND ltime < $seedtime AND done = 'no'");
SQL_Query_exec("UPDATE snatched SET hnr = 'no' WHERE hnr = 'yes' AND uload >= dload");
SQL_Query_exec("UPDATE snatched SET hnr = 'no' WHERE hnr = 'yes' AND ltime >= $seedtime");

$send_pm = function ($user, $subject, $msg) {
SQL_Query_exec("INSERT INTO messages (sender, receiver, added, subject, msg, poster) VALUES (0, $user, '" . get_date_time() . "', " . sqlesc($subject) . ", " . sqlesc($msg) . ", 0)");
};
$ban = function ($user, $name, $email, $modcomment, $note, $log, $reason) use ($site_config) {
$comment = sqlesc(gmdate("d/m/Y") . " - $note\n" . $modcomment);
SQL_Query_exec("UPDATE users SET enabled = 'no', warned = 'no', modcomment = $comment WHERE id = $user");
SQL_Query_exec("DELETE FROM warnings WHERE userid = $user AND type = 'HnR'");
write_log(T_("CLEANUP_THE_MEMBER") . " <a href='account-details.php?id=$user'>" . htmlspecialchars($name) . "</a> $log");

$subject = T_("CLEANUP_YOUR_ACCOUNT") . " " . $site_config["SITENAME"] . " " . T_("CLEANUP_HAS_BEEN_DISABLED");
$body = T_("CLEANUP_YOU_WERE_BANNED_FOLLOWING") . "\n\n$reason\n\n" . T_("CLEANUP_YOU_CAN_CONTACT_BY_LINK") . " " . $site_config["SITEURL"] . "\n\n" . $site_config["SITENAME"] . " " . T_("ADMIN");
sendmail($email, $subject, $body, "From: " . $site_config["SITEEMAIL"], "-f" . $site_config["SITEEMAIL"]);
};

// everyone with hit & runs, and everyone still carrying a warning for them
$members = SQL_Query_exec("SELECT DISTINCT uid FROM snatched WHERE hnr = 'yes' AND done = 'no' UNION SELECT DISTINCT userid FROM warnings WHERE type = 'HnR' AND active = 'yes'");
while ($members && ($member = mysqli_fetch_row($members))) {
$user = (int) $member[0];
$info = mysqli_fetch_assoc(SQL_Query_exec("SELECT username, email, modcomment, enabled, class FROM users WHERE id = $user"));
if (!$info || (int) $info["class"] >= 5) continue;

$row = mysqli_fetch_row(SQL_Query_exec("SELECT COUNT(*) FROM snatched WHERE uid = $user AND hnr = 'yes' AND done = 'no'"));
$count = (int) $row[0];
$row = mysqli_fetch_row(SQL_Query_exec("SELECT COUNT(*) FROM warnings WHERE userid = $user AND type = 'HnR' AND active = 'yes'"));
$is_warned = (int) $row[0] > 0;

if ($count >= $ban_at && $info["enabled"] == "yes") {
$ban($user, $info["username"], $info["email"], $info["modcomment"], T_("CLEANUP_BANNED_FOR") . " $count H&R.", T_("CLEANUP_HAS_BEEN_BANNED_REASON") . " $count H&R.", T_("CLEANUP_YOU_HAVE_ACCUMULATED") . " $count H&R.");
continue;
}

if ($count >= $warn_at && !$is_warned && $info["enabled"] == "yes") {
$expiry = gmdate("Y-m-d H:i:s", $timenow + $warn_time);
$reason = T_("CLEANUP_WARNING_FOR_ACCUMULATING") . " $warn_at H&R.";
SQL_Query_exec("UPDATE users SET warned = 'yes' WHERE id = $user");
SQL_Query_exec("INSERT INTO warnings (userid, reason, added, expiry, warnedby, type, active) VALUES ($user, " . sqlesc($reason) . ", '" . get_date_time() . "', '$expiry', 0, 'HnR', 'yes')");
$send_pm($user, T_("CLEANUP_WARNING_FOR_H&R"), T_("CLEANUP_YOU_HAVE_BEEN_WARNEWD_ACCUMULATED") . " $warn_at " . T_("CLEANUP_H&R_INVITE_CHECK_RULE") . "\n" . T_("CLEANUP_MSG_WARNING_7_DAYS_BANNED"));
}

if ($count < $warn_at && $is_warned) {
SQL_Query_exec("UPDATE users SET warned = 'no' WHERE id = $user");
SQL_Query_exec("DELETE FROM warnings WHERE userid = $user AND type = 'HnR'");
$send_pm($user, T_("CLEANUP_REMOVAL_OF_H&R_WARNING"), T_("CLEANUP_YOU_NOW_HAVE_LESS_THAN") . " $warn_at H&R.\n" . T_("CLEANUP_YOUR_WARNING_FOR_H&R_HAS_REMOVED"));
}
}

// the warning period ended and the member is still over the limit
$expired = SQL_Query_exec("SELECT DISTINCT w.userid, u.username, u.email, u.modcomment FROM warnings w INNER JOIN users u ON u.id = w.userid WHERE w.type = 'HnR' AND w.active = 'yes' AND w.expiry < '$now_utc' AND u.enabled = 'yes' AND u.class < 5");
while ($expired && ($row = mysqli_fetch_assoc($expired))) {
$ban((int) $row["userid"], $row["username"], $row["email"], $row["modcomment"], T_("CLEANUP_BANNED_FOR_EXPIRED_H&R_WARNING_TIMEOUT"), T_("CLEANUP_HAS_BEEN_BANNED_TIMEOUT"), T_("CLEANUP_TIMEOUT_WARNING_H&R_EXPIRED"));
}
}

search :
//OPTIMIZE TABLES

add before :
do_hnr_cleanup();


in account-details search :
$numtorrents = get_row_count("torrents", "WHERE owner = $id");

Add after :
$hnr = get_row_count("snatched", "WHERE uid = $id AND hnr = 'yes'");

find
<?php echo T_("RATIO"); ?>: <?php echo $ratio; ?><br />

below
<?php echo T_("H&R"); ?>: <?php echo (int) $hnr; ?><br />


Add to english.php
$LANG["CLEANUP_WARNING_FOR_ACCUMULATING"] = "You have been warned because you have accumulated";
$LANG["CLEANUP_WARNING_FOR_H&R"] = "Warning for H&R";
$LANG["CLEANUP_YOU_HAVE_BEEN_WARNEWD_ACCUMULATED"] = "You have been warned because you have accumulated";
$LANG["CLEANUP_H&R_INVITE_CHECK_RULE"] = "H&R. Please check the site rules and keep seeding your torrents.";
$LANG["CLEANUP_MSG_WARNING_7_DAYS_BANNED"] = "If this warning is still active after 7 days, your account will be banned.";
$LANG["CLEANUP_REMOVAL_OF_H&R_WARNING"] = "Your warning for H&R has been removed";
$LANG["CLEANUP_YOU_NOW_HAVE_LESS_THAN"] = "You now have fewer than";
$LANG["CLEANUP_YOUR_WARNING_FOR_H&R_HAS_REMOVED"] = "Your warning for H&R has been removed.";
$LANG["CLEANUP_BANNED_FOR"] = "Banned for accumulating";
$LANG["CLEANUP_THE_MEMBER"] = "The member";
$LANG["CLEANUP_HAS_BEEN_BANNED_REASON"] = "has been banned for accumulating";
$LANG["CLEANUP_HAS_BEEN_BANNED_TIMEOUT"] = "has been banned because the H&R warning period expired.";
$LANG["CLEANUP_YOUR_ACCOUNT"] = "Your account at";
$LANG["CLEANUP_HAS_BEEN_DISABLED"] = "has been disabled";
$LANG["CLEANUP_YOU_WERE_BANNED_FOLLOWING"] = "You have been banned for the following reason:";
$LANG["CLEANUP_YOU_HAVE_ACCUMULATED"] = "You have accumulated";
$LANG["CLEANUP_TIMEOUT_WARNING_H&R_EXPIRED"] = "Your warning period for H&R has expired.";
$LANG["CLEANUP_YOU_CAN_CONTACT_BY_LINK"] = "You can contact us through the site:";
$LANG["CLEANUP_BANNED_FOR_EXPIRED_H&R_WARNING_TIMEOUT"] = "Banned because the warning time for H&R has expired";
$LANG["THERE_ARE_NO_RECORDINGS"] = "There are no recordings of Hit and Run!";
$LANG["H&R"] = "HnR";


Add hitnrun.png from the first post to images/admin.

Fixes needed in Snatchlist for this to work
The completed update also checks utime against the current second, so it rarely matches and Hit and Runs are never flagged. In announce.php find
SQL_Query_exec("UPDATE LOW_PRIORITY `snatched` SET `completed` = '1' WHERE `tid` = '$torrentid' AND `uid` = '$userid' AND `utime` = '" . gmtime() . "'");

replace with
SQL_Query_exec("UPDATE `snatched` SET `completed` = '1' WHERE `tid` = $torrentid AND `uid` = $userid");

Seed time can be wrong when PHP and MySQL use different time zones, so let the database measure it. Find
UNIX_TIMESTAMP(last_action) AS ez,

replace with
UNIX_TIMESTAMP(last_action) AS ez, TIMESTAMPDIFF(SECOND, last_action, UTC_TIMESTAMP()) AS idle,

find
$elapsed = ($self['seeder'] == 'yes') ? $site_config['announce_interval'] - floor(($self['ez'] - time()) / 60) : 0;

replace with
$elapsed = ($self['seeder'] == 'yes') ? min(max(0, (int) $self['idle']), (int) $site_config['announce_interval'] * 2) : 0;

snatched.php lets any member see who downloaded a torrent. To keep that for staff, find
if ($tid > 0) {
$count_tid =

add above
if ($tid > 0 && $CURUSER["edit_users"] != "yes") show_error_msg(T_("ERROR"), T_("NO_PERMISSION"), 1);


If you also use the Seed Bonus mod
The HnR option is undone at the next cleanup unless it is marked as done. In mybonus.php find
`hnr` = 'no' WHERE `tid`

replace with
`hnr` = 'no', `done` = 'yes' WHERE `tid`


Thanks again!
Seed Bonus [TTv3] — 2026-11-09 10:33:23 in v3 Mods Completed
Thanks to M-Jay and mostvotedplaya for this mod. Here is an updated version for PHP 8, following the same steps as the first post. Please take a backup of your files and database first.

Files pass a PHP syntax check and the pages load on PHP 8.5 with MariaDB 10.10. Point awards and exchanges have only had light testing so far, so please try it on a test account first.

What changed from the first post
- mysql_fetch_assoc() no longer exists in PHP 8 and crashed the HnR option
- Undefined $_POST keys and null values no longer give warnings
- Points are charged in one query, only after all checks pass, so a double click cannot spend them twice
- The HnR option clears only your own HnR (it could clear another member's), and now has its Torrent ID box
- VIP set class 7, which is Administrator on a default install. It now uses the VIP class and never lowers Uploaders or staff
- The manager no longer uses extract() on $_POST
- seedbonus gets a default of 0, which fixes the signup error in strict mode reported in this topic

SQL:
(If you have a NULL or missing default on seedbonus from the old version, the last two lines fix it. On MySQL remove IF NOT EXISTS.)
CREATE TABLE IF NOT EXISTS `bonus` (
 `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
 `title` varchar(50) NOT NULL,
 `cost` decimal(10,1) unsigned NOT NULL DEFAULT '0.0',
 `value` bigint(20) unsigned NOT NULL DEFAULT '0',
 `descr` varchar(100) NOT NULL,
 `type` varchar(20) NOT NULL DEFAULT 'other',
 PRIMARY KEY (`id`)
) ENGINE=MyISAM;

INSERT IGNORE INTO `bonus` (`id`, `title`, `cost`, `value`, `descr`, `type`) VALUES
(1, '1 GB Uploaded', '70.0', 1073741824, 'Exchange 70 points for 1 GB upload.', 'traffic'),
(2, '2 GB Uploaded', '100.0', 2147483648, 'Exchange 100 points for 2 GB upload.', 'traffic'),
(3, '5 GB Uploaded', '250.0', 5368709120, 'Exchange 250 points for 5 GB upload.', 'traffic'),
(4, '10 GB Uploaded', '500.0', 10737418240, 'Exchange 500 points for 10 GB upload.', 'traffic'),
(5, 'Invitations', '1000.0', 2, 'Receive 2 Invites for 1000.00 seedbonus points.', 'invite');

ALTER TABLE `users` ADD COLUMN IF NOT EXISTS `seedbonus` decimal(10,1) NOT NULL DEFAULT '0.0';
UPDATE `users` SET `seedbonus` = 0 WHERE `seedbonus` IS NULL;
ALTER TABLE `users` MODIFY `seedbonus` decimal(10,1) NOT NULL DEFAULT '0.0';


blocks/login_block.php find
$privacylevel = T_($CURUSER["privacy"]);

Add after
$bonus = number_format((float) ($CURUSER["seedbonus"] ?? 0), 1);

Search (at end of line)
". T_("RATIO") .": $userratio

Add after :
<br>Seedbonus : <b><a href=mybonus.php>".$bonus."</a></b>


backend/cleanup.php find
//LOCAL TORRENTS - MAKE NON-ACTIVE/OLD TORRENTS INVISIBLE
$deadtime = gmtime() - $site_config["max_dead_torrent_time"];
SQL_Query_exec("UPDATE torrents SET visible='no' WHERE visible='yes' AND last_action < FROM_UNIXTIME($deadtime) AND seeders = '0' AND leechers = '0' AND external !='yes'");

Add after :
// Seedbonus: points per torrent each member is seeding
$res = SQL_Query_exec("SELECT userid, COUNT(DISTINCT torrent) AS seeding FROM peers WHERE seeder = 'yes' GROUP BY userid");
while ($row = mysqli_fetch_object($res)) {
   $points = (float) $site_config["bonuspertime"] * (int) $row->seeding;
   SQL_Query_exec("UPDATE users SET seedbonus = seedbonus + $points WHERE id = " . (int) $row->userid);
}
// End Seedbonus


backend/config.php find
$site_config['blocks_dir'] = getcwd().'/blocks';

After add
$site_config["bonuspertime"] = 0.5;


account.php find
<?php print("<a href='mailbox.php'><b>".T_("YOUR_MESSAGES")."</b></a>");?>
&nbsp;|&nbsp;

Add below
&nbsp;|&nbsp;
<?php print("<a href='mybonus.php'><b>My Seedbonus</b></a>");?>


admincp.php find
<td align="center"><a href="admincp.php?action=sqlerr"><img src="images/admin/sql_error.png" border="0" width="32" height="32" alt="" /><br />SQL Error<br /></a></td>

Add below
<td colspan="5">&nbsp;</td>
</tr>
<tr>
<td align="center"><a href="admincp.php?action=seedbonus"><img src="images/admin/seedbonus.png" border="0" width="32" height="32" alt="" /><br />Management of Seed Bonus</a></td>
</tr>

Search
} // End Forum management

Add after
#======================================================================#
# Seedbonus Manager
#======================================================================#
if ($action == "seedbonus" && $do != "change")
{
   if ($do == "del")
   {
       $ids = array_map("intval", (array) ($_POST["ids"] ?? array()));
       if (!$ids) show_error_msg(T_("ERROR"), "Nothing selected.", 1);

       SQL_Query_exec("DELETE FROM `bonus` WHERE `id` IN (" . implode(", ", $ids) . ")");
       autolink("admincp.php?action=seedbonus", "Deleted entries");
   }

   $count = get_row_count("bonus");

   list($pagertop, $pagerbottom, $limit) = pager(25, $count, 'admincp.php?action=seedbonus&');

   $res = SQL_Query_exec("SELECT id, title, cost, value, descr, type FROM `bonus` ORDER BY `type` $limit");

   stdhead("Seedbonus Manager");
   navmenu();

   begin_frame("Management of Seed Bonus");
?>

<center>
This page displays all available options which users can exchange for seedbonus: <?php echo number_format($count); ?><br /><br />
<a href="admincp.php?action=seedbonus&do=change">Add</a> a new option?
</center>

<?php if ($count > 0): ?>
<br />
<form id="seedbonus" method="post" action="admincp.php?action=seedbonus">
<input type="hidden" name="do" value="del" />
<table border="0" cellpadding="3" cellspacing="0" width="100%" align="center" class="table_table">
<tr>
   <th class="table_head">Title</th>
   <th class="table_head">Description</th>
   <th class="table_head">Points</th>
   <th class="table_head">Value</th>
   <th class="table_head">Type</th>
   <th class="table_head">Edit</th>
   <th class="table_head"><input type="checkbox" name="checkall" onclick="checkAll(this.form.id);" /></th>
</tr>

<?php while ($row = mysqli_fetch_object($res)):
   $shown_value = ($row->type == "traffic") ? mksize($row->value) : (int) $row->value;
?>
<tr>
   <td class="table_col1" align="center"><?php echo htmlspecialchars((string) $row->title); ?></td>
   <td class="table_col2"><?php echo htmlspecialchars((string) $row->descr); ?></td>
   <td class="table_col1" align="center"><?php echo htmlspecialchars((string) $row->cost); ?></td>
   <td class="table_col2" align="center"><?php echo $shown_value; ?></td>
   <td class="table_col1" align="center"><?php echo htmlspecialchars((string) $row->type); ?></td>
   <td class="table_col2" align="center"><a href="admincp.php?action=seedbonus&do=change&id=<?php echo (int) $row->id; ?>">Edit</a></td>
   <td class="table_col1" align="center"><input type="checkbox" name="ids[]" value="<?php echo (int) $row->id; ?>" /></td>
</tr>
<?php endwhile; ?>

<tr>
   <td colspan="7" align="right"><input type="submit" value="Remove Selected" /></td>
</tr>
</table>
</form>
<?php
   endif;

   if ($count > 25) echo $pagerbottom;

   end_frame();
   stdfoot();
}

if ($action == "seedbonus" && $do == "change")
{
   $bonus_types = array('invite', 'traffic', 'VIP', 'HnR', 'other');
   $bonus_id = (int) ($_REQUEST['id'] ?? 0);
   $row = null;
   if ($bonus_id > 0)
   {
       $row = mysqli_fetch_object(SQL_Query_exec("SELECT id, title, cost, value, descr, type FROM `bonus` WHERE `id` = $bonus_id"));
   }

   if ($_SERVER['REQUEST_METHOD'] == 'POST')
   {
       $title = trim((string) ($_POST['title'] ?? ''));
       $descr = trim((string) ($_POST['descr'] ?? ''));
       $type = (string) ($_POST['type'] ?? '');
       $cost = $_POST['cost'] ?? '';
       $raw_value = trim((string) ($_POST['value'] ?? ''));

       if ($title === '' || $descr === '' || !in_array($type, $bonus_types, true) || !is_numeric($cost) || $cost < 0)
       {
           autolink("admincp.php?action=seedbonus&do=change&id=$bonus_id", "Missing information.");
       }

       $value = ($type == "traffic" && !ctype_digit($raw_value)) ? strtobytes($raw_value) : $raw_value;
       $value = sprintf("%.0f", (float) $value);
       $cost = (float) $cost;
       $title_sql = "'" . mysqli_real_escape_string($GLOBALS["DBconnector"], $title) . "'";
       $descr_sql = "'" . mysqli_real_escape_string($GLOBALS["DBconnector"], $descr) . "'";

       if ($row == null)
       {
           SQL_Query_exec("INSERT INTO `bonus` (`title`, `descr`, `cost`, `value`, `type`) VALUES ($title_sql, $descr_sql, $cost, $value, '$type')");
       }
       else
       {
           SQL_Query_exec("UPDATE `bonus` SET `title` = $title_sql, `descr` = $descr_sql, `cost` = $cost, `value` = $value, `type` = '$type' WHERE `id` = $bonus_id");
       }

       autolink("admincp.php?action=seedbonus", "Seed bonus option saved.");
   }

   stdhead("Seedbonus Management");
   navmenu();

   begin_frame("Seedbonus Management");
   $field = function ($name) use ($row) {
       return $row != null ? htmlspecialchars((string) $row->$name, ENT_QUOTES) : '';
   };
?>

<form method="post" action="admincp.php?action=seedbonus&do=change">

<?php if ($row != null): ?>
<input type="hidden" name="id" value="<?php echo (int) $row->id; ?>" />
<?php endif; ?>

<table border="0" class="table_table" width="90%" cellpadding="3" align="center">
<tr>
   <th class="table_head" colspan="2">Seedbonus Management</th>
</tr>
<tr>
   <td class="table_col1"><b>Title:</b></td>
   <td class="table_col2"><input type="text" name="title" value="<?php echo $field('title'); ?>" size="50" maxlength="50" /></td>
</tr>
<tr>
   <td class="table_col1"><b>Points:</b></td>
   <td class="table_col2"><input type="text" name="cost" value="<?php echo $field('cost'); ?>" size="5" /></td>
</tr>
<tr>
   <td class="table_col1"><b>Type:</b></td>
   <td class="table_col2">
   <select name="type">
   <?php foreach ($bonus_types as $bonus_type): ?>
       <option value="<?php echo $bonus_type; ?>" <?php echo ($row != null && $row->type == $bonus_type ? 'selected="selected"' : ''); ?>><?php echo $bonus_type; ?></option>
   <?php endforeach; ?>
   </select>
   </td>
</tr>
<tr>
   <td class="table_col1"><b>Value:</b></td>
   <td class="table_col2"><input type="text" name="value" value="<?php echo $field('value'); ?>" size="14" /> Traffic: bytes or a size such as 5 GB. VIP: days. Invite: number.</td>
</tr>
<tr>
   <td class="table_col1" valign="top"><b>Description:</b></td>
   <td class="table_col2"><textarea name="descr" rows="5" cols="38" maxlength="100"><?php echo $field('descr'); ?></textarea></td>
</tr>
<tr>
   <td colspan="2" align="right">
       <input type="reset" value="Cancel" />
       <input type="submit" value="Save" />
   </td>
</tr>
</table>
</form>

<?php
   end_frame();
   stdfoot();
}


Use seedbonus.png from bonus.zip in the first post (images/admin folder).

Replace mybonus.php in the root with:
<?php
/**
* @package Seedbonus
* @version TorrentTrader v3 MicroMonkey
* @author  mostvotedplaya
* Updated for PHP 8.
*/

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

// group_id of VIP in your groups table (3 on a default install)
const BONUS_VIP_CLASS = 3;

if (is_valid_id($_POST['id'] ?? 0)) {
   $item = mysqli_fetch_object(SQL_Query_exec("SELECT `type`, `value`, `cost` FROM `bonus` WHERE `id` = " . (int) $_POST['id']));

   if (!$item || (float) $CURUSER['seedbonus'] < (float) $item->cost) {
       autolink("mybonus.php", "Demand not valid.");
   }

   $uid = (int) $CURUSER['id'];
   $cost = (float) $item->cost;
   $value = (int) $item->value;
   $tid = (int) ($_POST["torrentid"] ?? 0);

   // checked before anything is charged
   if ($item->type == 'HnR') {
       if (!$tid) {
           autolink("mybonus.php", "You must fill the box with the id of the torrent.");
       }
       $check = SQL_Query_exec("SELECT 1 FROM `snatched` WHERE `tid` = $tid AND `uid` = $uid AND `hnr` = 'yes'");
       if (mysqli_num_rows($check) == 0) {
           autolink("mybonus.php", "No HnR found with this information.");
       }
   }

   // charged in one statement, so a double click cannot spend the points twice
   if ($cost > 0) {
       SQL_Query_exec("UPDATE `users` SET `seedbonus` = `seedbonus` - $cost WHERE `id` = $uid AND `seedbonus` >= $cost");
       if (mysqli_affected_rows($GLOBALS["DBconnector"]) < 1) {
           autolink("mybonus.php", "Demand not valid.");
       }
   }

   switch ($item->type) {
       case 'invite':
           SQL_Query_exec("UPDATE `users` SET `invites` = `invites` + $value WHERE `id` = $uid");
           break;

       case 'traffic':
           SQL_Query_exec("UPDATE `users` SET `uploaded` = `uploaded` + $value WHERE `id` = $uid");
           break;

       case 'HnR':
           $torrent = mysqli_fetch_assoc(SQL_Query_exec("SELECT `name` FROM `torrents` WHERE `id` = $tid"));
           $torname = $torrent ? $torrent["name"] : "ID $tid";

           write_log("The HnR of " . $CURUSER['username'] . " on the torrent " . htmlspecialchars($torname) . " has been cleared with seed bonus points.");

           $modcom = sqlesc(gmdate("d-m-Y H:i") . " - H&R on the torrent $torname cleared against $cost points\n");
           SQL_Query_exec("UPDATE `users` SET `modcomment` = CONCAT($modcom, IFNULL(`modcomment`, '')) WHERE `id` = $uid");
           SQL_Query_exec("UPDATE `snatched` SET `ltime` = '129600', `hnr` = 'no' WHERE `tid` = $tid AND `uid` = $uid");
           break;

       case 'VIP':
           // Uploaders and staff keep their higher class
           SQL_Query_exec("UPDATE `users` SET `class` = " . BONUS_VIP_CLASS . " WHERE `id` = $uid AND `class` < " . BONUS_VIP_CLASS);
           break;

       case 'other':
           break;
   }

   autolink("mybonus.php", "Your account has been credited.");
}

$my_points = (float) ($CURUSER['seedbonus'] ?? 0);

$items = array();
$res = SQL_Query_exec("SELECT * FROM `bonus` ORDER BY `type`");
while ($row = mysqli_fetch_object($res)) {
   $items[] = $row;
}

stdhead("Seedbonus");
begin_frame("Bonus Exchange");

// one form per item; the fields in the table refer to it with the form attribute
foreach ($items as $row) {
   echo "<form id='bonus-form-" . (int) $row->id . "' method='post' action='mybonus.php'><input type='hidden' name='id' value='" . (int) $row->id . "' /></form>\n";
}
?>

<center>
This page displays the options that you can redeem your accumulated points for.<br />
Your points: <b><?php echo number_format($my_points, 1); ?></b>
</center>

<br />
<table border="0" cellpadding="3" class="table_table" width="100%">
<tr>
   <th class="table_head">Option</th>
   <th class="table_head">What is it?</th>
   <th class="table_head">Points</th>
   <th class="table_head">Exchange</th>
</tr>
<?php foreach ($items as $row): $form = "bonus-form-" . (int) $row->id; ?>
<tr>
   <td class="table_col1">
       <?php echo htmlspecialchars((string) $row->title); ?>
       <?php if ($row->type == 'HnR'): ?>
           <br /><input type="text" name="torrentid" form="<?php echo $form; ?>" placeholder="Enter Torrent ID" required />
       <?php endif; ?>
   </td>
   <td class="table_col2"><?php echo htmlspecialchars((string) $row->descr); ?></td>
   <td class="table_col1" align="center"><?php echo number_format((float) $row->cost, 1); ?></td>
   <td class="table_col2" align="center"><input type="submit" form="<?php echo $form; ?>" value="Exchange" <?php echo ($my_points < (float) $row->cost ? 'disabled="disabled"' : ''); ?> /></td>
</tr>
<?php endforeach; ?>
</table>

<ul>
  <li>You receive <b><?php echo htmlspecialchars((string) $site_config['bonuspertime']); ?></b> points per torrent you are seeding, every <?php echo (int) floor($site_config['autoclean_interval'] / 60); ?> minutes.</li>
</ul>
<ul>
  <li><a href="account.php">Return to profile</a></li>
</ul>
<?php
end_frame();
stdfoot();
?>


Notes: the HnR option needs the snatched table from the HnR mod. VIP only raises the class and does not expire by itself.
v3.8.3 first findings — 2026-10-06 11:10:22 in Bugs
Botanicar,

First of all thanks for all the fixes! Appreciated.

Here some things I have encountered, which may be just my bad luck ofcourse ;-)

Poll Block (after voting), got the following error >>

Do You Like This Site

Fatal error: Uncaught Error: Undefined constant "srt" in \\STORAGE01\WEB\u2torrents_alpha\blocks\polls_block.php:98 Stack trace: #0 \\STORAGE01\WEB\u2torrents_alpha\backend\functions.php(417): include() #1 \\STORAGE01\WEB\u2torrents_alpha\themes\u2torrents\footer.php(24): rightblocks() #2 \\STORAGE01\WEB\u2torrents_alpha\backend\functions.php(383): require_once('\\\\STORAGE01\\WEB...') #3 \\STORAGE01\WEB\u2torrents_alpha\index.php(43): stdfoot() #4 {main} thrown in \\STORAGE01\WEB\u2torrents_alpha\blocks\polls_block.php on line 98


On the forum link (main menu), the font size appears to be changing.

Admin Control Panel >>

Advanced User Search error:

Fatal error: Uncaught TypeError: preg_match(): Argument #2 ($subject) must be of type string, array given in \\STORAGE01\WEB\u2torrents_alpha\admincp.php:4020 Stack trace: #0 \\STORAGE01\WEB\u2torrents_alpha\admincp.php(4020): preg_match('/^(((1?\\d{1,2})...', Array) #1 {main} thrown in \\STORAGE01\WEB\u2torrents_alpha\admincp.php on line 4020

Themes >>
- For me changing the theme after login does not appear to work, changing it before login is fine.

Login >>
- Login using the link top right of the screen is no luck
- Login using the button in the middle of the screen is fine.
v3.8.3 first findings — 2026-09-07 15:58:18 in Bugs
Hi there, first of all thank you for doing such a mammoth job of converting all the code to php8 compatible code! Really much appreciated.

Here some first observations:

For the Blocks:
- "latestuploads" and "last_torrents" seem the same?
- "usersonline_max" and "ajaxonlineusers" blocks crash
- Is there a latest forum posts block?
- "announcements" block has fatal crash
- "Most active Torrents" block becomes visible on all pages.
- "scrollingnews" block does not seem to do anything, does not show in index after activation
- Activating the disclaimer block has the disclaimer showing 2 times on the front page.

- Disclaimer (not the block!) does not stick to the bottom of the page after adding some blocks. (index)

Source code:
php.ini    does this need to be in the root directory of the downloadable files?

Front page news and Shoutbox:
"Insert a Smiley
Click an icon to insert it into your post"   appears both in the first news post "Welcome" and in the shoutbox on the left side

Editing the news from the admincp, does not allow you to edit - but instead leads you back to the front page.

Themes:
The daylight theme needs further tweaking...font color for example.
The shoutbox alignment is not in the middle, leans to the left

If you need screenshots let me know!
Full worked script is done — 2026-09-07 15:47:22 in Download
Hi there, first of all thank you for doing such a mammoth job of converting all the code to php8 compatible code! Really much appreciated.

Here some first observations:

For the Blocks:
- "latestuploads" and "last_torrents" seem the same?
- "usersonline_max" and "ajaxonlineusers" blocks crash
- Is there a latest forum posts block?
- "announcements" block has fatal crash
- "Most active Torrents" block becomes visible on all pages.
- "scrollingnews" block does not seem to do anything, does not show in index after activation
- Activating the disclaimer block has the disclaimer showing 2 times on the front page.

- Disclaimer (not the block!) does not stick to the bottom of the page after adding some blocks. (index)

Source code:
php.ini    does this need to be in the root directory of the downloadable files?

Front page news and Shoutbox:
"Insert a Smiley
Click an icon to insert it into your post"   appears both in the first news post "Welcome" and in the shoutbox on the left side

Editing the news from the admincp, does not allow you to edit - but instead leads you back to the front page.

Themes:
The daylight theme needs further tweaking...font color for example.
The shoutbox alignment is not in the middle, leans to the left

If you need screenshots let me know!
Here is my account.php, with a working hiding of the announcements

<?php
require_once("backend/functions.php");
dbconn();
loggedinonly();

stdhead(T_("USERCP"));

function navmenu(){
?>
<br />
     <div class="f-border">
<table cellpadding='0' cellspacing='3' width='100%'>
<tr class="f-title">
<th width='100%' height="32" align='center'>
<?php print("<a href='account.php'><b>".T_("YOUR_PROFILE")."</b></a>");?>
&nbsp;|&nbsp;
<?php print("<a href='account.php?action=edit_settings&do=edit'><b>".T_("YOUR_SETTINGS")."</b></a>");?>
&nbsp;|&nbsp;
<?php print("<a href='account.php?action=changepw'><b>".T_("CHANGE_PASS")."</b></a>");?>
&nbsp;|&nbsp;
<?php print("<a href='account.php?action=mytorrents'><b>".T_("YOUR_TORRENTS")."</b></a>");?>
&nbsp;|&nbsp;
<?php print("<a href='mailbox.php'><b>".T_("YOUR_MESSAGES")."</b></a>");?>
&nbsp;|&nbsp;
<?php print("<a href='uptransfer.php'><b>".T_("DONATE_UPLOAD_CREDITS")."</b></a>");?>
</th>
       </tr>
</table>
 </div>
   <br />
<?php
}//end func

$action = $_REQUEST["action"];
$do = $_REQUEST["do"];

if (!$action){
begin_frame(T_("USER").": $CURUSER[username] (".T_("ACCOUNT_PROFILE").")");

$usersignature = stripslashes($CURUSER["signature"]);

navmenu();
?>
<table class="f-border comment" cellpadding="10" border="0" width="100%">
<tr>
   <td width="50%" valign="top">
<b><?php echo T_("USERNAME"); ?>:</b> <?php echo $CURUSER["username"]; ?><br />
<b><?php echo T_("CLASS"); ?>:</b> <?php echo $CURUSER["level"]; ?><br />
<b><?php echo T_("EMAIL"); ?>:</b> <?php echo $CURUSER["email"]; ?><br />
<b><?php echo T_("JOINED"); ?>:</b> <?php echo utc_to_tz($CURUSER["added"]); ?><br />
<b><?php echo T_("AGE"); ?>:</b> <?php echo $CURUSER["age"]; ?><br />
<b><?php echo T_("GENDER"); ?>:</b> <?php echo T_($CURUSER["gender"]); ?><br />
<b><?php echo T_("PREFERRED_CLIENT"); ?>:</b> <?php echo htmlspecialchars($CURUSER["client"]); ?><br />
<b><?php echo T_("DONATED"); ?>:</b> <?php echo $site_config['currency_symbol']; ?><?php echo number_format($CURUSER["donated"], 2); ?><br />
<b><?php echo T_("CUSTOM_TITLE"); ?>:</b> <?php echo format_comment($CURUSER["title"]); ?><br />
<b><?php echo T_("ACCOUNT_PRIVACY_LVL"); ?>:</b> <?php echo T_($CURUSER["privacy"]); ?><br />
<b><?php echo T_("SIGNATURE"); ?>:</b> <?php echo format_comment($usersignature); ?><br />
<b><?php echo T_("PASSKEY"); ?>:</b> <?php echo $CURUSER["passkey"]; ?><br />
<?php
if ($CURUSER["invited_by"]) {
$res = SQL_Query_exec("SELECT username FROM users WHERE id=$CURUSER[invited_by]");
$row = mysqli_fetch_assoc($res);
echo "<b>".T_("INVITED_BY").":</b> <a href=\"account-details.php?id=$CURUSER[invited_by]\">$row[username]</a><br />";
}
echo "<b>".T_("INVITES").":</b> " . number_format($CURUSER["invites"]) . "<br />";
$invitees = array_reverse(explode(" ", $CURUSER["invitees"]));
$rows = array();
foreach ($invitees as $invitee) {
$res = SQL_Query_exec("SELECT id, username FROM users WHERE id='$invitee' and status='confirmed'");
if ($row = mysqli_fetch_assoc($res)) {
$rows[] = "<a href=\"account-details.php?id=$row[id]\">$row[username]</a>";
}
}
if ($rows)
echo "<b>".T_("INVITED").":</b> ".implode(", ", $rows)."<br />";
?>
<?php print("<b>".T_("IP").":</b> " . $CURUSER["ip"] . "\n"); ?><br />
</td></tr>
</table>
<br /><br />
<?php
end_frame();
}

/////////////// MY TORRENTS ////////////////////

if ($action=="mytorrents"){
begin_frame(T_("YOUR_TORRENTS"));
navmenu();
//page numbers
$page = (int) $_GET['page'];
$perpage = 200;

$res = SQL_Query_exec("SELECT COUNT(*) FROM torrents WHERE torrents.owner = " . $CURUSER["id"] ."");
$arr = mysqli_fetch_row($res);
$pages = floor($arr[0] / $perpage);
if ($pages * $perpage < $arr[0])
 ++$pages;

if ($page < 1)
 $page = 1;
else
 if ($page > $pages)
   $page = $pages;

for ($i = 1; $i <= $pages; ++$i)
 if ($i == $page)
   $pagemenu .= "$i\n";
 else
   $pagemenu .= "<a href='account.php?action=mytorrents&page=$i'>$i</a>\n";

if ($page == 1)
 $browsemenu .= "";
else
 $browsemenu .= "<a href='account.php?action=mytorrents&page=" . ($page - 1) . "'>[Prev]</a>";

$browsemenu .= "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";

if ($page == $pages)
 $browsemenu .= "";
else
 $browsemenu .= "<a href='account.php?action=mytorrents&page=" . ($page + 1) . "'>[Next]</a>";

$offset = ($page * $perpage) - $perpage;
//end page numbers


$where = "WHERE torrents.owner = " . $CURUSER["id"] ."";
$orderby = "ORDER BY added DESC";

$query = SQL_Query_exec("SELECT torrents.id, torrents.category, torrents.name, torrents.added, torrents.hits, torrents.banned, torrents.comments, torrents.seeders, torrents.leechers, torrents.times_completed, categories.name AS cat_name, categories.parent_cat AS cat_parent FROM torrents LEFT JOIN categories ON category = categories.id $where $orderby LIMIT $offset,$perpage");

$allcats = mysqli_num_rows($query);
if($allcats == 0) {
echo '<div class="f-border comment"><br /><b>'.T_("NO_UPLOADS").'</b></div>';
}else{
print("<p align='center'>$pagemenu<br />$browsemenu</p>");
?>
   <table align="center" cellpadding="5" cellspacing="3" class="table_table" width="100%">
   <tr class="table_head">
       <th><?php echo T_("TYPE"); ?></th>
       <th><?php echo T_("NAME"); ?></th>
       <th><?php echo T_("COMMENTS"); ?></th>
       <th><?php echo T_("HITS"); ?></th>
       <th><?php echo T_("SEEDS"); ?></th>
       <th><?php echo T_("LEECHERS"); ?></th>
       <th><?php echo T_("COMPLETED"); ?></th>
       <th><?php echo T_("ADDED"); ?></th>
       <th><?php echo T_("EDIT"); ?></th>
   </tr>
   
<?php
 
while($row = mysqli_fetch_assoc($query))
{
$char1 = 35; //cut length
$smallname = CutName(htmlspecialchars($row["name"]), $char1);
echo "<tr><td class='table_col2' align='center'>$row[cat_parent]: $row[cat_name]</td><td class='table_col1' align='left'><a href='torrents-details.php?id=$row[id]'>$smallname</a></td><td class='table_col2' align='center'><a href='comments.php?type=torrent&id=$row[id]'>".number_format($row["comments"])."</a></td><td class='table_col1' align='center'>".number_format($row["hits"])."</td><td class='table_col2' align='center'>".number_format($row["seeders"])."</td><td class='table_col1' align='center'>".number_format($row["leechers"])."</td><td class='table_col2' align='center'>".number_format($row["times_completed"])."</td><td class='table_col1' align='center'>".get_elapsed_time(sql_timestamp_to_unix_timestamp($row["added"]))."</td><td class='table_col2'><a href='torrents-edit.php?id=$row[id]'>EDIT</a></td></tr>\n";
}
echo "</table><br />";
print("<p align='center'>$pagemenu<br />$browsemenu</p>");
}

end_frame();
}

/////////////////////// EDIT SETTINGS ////////////////
if ($action=="edit_settings"){

if ($do=="edit"){
begin_frame(T_("EDIT_ACCOUNT_SETTINGS"));

navmenu();
?>
<form enctype="multipart/form-data" method="post" action="account.php">
<input type="hidden" name="action" value="edit_settings" />
<input type="hidden" name="do" value="save_settings" />
<table class="f-border" cellspacing="0" cellpadding="5" width="100%" align="center">
<?php

$ss_r = SQL_Query_exec("SELECT * from stylesheets");
$ss_sa = array();
while ($ss_a = mysqli_fetch_assoc($ss_r))
{
 $ss_id = $ss_a["id"];
 $ss_name = $ss_a["name"];
 $ss_sa[$ss_name] = $ss_id;
}
ksort($ss_sa);
reset($ss_sa);
//while (list($ss_name, $ss_id) = thisEach($ss_sa))
foreach($ss_sa as $ss_name => $ss_id)
{
 if ($ss_id == $CURUSER["stylesheet"]) $ss = " selected='selected'"; else $ss = "";
 $stylesheets .= "<option value='$ss_id'$ss>$ss_name</option>\n";
}

$countries = "<option value='0'>----</option>\n";
$ct_r = SQL_Query_exec("SELECT id,name from countries ORDER BY name");
while ($ct_a = mysqli_fetch_assoc($ct_r))
 $countries .= "<option value='$ct_a[id]'" . ($CURUSER["country"] == $ct_a['id'] ? " selected='selected'" : "") . ">$ct_a[name]</option>\n";

$teams = "<option value='0'>--- ".T_("NONE_SELECTED")." ----</option>\n";
$sashok = SQL_Query_exec("SELECT id,name FROM teams ORDER BY name");
while ($sasha = mysqli_fetch_assoc($sashok))
$teams .= "<option value='$sasha[id]'" . ($CURUSER["team"] == $sasha['id'] ? " selected='selected'" : "") . ">$sasha[name]</option>\n";


$acceptpms = $CURUSER["acceptpms"] == "yes";
print ("<tr><td align='right' class='alt2'><b>" . T_("ACCEPT_PMS") . ":</b> </td><td class='alt2'><input type='radio' name='acceptpms'" . ($acceptpms ? " checked='checked'" : "") .
 " value='yes' /><b>".T_("FROM_ALL")."</b> <input type='radio' name='acceptpms'" .
 ($acceptpms ? "" : " checked='checked'") . " value='no' /><b>" . T_("FROM_STAFF_ONLY") . "</b><br /><i>".T_("ACCEPTPM_WHICH_USERS")."</i></td></tr>");

$gender = "<option value='Male'" . ($CURUSER["gender"] == "Male" ? " selected='selected'" : "") . ">" . T_("MALE") . "</option>\n"
."<option value='Female'" . ($CURUSER["gender"] == "Female" ? " selected='selected'" : "") . ">" . T_("FEMALE") . "</option>\n";

// START CAT LIST SQL
$r = SQL_Query_exec("SELECT id,name,parent_cat FROM categories ORDER BY parent_cat ASC, sort_index ASC");
if (mysqli_num_rows($r) > 0)
{
$categories .= "<table><tr>\n";
$i = 0;
while ($a = mysqli_fetch_assoc($r))
{
 $categories .=  ($i && $i % 2 == 0) ? "</tr><tr>" : "";
 $categories .= "<td class='bottom' style='padding-right: 5px'><input name='cat$a[id]' type=\"checkbox\" " . (strpos($CURUSER['notifs'], "[cat$a[id]]") !== false ? " checked='checked'" : "") . " value='yes' />&nbsp;" .htmlspecialchars($a["parent_cat"]).": " . htmlspecialchars($a["name"]) . "</td>\n";
 ++$i;
}
$categories .= "</tr></table>\n";
}

// END CAT LIST SQL
function priv($name, $descr) {
global $CURUSER;
if ($CURUSER["privacy"] == $name)
return "<input type=\"radio\" name=\"privacy\" value=\"$name\" checked=\"checked\" /> $descr";
return "<input type=\"radio\" name=\"privacy\" value=\"$name\" /> $descr";
}

print("<tr><td align='right' class='alt3'><b>" . T_("ACCOUNT_PRIVACY_LVL") . ":</b> </td><td align='left' class='alt3'>". priv("normal", "<b>" . T_("NORMAL") . "</b>") . " " . priv("low", "<b>" . T_("LOW") . "</b>") . " " . priv("strong", "<b>" . T_("STRONG") . "</b>") . "<br /><i>".T_("ACCOUNT_PRIVACY_LVL_MSG")."</i></td></tr>");
print("<tr><td align='right' class='alt2'><b>" . T_("EMAIL_NOTIFICATION") . ":</b> </td><td align='left' class='alt2'><input type='checkbox' name='pmnotif' " . (strpos($CURUSER['notifs'], "[pm]") !== false ? " checked='checked'" : "") .
  " value='yes' /><b>" . T_("PM_NOTIFY_ME") . "</b><br /><i>".T_("EMAIL_WHEN_PM")."</i></td></tr>");

  //print("<tr><td align=right class=alt3 valign=top><b>".T_("CATEGORY_FILTER").": </b></td><td align=left class=alt3><i>The system will only display the following categories when browsing (uncheck all to disable filter).</i><br />".$categories."</td></tr>");

print("<tr><td align='right' class='alt3'><b>" . T_("THEME") . ":</b> </td><td align='left' class='alt3'><select name='stylesheet'>\n$stylesheets\n</select></td></tr>");
print("<tr><td align='right' class='alt2'><b>" . T_("PREFERRED_CLIENT") .":</b> </td><td align='left' class='alt2'><input type='text' size='20' maxlength='20' name='client' value=\"" . htmlspecialchars($CURUSER["client"]) . "\" /></td></tr>");
print("<tr><td align='right' class='alt3'><b>" . T_("AGE") . ":</b> </td><td align='left' class='alt3'><input type='text' size='3' maxlength='2' name='age' value=\"" . htmlspecialchars($CURUSER["age"]) . "\" /></td></tr>");
print("<tr><td align='right' class='alt2'><b>" . T_("GENDER") . ":</b> </td><td align='left' class='alt2'><select size='1' name='gender'>\n$gender\n</select></td></tr>");
print("<tr><td align='right' class='alt3'><b>" . T_("COUNTRY") . ":</b> </td><td align='left' class='alt3'><select name='country'>\n$countries\n</select></td></tr>");

if ($CURUSER["class"] > 1)
print("<tr><td align='right' class='alt2'><b>".T_("TEAM").":</b> </td><td align='left' class='alt2'><select name='teams'>\n$teams\n</select></td></tr>");



/// AVATAR UPLOAD ///
if ($site_config['AVATARUPLOAD']) {

  $default_avatar = $site_config['SITEURL'] . '/avatars/default_avatar.webp';

  $avatar = $CURUSER['avatar'];
  if (empty($avatar)) {
      $avatar = $default_avatar;
  }

  $show_remove = ($avatar !== $default_avatar);

  $avatar = htmlspecialchars($avatar, ENT_QUOTES, 'UTF-8');

  $max_avatar_size = (int)$site_config['avatar_max_filesize'];

  if ($max_avatar_size >= GB) {
      $max_avatar_size_text = round($max_avatar_size / GB, 2) . ' GB';
  } elseif ($max_avatar_size >= MB) {
      $max_avatar_size_text = round($max_avatar_size / MB, 2) . ' MB';
  } else {
      $max_avatar_size_text = round($max_avatar_size / KB, 2) . ' KB';
  }

  print("
      <tr>
          <td align='right' class='alt3'><b>" . T_('AVATAR') . ":</b></td>
          <td align='left' class='alt3'>
              <table>
                  <tr>
                      <td>
                          <img src='{$avatar}' width='40' height='40' alt='Avatar'>
                      </td>
                      <td>
                          <a href='upavatar.php?action=upload'><b>" . T_('UP_AVATAR') . "</b></a>"
                          . ($show_remove
                              ? " &nbsp;|&nbsp; <a href='upavatar.php?action=remove'><b>Remove Avatar</b></a>"
                              : ""
                          ) . "
                          <br>
                          <small>
                              Images are converted to WebP · Max size: {$max_avatar_size_text}
                          </small>
                      </td>
                  </tr>
              </table>
          </td>
      </tr>
  ");
}
/// END UPLOAD AVATAR ///

print("<tr><td align='right' class='alt2'><b>" . T_("CUSTOM_TITLE") . ":</b> </td><td align='left' class='alt2'><input type='text' name='title' size='50' value=\"" . strip_tags($CURUSER["title"]) .
 "\" /><br />\n <i>" . T_("HTML_NOT_ALLOWED") . "</i></td></tr>");
print("<tr><td align='right' class='alt3' valign='top'><b>" . T_("SIGNATURE") . ":</b> </td><td align='left' class='alt3'><textarea name='signature' cols='50' rows='10'>" . htmlspecialchars($CURUSER["signature"]) .
 "</textarea><br />\n <i>".sprintf(T_("MAX_CHARS"), 150).", " . T_("HTML_NOT_ALLOWED") . "</i></td></tr>");

print("<tr><td align='right' class='alt2'><b>".T_("RESET_PASSKEY").":</b> </td><td align='left' class='alt2'><input type='checkbox' name='resetpasskey' value='1' />&nbsp;<i>".T_("RESET_PASSKEY_MSG").".</i></td></tr>");

   if ($site_config["SHOUTBOX"])
       print("<tr><td align='right' class='table_col3'><b>".T_("HIDE_SHOUT").":</b></td><td align='left' class='table_col3'><input type='checkbox' name='hideshoutbox' value='yes' ".($CURUSER['hideshoutbox'] == 'yes' ? 'checked="checked"' : '')." />&nbsp;<i>".T_("HIDE_SHOUT_TEXT")."</i></td></tr> ");


if ($CURUSER["coveroff"] == 'yes'){
print("<tr><td align='right' class='table_col3'><b>" .T_("ANNOUNCEMENTS_ON_OR_OFF"). ": <font color='#00FF00'>" .T_("VISIBLE"). "</font><br /></td></tr>");        
} else {
print("<tr><td align='right' class='table_col3'><b>" .T_("ANNOUNCEMENTS_ON_OR_OFF"). ": <font color='#FF0000'>" .T_("INVISIBLE"). "</font><br /></td></tr>");
}
   print ("<tr><td align='right' class='alt2'><b>" .T_("ANNOUNCEMENTS_ON_OR_OFF"). ":</b> </td><td class='alt2'><input type='radio' name='coveroff'" . ($CURUSER["coveroff"] == "yes" ? " checked" : "") . " value='yes'><b>" .T_("VISIBLE"). "</b> <input type='radio' name='coveroff'" . ($CURUSER["coveroff"] == "no" ? " checked" : "") . " value='no'><b>" .T_("INVISIBLE"). "</b></td></tr>");

print("<tr><td align='right' class='alt3'><b>" . T_("EMAIL") . ":</b> </td><td align='left' class='alt3'><input type=\"text\" name=\"email\" size=\"50\" value=\"" . htmlspecialchars($CURUSER["email"]) .
 "\" /><br />\n<i>".T_("REPLY_TO_CONFIRM_EMAIL")."</i><br /></td></tr>");

ksort($tzs);
reset($tzs);
// while (list($key, $val) = thisEach($tzs))
foreach($tzs as $key => $val) {
if ($CURUSER["tzoffset"] == $key)
$tz .= "<option value=\"$key\" selected='selected'>$val[0]</option>\n";
else
$tz .= "<option value=\"$key\">$val[0]</option>\n";
}

print("<tr><td align='right' class='alt2'><b>".T_("TIMEZONE").":</b> </td><td align='left' class='alt2'><select name='tzoffset'>$tz</select></td></tr>");

?>
<tr><td colspan="2" align="center"><input type="submit" value="<?php echo T_("SUBMIT");?>" /> <input type="reset" value="<?php echo T_("REVERT");?>" /></td></tr>
</table></form>

<?php
end_frame();
}


if ($do == "save_settings"){
begin_frame(T_("EDIT_ACCOUNT_SETTINGS"));

navmenu();
$set = array();
 $updateset = array();
 $changedemail = $newsecret = 0;

         $email = $_POST["email"];
 if ($email != $CURUSER["email"]) {
if (!validemail($email))
$message = T_("NOT_VALID_EMAIL");
$changedemail = 1;
 }

 $acceptpms = $_POST["acceptpms"];
 $pmnotif = $_POST["pmnotif"];
 $privacy = $_POST["privacy"];
 $notifs = ($pmnotif == 'yes' ? "[pm]" : "");
 $r = SQL_Query_exec("SELECT id FROM categories");
 $rows = mysqli_num_rows($r);
 for ($i = 0; $i < $rows; ++$i) {
$a = mysqli_fetch_assoc($r);
if ($_POST["cat$a[id]"] == 'yes')
 $notifs .= "[cat$a[id]]";
 }

 if ($_POST['resetpasskey']) $updateset[] = "passkey=''";
         
         $avatar = strip_tags( $_POST["avatar"] );
         
         if ( $avatar != null )
         {    
              # Allowed Image Extenstions.
              $allowed_types = &$site_config["allowed_image_types"];    
             
              # We force http://
              if ( !preg_match( "#^\w+://#i", $avatar ) ) $avatar = "http://" . $avatar;

              # Clean Avatar Path.
              $avatar = cleanstr( $avatar );
             
              # Validate Image.
              $im = @getimagesize( $avatar );
             
              if ( !$im[ 2 ] || !@array_key_exists( $im['mime'], $allowed_types ) )
                    $message = "The avatar url was determined to be of a invalid nature.";
                   
              # Save New Avatar.
              $updateset[] = "avatar = " . sqlesc($avatar);
         }
         
 $title = strip_tags($_POST["title"]);
 $signature = $_POST["signature"];
 $stylesheet = $_POST["stylesheet"];
 $language = $_POST["language"];
 $client = strip_tags($_POST["client"]);
 $age = $_POST["age"];
 $gender= $_POST["gender"];
 $country = $_POST["country"];
 $teams = $_POST["teams"];
 $privacy = $_POST["privacy"];
 $timezone = (int)$_POST['tzoffset'];

 if (is_valid_id($stylesheet))
$updateset[] = "stylesheet = '$stylesheet'";
 if (is_valid_id($language))
$updateset[] = "language = '$language'";
 if (is_valid_id($teams))
$updateset[] = "team = '$teams'";
 if (is_valid_id($country))
$updateset[] = "country = $country";
 if ($acceptpms == "yes")
$acceptpms = 'yes';
 else
$acceptpms = 'no';
 if (is_valid_id($age))
$updateset[] = "age = '$age'";
         
         $hideshoutbox = ($_POST["hideshoutbox"] == "yes") ? "yes" : "no";
           $updateset[] = "hideshoutbox = ".sqlesc($hideshoutbox);  
$updateset[] = "coveroff = " . sqlesc($coveroff);
$updateset[] = "acceptpms = ".sqlesc($acceptpms);
$updateset[] = "commentpm = ".sqlesc($pmnotif == "yes" ? "yes" : "no");
$updateset[] = "notifs = ".sqlesc($notifs);
$updateset[] = "privacy = ".sqlesc($privacy);
$updateset[] = "gender = ".sqlesc($gender);
$updateset[] = "client = ".sqlesc($client);
$updateset[] = "signature = ".sqlesc($signature);
$updateset[] = "title = ".sqlesc($title);
$updateset[] = "tzoffset = $timezone";
 $coveroff = ($_POST["coveroff"] == "yes") ? "yes" : "no";
$updateset[] = "coveroff = " . sqlesc($coveroff);

 /* ****** */

 if (!$message) {

if ($changedemail) {
$sec = mksecret();
$hash = md5($sec . $email . $sec);
$obemail = rawurlencode($email);
$updateset[] = "editsecret = " . sqlesc($sec);
$thishost = $_SERVER["HTTP_HOST"];
$thisdomain = preg_replace('/^www\./is', "", $thishost);
$body = <<<EOD
You have requested that your user profile (username {$CURUSER["username"]})
on {$site_config["SITEURL"]} should be updated with this email address ($email) as
user contact.

If you did not do this, please ignore this email. The person who entered your
email address had the IP address {$_SERVER["REMOTE_ADDR"]}. Please do not reply.

To complete the update of your user profile, please follow this link:

{$site_config["SITEURL"]}/account-ce.php?id={$CURUSER["id"]}&secret=$hash&email=$obemail

Your new email address will appear in your profile after you do this. Otherwise
your profile will remain unchanged.
EOD;

sendmail($email, "$site_config[SITENAME] profile update confirmation", $body, "From: $site_config[SITEEMAIL]", "-f$site_config[SITEEMAIL]");
$mailsent = 1;
} //changedemail

SQL_Query_exec("UPDATE users SET " . implode(",", $updateset) . " WHERE id = " . $CURUSER["id"]."");
$edited=1;
echo "<br /><br /><center><b><font class='error'>Updated OK</font></b></center><br /><br />";
if ($changedemail) {
echo "<br /><center><b>".T_("EMAIL_CHANGE_SEND")."</b></center><br /><br />";
}
 }else{
echo "<br /><br /><center><b><font class='error'>".T_("ERROR").": ".$message."</font></b></center><br /><br />";
 }// message


end_frame();
}// end do

}//end action

if ($action=="changepw"){

if ($do=="newpassword"){

       $chpassword = $_POST['chpassword'];
       $passagain = $_POST['passagain'];

       if ($chpassword != "") {

if (strlen($chpassword) < 6)
$message = T_("PASS_TOO_SHORT");
if ($chpassword != $passagain)
$message = T_("PASSWORDS_NOT_MATCH");
$chpassword = passhash($chpassword);
                   $secret = mksecret();
}

if ((!$chpassword) || (!$passagain))
$message = "You must enter something!";

begin_frame();
navmenu();

if (!$message){
SQL_Query_exec("UPDATE users SET password = " . sqlesc($chpassword) . ", secret = " . sqlesc($secret) . "  WHERE id = " . $CURUSER["id"]);
echo "<br /><br /><center><b>".T_("PASSWORD_CHANGED_OK")."</b></center>";
logoutcookie();
}else{
echo "<br /><br /><b><center>".$message."</center></b><br /><br />";
}


end_frame();
stdfoot();
die();
}//do

begin_frame(T_("CHANGE_YOUR_PASS"));
navmenu();
?>
   
<form method="post" action="account.php?action=changepw">
<input type="hidden" name="do" value="newpassword" />
   <div class="f-border">
   <br />
   <table border="0" align="center" cellpadding="10">
   <tr class="alt3">
       <td align="right"><b><?php echo T_("NEW_PASSWORD"); ?>:</b></td>
       <td align="left"><input type="password" name="chpassword" size="50" /></td>
   </tr>
   <tr class="alt3">
       <td align="right"><b><?php echo T_("REPEAT"); ?>:</b></td>
       <td align="left"><input type="password" name="passagain" size="50" /></td>
   </tr>
   <tr class="alt2">
       <td colspan="2" align="center">
       <input type="reset" value="<?php echo T_("REVERT"); ?>" />
       <input type="submit" value="<?php echo T_("SUBMIT"); ?>" />
       </td>
   </tr>
   </table>
   <br />
   </div>
</form>
   
<?php
end_frame();
}

stdfoot();
?>
Hi guys,

I took the first post and only applied for new torrents, as I do not wish to spam the shoutbox.
Next I found the last post on this topic interesting, but has it been tested?
I can change the announcement setting once, then no more changes happening.
I am grouping together the option to turn off/on the shoutbox with the option to turn off/on the alerts in the shoutbox.

Update 9th of August: I think I found the issue. With the default value of yes, the account status displays the "visible" status. Field in the database is yes.
However when you select "no" you would expect the field in the database to be updated with "no" as well. This does not happen.
The field is left empty...and next the option to update does not work anymore as it expects a value of either "yes" or "no" in the database field coveroff.

I played around a bit and got it working by changing the code following the same way that the hide shoutbox function is coded.

Attaching my account.php file in the next reply. (please clean up this post by removing the attached account.php files)
Hi guys,

Although appreciate the efforts by Botanicar on trying to make this work with PHP 8.* versions, if no longer supported and still having bugs - then I should not spend time in testing this further.

Let me stick to V3 for now, and see if I can make this work and have some of the mods added, matching the current u2torrents.com site.

Do hope that Torrentrader code will be supported in the future, and not force us to move to totally different code-base.
OK played around a bit, but so far have not been able to register to my test site.
Tried different versions of PHP 8.* and different versions of MariaDB (10.* and 11.*) but after submitting the signup form, no line is added to the users table. And hence next unable to login.

cookies are enabled, no errors in loading the SQL, did change some of the details in the admin user as data as there...but nothing else.

Mysql.php and config.php have been update. and the site is connected to the database. No errors appearing - only new users are not being added to the database.

Will play bit more again in the next couple of days.
Hi Micromonkey,

First of all thank you for your effort in keeping Torrentrader alive and kicking!
Thank you for developing and coding and supporting the 3.8.3 version!
It installed without errors (mostly copy and paste), and I have it running now on:
- MariaDB 11.8.6
- PHP 8.3.30

Have a couple of queries, hope you do not mind me asking:
- Is the code of v3.8.3 a further development from M-Jay's code in use here as "MBitsy"?
- Or is it the "standard" Torrenttrader code modified to work with newer versions of MySQL and PHP?
- Will you be killing the remaining bugs?
- I notice there is a "ExYuSubs / TT-v3.8.3-updates" beside the "ExYuSubs / TT-v3.8.3" folder on Github. Should the files from the "..updates" folder be copied over to the webserver and over-write the current files? Or are these included already in the current 3.8.3 code?
- Does the code have any mods already included? Or would they have to be converted once more to be compatible?

In the past I have been helping M-Jay testing the code and suggesting ideas to be implemented. I am very much interested in helping to have a stable and secure version of the Torrenttrader code - as the site that I support (u2torrents.com) is very much in need of an upgrade to make it more compatible with modern server configs.

Gr. Frank
Nah I do not think so,

I think after the summer break M-Jay had some difficulty restarting from where he left of...
He mentioned in https://torrenttrader.uk/post/10291 that he was going to make the code private due to some serious bugs.

Hope he will be back soon with some fresh updates!

Just give him some time!
Progress — 2023-09-17 18:58:34 in M-BiTsy Support
For now...

Some thoughts...

- Invites come with 10 for registering, the bonus points should be limited in exchanging for new.
They are being mis-used on the old system. Just by staying online and "seeding" you get points - even though you are marked as leecher already. next you invite yourself on new email...and there you go...leeching again.

- Like/unlike torrent, maybe few bonus points with each like? And ofcourse remove when disliked again
- Rate torrent, bonus points?
- Each shout, 0.1 bonus points?
- bookmark torrents, the list of your bookmarks should be able to export. (torrent date, name, uploaded by, ...)
- same for catalog
- Gallery should have simple option to upload a picture, which you can then select in for example your profile or the torrent you have just posted
- I am sorry...what is the difference between mailbox and messages inbox?
- Moviedatabase, please also add music database (discogs)
- Reseed torrent option needs to be limited to max limit (set by admin) per day, is being mis-used in old code
- Today torrents, if is zero...hide block
- Shoutbox, needs reply!!
- Search torrent, is this wild search ?
-
Bug Tracker — 2023-09-09 18:30:25 in M-BiTsy Support
With the code updated in commit 90, I am still not able to load the site without disabling the LEFT/CENTER/RIGHT NAV in the settings. Activation any of them with crash the site.

 'LEFTNAV' => false,
 'RIGHTNAV' => false,
 'MIDDLENAV' => false,

Also there is an error in the language file on line 433 on the ID

Warning: Undefined array key "id" in /data/languages/english.php on line 433
Call Stack
# Time Memory Function Location
1 0.0000 365400 {main}( ) .../index.php:0
2 0.0001 365776 require( '/App/bootstrap.php ) .../index.php:10
3 0.0002 369400 require( '/data/languages/english.php ) .../bootstrap.php:11


Just a check, which PHP modules need to be active on the server?
Is there a minimum MySQL server requirement?
STorrents2020:
This is actually a really good idea and I want to replicate this to a AJAX-based page that allows custom colours and backgrounds to header, sections, font etc, setting the CSS properties on the fly allows instant changes - as they click it saves both ways. Very cool idea!


This is also where I wanna make my changes, or rather keep my changes --> in the themes folder.

Thus by adding specific theme files (like in my example loginfooter) or by changing the custom css file properties u load a whole new theme.
In my css file for example, I currently have:

.card_login {
.card-header_login {
.card-body_login {
.frame-header_login {

Which will have different properties then the normal card/frame settings in the css file, and which would apply to different pages on the site.

I would like to not edit and change the default M-BiTsy code at all so that it can be easily update.
It should be just a configuration change in the settings for the site to load a whole new interface.

This is also why I got confused that I still had to change current system files....which will may get lost with next update of M-BiTsy code.
Thanks for the quick feedback!

So in the controllers folder I use the files in the "user" folder.

Then next, if I want a different header for my block for the login page, I would add the following to the Libraries/Styles.php file correct?



And next call this bit in the Libraries/View.php file correct?



Same for the footer etc?

Or am I doing this totally wrong?
Hi guys,

Need a little bit of help on creating my new theme.

I have created the following:

Controller u2torrents folder. And copied the contact.php login.php recover.php nd signup.php files in there. Each file asked to load the "view" u2torrents.
Views u2torrents folder. And copied the contact.php login.php recover.php nd signup.php files in there - each in their own folder..
Libraries Style.php (inside attached file).
Views.php (inside attached file).

And also copied my assets of images and the theme.

Now when I got my Style and View file configured (hopefully correct) to look for the u2torrents controller and views...I am not seeing the changes in my website.
Instead I need to make changes inside the "user" files to make things work.

This I do not understand fully, and wonder if I missed something here in me changing things.

https://drive.google.com/file/d/1mh9aBy8sqlBYNFD0Okxqax7vfPQtyZo3/view?usp=sharing
Hi guys,

Need a little bit of help on creating my new theme.

I have created the following:

Controller u2torrents folder. And copied the contact.php login.php recover.php nd signup.php files in there. Each file asked to load the "view" u2torrents.
Views u2torrents folder. And copied the contact.php login.php recover.php nd signup.php files in there - each in their own folder..
Libraries Style.php (inside attached file).
Views.php (inside attached file).

And also copied my assets of images and the theme.

Now when I got my Style and View file configured (hopefully correct) to look for the u2torrents controller and views...I am not seeing the changes in my website.
Instead I need to make changes inside the "user" files to make things work.

This I do not understand fully, and wonder if I missed something here in me changing things.
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: 2
  • Members: 0
  • Guests online: 2
  • Comments: 3
  • Messages: 1,728