Try this:
SQL:
PHP Code:
CREATE TABLE IF NOT EXISTS `ratings` (
`torrent` int(10) unsigned NOT NULL default '0',
`user` int(10) unsigned NOT NULL default '0',
`rating` tinyint(3) unsigned NOT NULL default '0',
`added` datetime NOT NULL default '0000-00-00 00:00:00',
PRIMARY KEY (`torrent`,`user`),
KEY `user` (`user`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
In
details.php after:
PHP Code:
tr("Size",mksize($row["size"]) . " (" . number_format($row["size"]) . " bytes)");
ADD:
PHP Code:
$s = "";
$s .= "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\"><tr><td valign=\"top\" class=embedded>";
if (!isset($row["rating"])) {
if ($minvotes > 1) {
$s .= "none yet (needs at least $minvotes votes and has got ";
if ($row["numratings"])
$s .= "only " . $row["numratings"];
else
$s .= "none";
$s .= ")";
}
else
$s .= "No votes yet";
}
else {
$rpic = ratingpic($row["rating"]);
if (!isset($rpic))
$s .= "invalid?";
else
$s .= "$rpic (" . $row["rating"] . " out of 5 with " . $row["numratings"] . " vote(s) total)";
}
$s .= "\n";
$s .= "</td><td class=embedded>$spacer</td><td valign=\"top\" class=embedded>";
if (!isset($CURUSER))
$s .= "(<a href=\"login.php?returnto=" . urlencode($_SERVER["REQUEST_URI"]) . "&nowarn=1\">Log in</a> to rate it)";
else {
$ratings = array(
5 => "Kewl!",
4 => "Pretty good",
3 => "Decent",
2 => "Pretty bad",
1 => "Sucks!",
);
if (!$owned || $moderator) {
$xres = mysql_query("SELECT rating, added FROM ratings WHERE torrent = $id AND user = " . $CURUSER["id"]);
$xrow = mysql_fetch_array($xres);
if ($xrow)
$s .= "(you rated this torrent as \"" . $xrow["rating"] . " - " . $ratings[$xrow["rating"]] . "\")";
else {
$s .= "<form method=\"post\" action=\"takerate.php\"><input type=\"hidden\" name=\"id\" value=\"$id\" />\n";
$s .= "<select name=\"rating\">\n";
$s .= "<option value=\"0\">(add rating)</option>\n";
foreach ($ratings as $k => $v) {
$s .= "<option value=\"$k\">$k - $v</option>\n";
}
$s .= "</select>\n";
$s .= "<input type=\"submit\" value=\"Vote!\" />";
$s .= "</form>\n";
}
}
}
$s .= "</td></tr></table>";
tr("Rating", $s, 1);
Download attached file
takerate.php and put iti in
root folder, finally download the archive file, extract the files from it and upload to
pic folder and that's it. Hope that i don't forget something. Hope it will work