Download Ratings (1-10)
Author Message
c0rrupt
Administrator


Posts: 251
Joined: Mar 2010
Post: #1
Download Ratings (1-10)
0
0
open modules/wcddl_dlratings.php

Find:
<?php
if(!defined("WCDDL_GUTS"))
    exit;
/*BEGIN_INFO
Download Ratings Module.
END_INFO*/
function downloadRating() {
    global $core;
    if(isset($_POST['rate']))
        $ratePost = $_POST['rate'];
    if(!isset($ratePost) || !in_array($ratePost,array(1,2,3,4,5))) {
        $rateHTML = '<form action="" method="post">
        Rate this Download:

        <select name="rate">';
        for($i=1;$i<=5;$i++) {
            $rateHTML .= '<option value="'.$i.'">'.$i.'</option>';
        }
        $rateHTML .= '</select>
        <input type="submit" value="Rate!" />
        </form>';
    } else {
        $currentRate = mysql_query("SELECT rating FROM wcddl_downloads WHERE id = '".$core->id."'");
        $currentRate = mysql_result($currentRate,0);
        $newRate = ($currentRate+$ratePost)/2;
        mysql_query("UPDATE wcddl_downloads SET rating = '".mysql_real_escape_string($newRate)."' WHERE id = '".$core->id."'");
        $rateHTML = 'Download rated!';
    }
    $core->setTemplateVar("downloadRating",$rateHTML);
}

$core->attachHook("endFetchDownload","downloadRating");
?>


Replace With:

<?php
if(!defined("WCDDL_GUTS"))
    exit;
function downloadRating() {
    global $core;
    if(isset($_POST['rate']))
        $ratePost = $_POST['rate'];
    if(!isset($ratePost) || !in_array($ratePost,array(1,2,3,4,5,6,7,8,9,10))) {
        $rateHTML = '<form action="" method="post">
        Rate this style:

        <select name="rate">';
        for($i=1;$i<=10;$i++) {
            $rateHTML .= '<option value="'.$i.'">'.$i.'</option>';
        }
        $rateHTML .= '</select>
        <input type="submit" value="Rate!" />
        </form>';
    } else {
        $currentRate = mysql_query("SELECT rating FROM wcddl_downloads WHERE id = '".$core->id."'");
        $currentRate = mysql_result($currentRate,0);
        $newRate = ($currentRate+$ratePost)/2;
        mysql_query("UPDATE wcddl_downloads SET rating = '".mysql_real_escape_string($newRate)."' WHERE id = '".$core->id."'");
        $rateHTML = 'style has been rated!
thank you.';
    }
    $core->setTemplateVar("downloadRating",$rateHTML);
}

$core->attachHook("endFetchDownload","downloadRating");
?>

Quote:
Change These Lines For Your Own Rating's

Find:
for($i=1;$i<=10;$i++)
Change 10 To Your Number.

And:
Find:
array(1,2,3,4,5,6,7,8,9,10)
Change 1,2,3,4,5,6,7,8,9,10 To Your Numbers.

Upload Done! Smile

Be sure to visit WCDDL.org Affiliates
04-27-2010 06:56 AM




User(s) browsing this thread: 1 Guest(s)

This forum uses Lukasz Tkacz MyBB addons.