XIII,
You are the SHIT !!!! :)
Thanks very much
Stolla
You are the SHIT !!!! :)
Thanks very much
Stolla
$dispname = "<b>".$smallname."</b>";
change to...
$dispname = '<b>'.$smallname.'</b><form action="index.php" method="post"><input type="hidden" name="torrent" value="'.$row["id"].'" /><input type="submit" value="Thanks!" /></form>';
case 'dl':
echo "<th class='ttable_head'>".T_("DL")."</th>";and Before add: case 'thanks':
echo "<th class='ttable_head' width=10%>Thanks</td>";
break;
and then search for
case 'dl':
print("<td class=ttable_col$x align=center><a href=\"download.php?id=$id&name=" . rawurlencode($row["filename"]) . "\"><img src=" . $site_config['SITEURL'] . "/images/icon_download.gif border=0 alt=\"Download .torrent\"></a></td>");
and before add:
case 'thanks':
$res_thanks = SQL_Query_exec("SELECT `thanks` FROM torrents WHERE id=".$row["id"]);
$row_thanks = mysql_fetch_row($res_thanks);
mysql_free_result($res_thanks);
$your_thanks = explode(",", $row_thanks[0]);
if (!in_array($CURUSER["username"], $your_thanks)) {
$mythank = '<form action="thanks2.php" method="post"><input type="hidden" name="torrent" value="'.$row["id"].'" /><input type="submit" value="Thanks!" /></form>';
print("<td class=ttable_col$x align=center>$mythank</td>");
} else {
print("<td class=ttable_col$x align=center>Thanks<br />Added</td>");
}
break;
now create a new file called thanks2.php with the following stuff and upload it the root of your server aka where index.php is <?php
require_once("backend/functions.php");
dbconn(false);
loggedinonly();
$id = (int)$_POST['torrent'];
if (!is_valid_id($id)) die;
$res = mysql_query("SELECT `thanks` FROM torrents WHERE id=$id");
$row = mysql_fetch_assoc($res);
mysql_free_result($res);
if (!$row) show_error_msg("Error", "Sorry no .torrent found with this ID, it has probably been deleted.",1);
$thanksl = explode(",", $row['thanks']);
if (in_array($CURUSER['username'], $thanksl)) show_error_msg("Error", "You have already left thanks for this torrent.",1);
mysql_query(sprintf("UPDATE `torrents` SET thanks = CONCAT_WS(',', `thanks`, %s) WHERE `id`=%d", sqlesc($CURUSER['username']), $id)) or die(mysql_error());
$referring_url = $_SERVER['HTTP_REFERER'];
$requested_url = $_SERVER['REQUEST_URI'];
header("Refresh: 3;url=$referring_url");
show_error_msg("Success", "Thanks added.<BR>Redirecting...", 1);
?>
after that to get it to not show the thanks button if already thanked in index.php find
, torrents.anon
and replace it with
, torrents.anon, torrents.thanks
$site_config["torrenttable_columns"] = "category,name,dl,uploader,comments,size,speed,seeders,leechers,completed,wai
t,added,imdb,nfo,health";to$site_config["torrenttable_columns"] = "category,name,dl,uploader,comments,size,speed,seeders,leechers,completed,wai
t,added,thanks,imdb,nfo,health";
No users online
Torrents
Members
Online