Bravo List

Bravo List (http://www.bvlist.com/index.php)
-   TBDev (http://www.bvlist.com/forumdisplay.php?f=20)
-   -   How I can to add new rating system in details.php (http://www.bvlist.com/showthread.php?t=8962)

bestlap 6th March 2013 22:41

How I can to add new rating system in details.php
 
How I can to add new rating system in details.php ? Like this >> http://i.imgur.com/RNu6yWI.jpg

:ok:

Chez 7th March 2013 10:31

2 Attachment(s)
Try this:

SQL:

PHP Code:

CREATE TABLE IF NOT EXISTS `ratings` (
  `
torrentint(10unsigned NOT NULL default '0',
  `
userint(10unsigned NOT NULL default '0',
  `
ratingtinyint(3unsigned NOT NULL default '0',
  `
addeddatetime 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(
                                        
=> "Kewl!",
                                        
=> "Pretty good",
                                        
=> "Decent",
                                        
=> "Pretty bad",
                                        
=> "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"$s1); 


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

DND 7th March 2013 12:07

maybe he wanted the exact rate pics ?


All times are GMT +2. The time now is 05:43.

Powered by vBulletin® Version 3.8.11 Beta 3
Copyright ©2000 - 2024, vBulletin Solutions Inc.