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']; $info = "[ ".($total<=0?"":"+")."$total ]"; } else { $info = "[ 0 ]"; } return $info; }