<?php
	if ($_GET['seek'].'' <> '') {
		$seek = $_GET['seek'];
	} else {
		$seek = 0;
	}
	require("__include-common.php");
	require("../account/__logincheck.php");
	html_header(HTML_TITLE);
	page_header();
	contents_header();
	if ($_SESSION['システム管理者'] == "YES") {
		print_loginlog($seek);
	}
	page_footer();
	html_footer();
	exit();
function print_loginlog($seek) {
?>
	<div id="log_list_body">
	<h2>MyHome Portal ログイン履歴表示</h2><br>
	DB：<span class="db_table_name"><?= _DB_SCHEMA ?></span> TABLE：<span class="db_table_name">z_loginlog</span>
<?php
	$seek_max = $seek + LOGINLOG_MAXREC;
	$con = my_mysql_connect(_DB_SCHEMA);
	$sql = "select * from z_loginlog order by id desc";
	$rs = my_mysql_query($sql);
	$rowcnt = mysql_num_rows($rs);
?>
	&nbsp;ログ件数：<span class="db_table_name"><?= $rowcnt ?></span>件
	&nbsp;最新：<span class="db_table_name"><?= $seek+1 ?></span>～<span class="db_table_name"><?= $seek_max ?></span>
	&nbsp;<a href="?seek=0">[先頭]</a>
	&nbsp;<a href="?seek=<?= $seek_max ?>">[→次]</a><br><br>
<?php
	if ($rowcnt <= $seek) {
		error_msg("ログがありません。");
		return;
	}
	mysql_data_seek($rs, $seek);
?>
	<table id="log_table" cellspacing=1>
	<tr><th><br></th><th>id_account</th><th>c_account</th><th>c_logintime</th><th>c_status</th><th>c_change_id</th><th>id</th></tr>
<?php
	$cnt = $seek;
	while ($rec=mysql_fetch_array($rs) and ++$cnt <= $seek_max) {
?>
		<tr>
		<td style="text-align: right;"><?= $cnt ?></td>
		<td><?= $rec['id_account'] ?></td>
		<td><?= $rec['c_account'] ?></td>
		<td><?= $rec['c_logintime'] ?></td>
		<td><?= $rec['c_status'] ?></td>
		<td><?= $rec['c_change_id'] ?></td>
		<td><?= $rec['id'] ?></td>
		</tr>
<?php
	}
	$con = mysql_close($con);
?>
	</table>
	</div>
<?php
}
?>
