특정 게시판 월별 포인트 순위 정보
특정 게시판 월별 포인트 순위
본문
특정 게시판의 월별 포인트 순위를 뽑고 싶은데요..
아래 소스를 특정 게시판만 지정해서 사용 가능하도록 할순 없을까요??
====================================================================================
<?
include_once("./_common.php");
$g4[title] = "월별 포인트 적립 순위";
include_once("$g4[path]/head.sub.php");
echo "<script language=\"javascript\" src=\"$g4[path]/js/sideview.js\"></script>\n";
$nowdate = date("Y-m",time()); // 이번달
$sYear = substr($nowdate, 0, 4)."년";
$sMonth = substr($nowdate,5,2)."월";
$sql = "SELECT * , COUNT(B.mb_id ) AS count, SUM( B.po_point ) AS point
FROM $g4[member_table] as A
LEFT JOIN $g4[point_table] as B ON ( A.mb_id = B.mb_id AND A.mb_level < 8 AND A.mb_point >= 3000) where date_format(B.po_datetime,'%Y-%m') = '$nowdate' group by B.mb_id order by point desc LIMIT 0, 10 ";
$result = sql_query($sql);
?>
<style type="text/css">
.title_font {font-size:9pt;color:#ffffff;}
</style>
<table width="330" cellpadding=0 cellspacing=0>
<tr>
<td align="center" style="padding:5px;color:#8b5aad;"><strong><?=$sYear?> <?=$sMonth?> 적립 포인트 실시간 순위(1위~10위)</strong> </td>
</tr>
<tr>
<td valign="top">
<table border="0" cellpadding="0" cellspacing="0">
<tr bgcolor="#8b5aad">
<td width="5"><img src="<?=$g4['path']?>/img/rank/l_img.gif" border="0"></td>
<td width="40" height="52" align="center" class="title_font">순위</td>
<td width="120" class="title_font" align="center">닉네임</td>
<td width="80" class="title_font" align="right" style="padding-right:10px;">12월 적립<br> 포인트</td>
<td width="80" class="title_font" align="right" style="padding-right:10px;">총 적립<br> 포인트</td>
<td width="5"><img src="<?=$g4['path']?>/img/rank/r_img.gif" border="0"></td>
</tr>
<?
for ($i=1; $row=sql_fetch_array($result); $i++)
{
$name = get_sideview($row[mb_id], $row[mb_nick], $row[mb_email], $row[mb_homepage]);
$point = number_format($row[point]);
$mb_point= number_format($row[mb_point]);
?>
<tr>
<td height="24"></td>
<td><img src="<?=$g4['path']?>/img/rank/<?=$i?>.gif" border="0" align=absmiddle> <?if ($i<=5) echo "<img src=".$g4[path]."/img/rank/".$i."_icon.gif align=absmiddle>";?></td>
<td align="center"><?=$name?></td>
<td align="right" style="padding-right:10px;color:#FF0000;"><?=$point?></td>
<td align="right" style="padding-right:10px;"><?=$mb_point?></td>
<td></td>
</tr>
<tr>
<td colspan="6" bgcolor="#d6d6d6" height="1"></td>
</tr>
<?}?>
</table>
</td>
</tr>
</table>
아래 소스를 특정 게시판만 지정해서 사용 가능하도록 할순 없을까요??
====================================================================================
<?
include_once("./_common.php");
$g4[title] = "월별 포인트 적립 순위";
include_once("$g4[path]/head.sub.php");
echo "<script language=\"javascript\" src=\"$g4[path]/js/sideview.js\"></script>\n";
$nowdate = date("Y-m",time()); // 이번달
$sYear = substr($nowdate, 0, 4)."년";
$sMonth = substr($nowdate,5,2)."월";
$sql = "SELECT * , COUNT(B.mb_id ) AS count, SUM( B.po_point ) AS point
FROM $g4[member_table] as A
LEFT JOIN $g4[point_table] as B ON ( A.mb_id = B.mb_id AND A.mb_level < 8 AND A.mb_point >= 3000) where date_format(B.po_datetime,'%Y-%m') = '$nowdate' group by B.mb_id order by point desc LIMIT 0, 10 ";
$result = sql_query($sql);
?>
<style type="text/css">
.title_font {font-size:9pt;color:#ffffff;}
</style>
<table width="330" cellpadding=0 cellspacing=0>
<tr>
<td align="center" style="padding:5px;color:#8b5aad;"><strong><?=$sYear?> <?=$sMonth?> 적립 포인트 실시간 순위(1위~10위)</strong> </td>
</tr>
<tr>
<td valign="top">
<table border="0" cellpadding="0" cellspacing="0">
<tr bgcolor="#8b5aad">
<td width="5"><img src="<?=$g4['path']?>/img/rank/l_img.gif" border="0"></td>
<td width="40" height="52" align="center" class="title_font">순위</td>
<td width="120" class="title_font" align="center">닉네임</td>
<td width="80" class="title_font" align="right" style="padding-right:10px;">12월 적립<br> 포인트</td>
<td width="80" class="title_font" align="right" style="padding-right:10px;">총 적립<br> 포인트</td>
<td width="5"><img src="<?=$g4['path']?>/img/rank/r_img.gif" border="0"></td>
</tr>
<?
for ($i=1; $row=sql_fetch_array($result); $i++)
{
$name = get_sideview($row[mb_id], $row[mb_nick], $row[mb_email], $row[mb_homepage]);
$point = number_format($row[point]);
$mb_point= number_format($row[mb_point]);
?>
<tr>
<td height="24"></td>
<td><img src="<?=$g4['path']?>/img/rank/<?=$i?>.gif" border="0" align=absmiddle> <?if ($i<=5) echo "<img src=".$g4[path]."/img/rank/".$i."_icon.gif align=absmiddle>";?></td>
<td align="center"><?=$name?></td>
<td align="right" style="padding-right:10px;color:#FF0000;"><?=$point?></td>
<td align="right" style="padding-right:10px;"><?=$mb_point?></td>
<td></td>
</tr>
<tr>
<td colspan="6" bgcolor="#d6d6d6" height="1"></td>
</tr>
<?}?>
</table>
</td>
</tr>
</table>
댓글 전체
$sql = "
SELECT * , COUNT(B.mb_id ) AS count, SUM( B.po_point ) AS point
FROM $g4[member_table] as A
LEFT JOIN $g4[point_table] as B
ON ( A.mb_id = B.mb_id AND A.mb_level < 8 AND A.mb_point >= 3000)
where date_format(B.po_datetime,'%Y-%m') = '$nowdate'
group by B.mb_id order by point desc LIMIT 0, 10 ";
==>
$sql = "
SELECT * , COUNT(B.mb_id ) AS count, SUM( B.po_point ) AS point
FROM $g4[member_table] as A
LEFT JOIN $g4[point_table] as B
ON ( A.mb_id = B.mb_id AND A.mb_level < 8 AND A.mb_point >= 3000)
where date_format(B.po_datetime,'%Y-%m') = '$nowdate'
and B.po_rel_table = '해당테이블 참조명' // <== 이구문 추가
group by B.mb_id order by point desc LIMIT 0, 10 ";
확실한건 해봐야 겠지만 이렇게 변경하심 되겠네요~
SELECT * , COUNT(B.mb_id ) AS count, SUM( B.po_point ) AS point
FROM $g4[member_table] as A
LEFT JOIN $g4[point_table] as B
ON ( A.mb_id = B.mb_id AND A.mb_level < 8 AND A.mb_point >= 3000)
where date_format(B.po_datetime,'%Y-%m') = '$nowdate'
group by B.mb_id order by point desc LIMIT 0, 10 ";
==>
$sql = "
SELECT * , COUNT(B.mb_id ) AS count, SUM( B.po_point ) AS point
FROM $g4[member_table] as A
LEFT JOIN $g4[point_table] as B
ON ( A.mb_id = B.mb_id AND A.mb_level < 8 AND A.mb_point >= 3000)
where date_format(B.po_datetime,'%Y-%m') = '$nowdate'
and B.po_rel_table = '해당테이블 참조명' // <== 이구문 추가
group by B.mb_id order by point desc LIMIT 0, 10 ";
확실한건 해봐야 겠지만 이렇게 변경하심 되겠네요~
아! 감사합니다 한번 적용해보겠습니다!!!