<?
include_once("./_common.php");

$g4[title] = $config[cf_home_name]." > 출근기록부";
include_once("$g4[path]/_head.php");

$today = $g4[time_ymd];

// 총 출석자 확인 
$sql = " select count(*) as cnt from $g4[member_table] where mb_today_login like '$today%' and mb_id != '$config[cf_admin]' order by mb_today_login"; $row = sql_fetch($sql); 
$today_visit = $row[cnt]; 


//#########--------- 출석회원중 현재 로그인상태인 회원은 '접속중' 으로 표시 
function dev_online($mb_id) 
{ 
    global $g4; 
	if ($mb_id) { 
		$sql = "select mb_id, lo_location from $g4[login_table] where mb_id='$mb_id'"; 
		$result = @sql_fetch($sql); 
	
		if($result[mb_id]) { 
			$online_message="접속중"; 
		} 
		else { 
		$online_message=""; 
		} 
	return $online_message; 
	} 
} 
//#########---------- END (위부분은 developer.lib.php에 삽입해도 됨) 

?> 

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

<table align=center cellpadding="0" cellspacing="0" width="98%"> 
<tr> 
	<td height=30 align=right valign=bottom>Total <?=$today_visit?> 명&nbsp;</td> 
</tr> 
</table> 


<table width=98% align=center>
<tr height=32 align=center>
	<td width="40" background="<?=$g4[path]?>/img/board_tit_bg1.gif">순서</td>
	<td width="70" background="<?=$g4[path]?>/img/board_tit_bg1.gif">출근시간</td>
	<td width="60" background="<?=$g4[path]?>/img/board_tit_bg1.gif">레벨</td>
	<td width="80" background="<?=$g4[path]?>/img/board_tit_bg1.gif">별명</td>
	<td width="80" background="<?=$g4[path]?>/img/board_tit_bg1.gif">접속여부</td>
	<td width=""     background="<?=$g4[path]?>/img/board_tit_bg1.gif">아이디</td>
	<td width="80" background="<?=$g4[path]?>/img/board_tit_bg1.gif">포인트</td>
</tr>

<?
$mb_level = $mb[mb_level];
$sql = " select mb_id, mb_name, mb_nick, mb_level, mb_email, mb_homepage, mb_open, mb_today_login, mb_point
           from $g4[member_table]
          where SUBSTRING(mb_today_login,1,10) = '$today'
            and mb_level < '10'
          order by mb_today_login asc ";
$result = sql_query($sql);

$k=0;
$save_time = "";
for ($i=1; $row=sql_fetch_array($result); $i++) 
{

    $mb_nick = get_sideview($row[mb_id], $row[mb_nick], $row[mb_email], $row[mb_homepage]);

	$mb_name = get_sideview($row[mb_id], $row[mb_name], $row[mb_email], $row[mb_homepage]);

	$online_now = dev_online($row[mb_id]);  //---------############## 로그인상태임을 나타내는 함수불러옴 
	
	$bgcolor = ($i%2) ? "#FFFDF7" : "#FFFFFF";

    if ($row[mb_id] == $member[mb_id])
        $bgcolor = "#FCECBC";

    if ($save_time != substr($row[mb_today_login],11,8))
    {
        $save_time = substr($row[mb_today_login],11,8);
        $k = $i;
    }
?>

    <tr bgcolor='<?=$bgcolor?>' onmouseout=this.bgColor='<?=$bgcolor?>' onmouseover=this.bgColor='#FFF3E7'>
        <td align=center height=25><?=$k?></td>
        <td align=center><?=$save_time?></td>
	    <td align=center><?=$row[mb_level];?></td>
		<td align=center><?=$mb_nick ?></td>
		<td align=center><?=$online_now?></td>
		<td align=center><?=$row[mb_id]?></td>
        <td align=right><?=number_format($row[mb_point])?>점&nbsp;</td>
    </tr>
    <tr><td colspan=10 height=1 bgcolor='#E0E0E0'></td></tr>
<? } ?>
<tr><td colspan=10 height=7 background="<?=$g4[path]?>/img/board_bottom_bar.gif"></td></tr>
</table>

<?
include_once("$g4[path]/_tail.php");
?>