5) bark(_("invalid rating")); $res = do_mysql_query("SELECT owner FROM torrents WHERE id = $id"); $row = mysql_fetch_array($res); if (!$row) bark(_("no such torrent")); //if ($row["owner"] == $CURUSER["id"]) // bark("You can't vote on your own torrents."); $res = do_mysql_query("INSERT DELAYED INTO ratings (torrent, user, rating, added) VALUES ($id, " . $CURUSER["id"] . ", $rating, NOW())"); if (!$res) { if (mysql_errno() == 1062) bark("You have already rated this torrent."); else bark(mysql_error()); } do_mysql_query("UPDATE LOW_PRIORITY torrents SET numratings = numratings + 1, ratingsum = ratingsum + $rating WHERE id = $id"); header("Refresh: 0; url=details.php?id=$id&rated=1"); ?>