<script language="javascript" src="<?=$g4[path]?>/js/sideview.js"></script>

<?
$nowdate = date("Y-m-d",time());

$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);
?>

<table align="center" cellpadding="0" cellspacing="0" width="100%" border="0">
	<tr height="1">
		<td bgcolor="#d9d9d9" colspan="3"></td>
	</tr>
	<tr>
		<td width="1" bgcolor="#d9d9d9"></td>
		<td>
		<table cellpadding="0" cellspacing="2" width="100%">
			<tr>
				<td background="<?=$g4[path]?>/img/title_bg_25.gif">
				<table cellpadding="5" cellspacing="0" width="100%" border="0">
					<tr height="25">
						<td style="font-weight:bold;">&nbsp;포인트 순위</td>						
					</tr>
				</table>
				</td>
			</tr>
		</table>		
		</td>
		<td width="1" bgcolor="#d9d9d9"></td>
	</tr>
	<tr height="1">
		<td bgcolor="#d9d9d9" colspan="3"></td>
	</tr>
</table>

<table align="center" cellpadding="0" cellspacing="0" width="100%" border="0">
	<tr height="4">
		<td width="1" bgcolor="#d9d9d9"></td>
		<td colspan="5"></td>
		<td width="1" bgcolor="#d9d9d9"></td>
	</tr>
	<?
	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]);
	?>
	<tr>
		<td width="1" bgcolor="#d9d9d9"></td>
		<td width="15"></td>
		<td width="20" height="21"><img src="http://reapier.cdn1.cafe24.com/img/rank/rank_<?=$i?>.gif" width=11 height=11 align=absmiddle></td>
		<td width="110" style="padding-top:3px;"><?=$name?></td>
		<td align="right" class="small"><?=$point?> 점</td>
		<td width="15"></td>
		<td width="1" bgcolor="#d9d9d9"></td>
	</tr>
	<? } ?>
	<tr height="3">
		<td width="1" bgcolor="#d9d9d9"></td>
		<td colspan="5"></td>
		<td width="1" bgcolor="#d9d9d9"></td>
	</tr>
	<tr height="1">
		<td bgcolor="#d9d9d9" colspan="7"></td>
	</tr>
</table>
