<?
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-d",time());
?>

<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr><td colspan=2>
<?

echo "</td></tr><tr><td width=50%>";

$sql = " select count(*) as cnt from $g4[member_table]";
$row = sql_fetch($sql);
$total_count = $row[cnt];

$rows = 10;
$total_page  = ceil($total_count / $rows);  // 전체 페이지 계산
if ($page == "") { $page = 1; } // 페이지가 없으면 첫 페이지 (1 페이지)
$from_record = ($page - 1) * $rows; // 시작 열을 구함

$mod = 10;

$sql = " select * from $g4[member_table] where mb_id <> '$config[cf_admin]'
          order by mb_point desc, mb_today_login desc 
          limit $from_record, $rows ";
$result = sql_query($sql);
for ($i=0; $row=sql_fetch_array($result); $i++) 
{
    if ($i && $i%$mod==0) 
        echo "</td><td valign=top>";

    $rank = (($page - 1) * $rows) + $i + 1;

    $name = $row[mb_nick];
	//$name = get_sideview($row[mb_id], $row[mb_nick], $row[mb_email], $row[mb_homepage]);
    $point = number_format($row[mb_point]);
    echo "<table width=98% height=22 cellpadding=0 align=center border=0><tr>";
    echo "<td valign=bottom><img src=http://reapier.cdn1.cafe24.com/img/rank/rank_$i.gif width=11 height=11 align=absmiddle>&nbsp;&nbsp;$name";
    echo "</td>";
    echo "<td align=right valign=bottom><font style=font-size:8pt; color=#777777>{$point} 점</font></td>";
    echo "</tr></table>";
}
?>
</td></tr>
</table>
<?
include_once("$g4[path]/tail.sub.php");
?>