AvocadoAmber/AvocadoEdition_Light/adm/visit_list.php

123 lines
3.6 KiB
PHP
Raw Normal View History

2022-09-17 20:50:50 +09:00
<?php
$sub_menu = "200800";
2024-09-23 11:07:19 +09:00
include_once "./_common.php";
2022-09-17 20:50:50 +09:00
auth_check($auth[$sub_menu], 'r');
$g5['title'] = '접속자집계';
2024-09-23 11:07:19 +09:00
include_once "./visit.sub.php";
2022-09-17 20:50:50 +09:00
$colspan = 6;
$sql_common = " from {$g5['visit_table']} ";
$sql_search = " where vi_date between '{$fr_date}' and '{$to_date}' ";
2024-09-22 10:46:52 +09:00
if (isset($domain) && is_string($domain)) {
2024-09-19 20:57:39 +09:00
$sql_search .= " and vi_referer like '%{$domain}%' ";
2024-09-22 10:46:52 +09:00
}
2022-09-17 20:50:50 +09:00
$sql = " select count(*) as cnt
{$sql_common}
{$sql_search} ";
$row = sql_fetch($sql);
$total_count = $row['cnt'];
$rows = $config['cf_page_rows'];
2024-09-19 20:57:39 +09:00
$total_page = ceil($total_count / $rows); // 전체 페이지 계산
if ($page < 1)
$page = 1; // 페이지가 없으면 첫 페이지 (1 페이지)
2022-09-17 20:50:50 +09:00
$from_record = ($page - 1) * $rows; // 시작 열을 구함
$sql = " select *
{$sql_common}
{$sql_search}
2024-09-30 01:58:32 +09:00
ORDER BY vi_id DESC
2022-09-17 20:50:50 +09:00
limit {$from_record}, {$rows} ";
$result = sql_query($sql);
?>
<div class="tbl_head01 tbl_wrap">
2024-09-19 20:57:39 +09:00
<table>
2022-09-17 20:50:50 +09:00
<caption><?php echo $g5['title']; ?> 목록</caption>
<thead>
2024-09-19 20:57:39 +09:00
<tr>
2022-09-17 20:50:50 +09:00
<th scope="col">IP</th>
<th scope="col">접속 경로</th>
<th scope="col">브라우저</th>
<th scope="col">OS</th>
<th scope="col">접속기기</th>
<th scope="col">일시</th>
2024-09-19 20:57:39 +09:00
</tr>
2022-09-17 20:50:50 +09:00
</thead>
<tbody>
2024-09-19 20:57:39 +09:00
<?php
for ($i = 0; $row = sql_fetch_array($result); $i++) {
2022-09-17 20:50:50 +09:00
$brow = $row['vi_browser'];
2024-09-19 20:57:39 +09:00
if (!$brow)
$brow = get_brow($row['vi_agent']);
2022-09-17 20:50:50 +09:00
$os = $row['vi_os'];
2024-09-19 20:57:39 +09:00
if (!$os)
$os = get_os($row['vi_agent']);
2022-09-17 20:50:50 +09:00
$device = $row['vi_device'];
$link = '';
$link2 = '';
$referer = '';
$title = '';
if ($row['vi_referer']) {
2024-09-19 20:57:39 +09:00
$referer = get_text(cut_str($row['vi_referer'], 255, ''));
$referer = urldecode($referer);
2022-09-17 20:50:50 +09:00
2024-09-19 20:57:39 +09:00
if (!is_utf8($referer)) {
$referer = iconv_utf8($referer);
}
2022-09-17 20:50:50 +09:00
2024-09-19 20:57:39 +09:00
$title = str_replace(array('<', '>', '&'), array("&lt;", "&gt;", "&amp;"), $referer);
$link = '<a href="' . get_text($row['vi_referer']) . '" target="_blank">';
2024-09-19 20:57:39 +09:00
$link = str_replace('&', "&amp;", $link);
$link2 = '</a>';
2022-09-17 20:50:50 +09:00
}
if ($is_admin == 'super')
2024-09-19 20:57:39 +09:00
$ip = $row['vi_ip'];
2022-09-17 20:50:50 +09:00
else
2024-09-19 20:57:39 +09:00
$ip = preg_replace("/([0-9]+).([0-9]+).([0-9]+).([0-9]+)/", G5_IP_DISPLAY, $row['vi_ip']);
if ($brow == '기타') {
$brow = '<span title="' . get_text($row['vi_agent']) . '">' . $brow . '</span>';
}
if ($os == '기타') {
$os = '<span title="' . get_text($row['vi_agent']) . '">' . $os . '</span>';
}
$bg = 'bg' . ($i % 2);
?>
<tr class="<?php echo $bg; ?>">
<td class="td_category"><?php echo $ip ?></td>
<td><?php echo $link ?><?php echo $title ?><?php echo $link2 ?></td>
<td class="td_category td_category1"><?php echo $brow ?></td>
<td class="td_category td_category3"><?php echo $os ?></td>
<td class="td_category td_category2"><?php echo $device; ?></td>
<td class="td_datetime"><?php echo $row['vi_date'] ?> <?php echo $row['vi_time'] ?></td>
</tr>
<?php
}
if ($i == 0)
echo '<tr><td colspan="' . $colspan . '" class="empty_table">자료가 없거나 관리자에 의해 삭제되었습니다.</td></tr>';
?>
2022-09-17 20:50:50 +09:00
</tbody>
2024-09-19 20:57:39 +09:00
</table>
2022-09-17 20:50:50 +09:00
</div>
<?php
if (isset($domain))
2024-09-19 20:57:39 +09:00
$qstr .= "&amp;domain=$domain";
2022-09-17 20:50:50 +09:00
$qstr .= "&amp;page=";
$pagelist = get_paging($config['cf_write_pages'], $page, $total_page, "{$_SERVER['SCRIPT_NAME']}?$qstr");
echo $pagelist;
2024-09-23 11:07:19 +09:00
include_once "./admin.tail.php";
2024-10-07 10:35:20 +09:00