Parašė Scarletas· 2013 Vas. 13 16:02:20
#2
Prašau, peržiūrėti narių reputacijas gali tik administratoriai, o duoti reputaciją nariams visi vartotojai.
function userreputation($user_id, $post_id="", $type="") {
global $db_prefix;
$result = dbquery("SELECT
SUM(IF(type=1,1,-1)) as total FROM ".$db_prefix."reputation WHERE to_id =
'$user_id' GROUP BY to_id");
if (dbrows($result) != 0) {
$data = dbarray($result);
$total = $data['total'];
if (iADMIN) {
$info = "<sup><strong>Reputacija:</strong><a style='cursor:help;'
href='reputation.php?uid=$user_id&pid=$post_id'><font
color='".($total<0?"red":($total>0?"green":"black"))."'><b>".($total<=0?"":"+")."$total</b></font></a></sup>";
} else {
$info = "<sup><strong>Reputacija:</strong><font
color='".($total<0?"red":($total>0?"green":"black"))."'><b>".($total<=0?"":"+")."$total</b></font></sup>";
}
} else {
$info = "<sup><strong>Reputacija:</strong><a style='cursor:help;'
href='reputation.php?uid=$user_id&pid=$post_id'><font color='green'> <b>0</b>
Suteikti</font></a></sup>";
}
return $info;
}