Bravo List
Register
Go Back   > Bravo List > Source Code > Archived Trackers > TBDev
Reply
Thread Tools
  #1  
Old 6th March 2013, 22:41
bestlap bestlap is offline
Senior Member
 
Join Date: Nov 2012
P2P
Posts: 51
Default How I can to add new rating system in details.php
How I can to add new rating system in details.php ? Like this >> Click the image to open in full size.

Reply With Quote
  #2  
Old 7th March 2013, 10:31
Chez's Avatar
Chez Chez is offline
Senior Member
 
Join Date: Sep 2011
P2P
Posts: 278
Default
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"]) . "&amp;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
Attached Files
File Type: php takerate.php (1.0 KB, 22 views)
File Type: rar pic.rar (3.8 KB, 19 views)
__________________
http://www.bvlist.com/images/avatars/signaturepics/sigpic16443_2.gif
Reply With Quote
The Following User Says Thank You to Chez For This Useful Post:
FENIX (7th March 2013)
  #3  
Old 7th March 2013, 12:07
DND DND is offline
VIP
 
Join Date: Dec 2008
Posts: 1,242
Default
maybe he wanted the exact rate pics ?
Reply With Quote
Reply

Tags
add , detailsphp , rating , system


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



All times are GMT +2. The time now is 20:26. vBulletin skin by ForumMonkeys. Powered by vBulletin® Version 3.8.11 Beta 3
Copyright ©2000 - 2024, vBulletin Solutions Inc.