<?
require_once("include/bittorrent.php");

hit_start();
dbconn();

hit_count();

loggedinorreturn();
$userid = $CURUSER["id"];
$torrentid = $_POST["torrentid"];

$res4 = mysql_query("SELECT id FROM thanks WHERE torrentid=$torrentid AND userid=$userid");
if (mysql_num_rows($res4) == 0){
if (isset($userid) && isset($torrentid))
{
$res = mysql_query("INSERT INTO thanks (torrentid, userid) VALUES ($torrentid, $userid)");
$returl = "details.php?id=$torrentid&thanks=1";
header("Refresh: 0; url=$returl");

hit_end();
}
}
else{
$returl = "details.php?id=$torrentid&nothanks=1";
header("Refresh: 0; url=$returl");
hit_end();
}

?>