Temos pavadinimas: WordPress, Shopify ir PHPFusion programuotojų bendruomenė :: mlm_panel

Parašė DJManas· 2009 Geg. 2 18:05:40
#1

Gal kas mokate ir galetumete padaryti kad zmones paneleje isdestytu pagul tokia formule Vertinimas(Reitingas)*Balsu skaicius

Buciau labai dekingas nes dabar vertina tik pagal Vertinima(Reitinga) o tai kaip ir siektiek nesamone nes naujas zmogus ateja save isivertina 10 ir jis jau pirmas.

Kodas kuri reiktu pakeisti kazkaip:

<?php
$limit = 25;
$res = dbquery("SELECT * FROM ".$db_prefix."reitingai LEFT JOIN ".$db_prefix."users ON
vartotojo_id = user_id ORDER BY reitingas DESC LIMIT 0,$limit");
echo "<table width='100%'>
<tr>\n";
$x = 1;
while ($d = dbarray($res)) {
    $avatar = $d['user_avatar'] != "" ? $d['user_avatar'] : 0;
    if ($avatar) {
        $size = @getimagesize(IMAGES."avatars/$avatar");
        if (($size[0] >= 60 && $size[1] >= 60) && ($size[0] <= 70 && $size[1] <= 70))

{
            $width = $size[0]-10;
            $height = $size[1]-10;
        } elseif (($size[0] >= 70 && $size[1] >= 70) && ($size[0] <= 80 && $size[1]

<= 80)) {
            $width = $size[0]-20;
            $height = $size[1]-20;
        } elseif (($size[0] >= 80 && $size[1] >= 80) && ($size[0] <= 90 && $size[1]

<= 90)) {
            $width = $size[0]-30;
            $height = $size[1]-30;
        } else {
            $width = round($size[0]);
            $height = round($size[1]);
        }
        $avatar = "<img src='".IMAGES."avatars/$avatar' width='$width'

height='$height'>\n";
    } else {
        $avatar = "<img src='".IMAGES."avatars/noav.gif'>";
    }
    echo ($x%5 == 1 ? "<tr>" : "")."
  <td><img src='".THEME."images/bullet.gif'> <a

href='".BASEDIR."profile.php?lookup=".$d['user_id']."'>".$d['user_name']."</a>
<br>$avatar<br>
Vertinimas: ".round($d['reitingas'],2)."<br>Balsų skaičius: ".dbcount("(*)","user_ratings","rate_subject = '".$d['user_id']."'")."</td>\n".($x%5 == 0 ? "</tr>" : "");

    $x = $x+1;
}
echo "</table>
<table width='100%'>
</tr>
</table>\n";
$result = dbquery("SELECT * FROM ".$db_prefix."users");
while ($data = dbarray($result)) {
    if (!dbcount("(*)","reitingai","vartotojo_id = '".$data['user_id']."'")) {
        if (dbcount("(*)","user_ratings","rate_subject = '".$data['user_id']."'")) {
            $result1 = dbquery("SELECT * FROM ".$db_prefix."user_ratings WHERE

rate_subject = '".$data['user_id']."'");
            $x = 0;
            while ($data1 = dbarray($result1)) $x = $x+$data1['rate_opt'];
            $vert = round($x/dbrows($result1),2);
            dbquery("INSERT INTO ".$db_prefix."reitingai (reitingas,vartotojo_id)

VALUES ('$vert','".$data['user_id']."');");
        }
    } else {
        if (dbcount("(*)","user_ratings","rate_subject = '".$data['user_id']."'")) {
            $result1 = dbquery("SELECT * FROM ".$db_prefix."user_ratings WHERE

rate_subject = '".$data['user_id']."'");
            $x = 0;
            while ($data1 = dbarray($result1)) $x = $x+$data1['rate_opt'];
            $vert = round($x/dbrows($result1),2);
            dbquery("UPDATE ".$db_prefix."reitingai SET reitingas = '$vert' WHERE

vartotojo_id = '".$data['user_id']."'");
        }
    }
}
?>



Redagavo DJManas· 2009 Geg. 2 18:05:27