Location: PHPKode > projects > H-tracker > thanks.php
<?
//
//  H-Tracker v0.2
//    http://h-tracker.org
//    Based on TorrentTrader (http://www.torrenttrader.org)
//
//
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());
autolink("torrents-details.php?id=$id", "Thanks added"); 
?>
Return current item: H-tracker