<?
include $_SERVER[DOCUMENT_ROOT] . "/backoffice/header.php";
include $_SERVER[DOCUMENT_ROOT] . "/module/log/log.lib.php";
if(!in_array("log_manage",$_SESSION[$_SITE["DOMAIN"]]["ADMIN"]["AUTH"]) && $_SESSION[$_SITE["DOMAIN"]]["ADMIN"]["GRADE"]!="ROOT"):
	jsMsg("권한이 없습니다.");
	jsHistory("-1");
endif;
//DB연결
$dblink = SetConn($_conf_db["main_db"]);

//검색날짜 설정
if(!$_REQUEST[s_date]){
	$s_date = date("Y-m-d");
}else{
	$s_date = mysql_real_escape_string($_REQUEST[s_date]);
}

if(!$_REQUEST[e_date]){
	$e_date = date("Y-m-d");
}else{
	$e_date = mysql_real_escape_string($_REQUEST[e_date]);
}


$arrInfo = getAccessCounterHourly($s_date,$e_date);

//_DEBUG($arrInfo);
//DB해제
SetDisConn($dblink);
?>
<div id="admin-container">
	<? include "menu.php"; ?>
    <div id="admin-content">
	<h2 class="admin-title">접속통계</h2>


<table border="0" cellpadding="0" cellspacing="1" width="100%">
	<form method="get" action="<?=$_SERVER[PHP_SELF]?>" name="logViewFrm">
	<tr height="25" align="left">
		<td width="100%">
		<input type="submit" value="조회" style="width:40px;height:22px;"> <input type="text" name="s_date" size="10" class="input datePicker" value="<?=$s_date?>" style="width:100px;"> ~ <input type="text" name="e_date" size="10" class="input datePicker" value="<?=$e_date?>" style="width:100px;">
		<b><?=number_format($arrInfo["list"][0]["hit"])?> 회</b>
		</td>
	</tr>
	</form>
</table>
<table border="0" cellpadding="0" cellspacing="1" width="100%" style="border:1px solid #dedede;">
	<tr bgcolor="#6c7480" height="25" align="center">
		<td width="50%"><font color="#FFFFFF"><b>AM</b></font></td>
		<td width="50%"><font color="#FFFFFF"><b>PM</b></font></td>
	</tr>
	<tr>
		<td valign="top">
		<table border="0" cellpadding="3" cellspacing="1" width="100%">
			<tr align="center" bgcolor="#EEEEEE">
				<td width="10%"><b>시간</b></td>
				<td width="10%"><b>방문수</b></td>
				<td width="10%"><b>시/일</b></td>
				<td width="70%"><b>그래프</b></td>
			</tr>
			<?for($i=0;$i<12;$i++){?>
			<tr align="right">
				<td width="10%" bgcolor="#EEEEEE"><?=$i?> 시</td>
				<td width="10%"><?=number_format($arrInfo["list"][0]["h".$i])?></td>
				<td width="10%"><?=$arrInfo["list"][0]["hit"]!=0?number_format(($arrInfo["list"][0]["h".$i]/$arrInfo["list"][0]["hit"])*100,2):"0"?> %</td>
				<td width="70%" align="left"><table border="0"><tr><td bgcolor="#CCCCCC" width="<?=$arrInfo["list"][0]["hit"]!=0?number_format(($arrInfo["list"][0]["h".$i]/$arrInfo["list"][0]["hit"])*200,0):"0"?>" height="10"></td></tr></table></td>
			</tr>
			<?}?>
		</table>
		</td>
		<td valign="top">
		<table border="0" cellpadding="3" cellspacing="1" width="100%">
			<tr align="center" bgcolor="#EEEEEE">
				<td width="10%"><b>시간</b></td>
				<td width="10%"><b>방문수</b></td>
				<td width="10%"><b>시/일</b></td>
				<td width="70%"><b>그래프</b></td>
			</tr>
			<?for($i=12;$i<24;$i++){?>
			<tr align="right">
				<td width="10%" bgcolor="#EEEEEE"><?=$i?> 시</td>
				<td width="10%"><?=number_format($arrInfo["list"][0]["h".$i])?></td>
				<td width="10%"><?=$arrInfo["list"][0]["hit"]!=0?number_format(($arrInfo["list"][0]["h".$i]/$arrInfo["list"][0]["hit"])*100,2):"0"?> %</td>
				<td width="70%" align="left"><table border="0"><tr><td bgcolor="#CCCCCC" width="<?=$arrInfo["list"][0]["hit"]!=0?number_format(($arrInfo["list"][0]["h".$i]/$arrInfo["list"][0]["hit"])*200,0):"0"?>" height="10"></td></tr></table></td>
			</tr>
			<?}?>
		</table>
		</td>
	</tr>
</table>
	</div>
</div>
<?
include $_SERVER[DOCUMENT_ROOT] . "/backoffice/footer.php" ;
?>