40 lines
1.4 KiB
PHP
40 lines
1.4 KiB
PHP
<?php
|
|
/**
|
|
* admin/visits_data.php —— 风控管理页局部刷新接口(返回 HTML 片段,供本页 AJAX 替换,不整页跳转)
|
|
* 用法:
|
|
* visits_data.php?section=access&mode=full|compact&ip=&q=&page=2 访问记录
|
|
* visits_data.php?section=loginfail&lf=203.0 登录失败日志
|
|
*/
|
|
$P = '../';
|
|
require_once dirname(__DIR__) . '/includes/auth.php';
|
|
require_once dirname(__DIR__) . '/includes/layout.php';
|
|
require_once __DIR__ . '/_visits_lib.php';
|
|
|
|
if (!is_logged_in()) {
|
|
http_response_code(401);
|
|
header('Content-Type: text/html; charset=utf-8');
|
|
echo '<div class="err-msg">登录状态已失效,请刷新页面后重新登录。</div>';
|
|
exit;
|
|
}
|
|
|
|
header('Content-Type: text/html; charset=utf-8');
|
|
header('Cache-Control: no-store, no-cache, must-revalidate');
|
|
|
|
$section = (string) ($_GET['section'] ?? 'access');
|
|
|
|
if ($section === 'loginfail') {
|
|
$lf = substr(trim((string) ($_GET['lf'] ?? '')), 0, 64);
|
|
echo vis_render_loginfail(vis_query_loginfail($lf, 200));
|
|
exit;
|
|
}
|
|
|
|
$mode = (string) ($_GET['mode'] ?? 'full');
|
|
if (!in_array($mode, ['full', 'compact'], true)) {
|
|
$mode = 'full';
|
|
}
|
|
$ipF = substr(trim((string) ($_GET['ip'] ?? '')), 0, 64);
|
|
$q = substr(trim((string) ($_GET['q'] ?? '')), 0, 100);
|
|
$page = max(1, (int) ($_GET['page'] ?? 1));
|
|
|
|
echo vis_render_access(vis_query_access($mode, $ipF, $q, $page, 30));
|