Find
if ($row["freeleech"] == 1)
$dispname .= " <img src='images/free.gif' border='0' alt='' />";
In backend/functions.php > torrenttable function underneath it add...
$dispname .= ' <form action="index.php" method="post"><input type="hidden" name="torrent" value="'.$row["id"].'" /><input type="submit" value="Thanks!" /></form>';
Open index.php underneath dbconn Add
if ( is_valid_id($_POST['torrent']) )
{
$res = SQL_Query_exec("SELECT `thanks` FROM `torrents` WHERE `id` = " . $_POST['torrent']);
$row = mysql_fetch_assoc($res);
if (!$row) show_error_msg("Error", "Invalid Torrent...", 1);
$thanks = explode(',', $row['thanks']);
if (in_array($CURUSER['username'], $thanks)) show_error_msg("Error", "You have already thanked this torrent.", 1);
$res = sprintf("UPDATE `torrents` SET `thanks` = CONCAT_WS(',', `thanks`, %s) WHERE `id` = %d", sqlesc($CURUSER['username']), $_POST['torrent']);
SQL_Query_exec($res);
header("Refresh: 3; url=index.php");
show_error_msg("Success", "Thanks Added, redirecting...", 1);
}
if you dont have SQL_Query_exec use mysql_query