$expire)) {
session_destroy();
header("Location: login.php");
exit;
}
$_SESSION['login_time'] = time();
$userName = htmlspecialchars($_SESSION['username']);
$userRole = $_SESSION['role'];
$roleText = $userRole === 'admin' ? '管理员' : '超级管理员';
$dbHost = "10.150.117.190";
$dbUser = "root";
$dbPwd = "hp93000";
$dbName = "alert_mail_stat";
$connConfig = mysqli_connect($dbHost, $dbUser, $dbPwd, $dbName);
mysqli_set_charset($connConfig, "utf8mb4");
$configSql = "SELECT k,v FROM sys_config";
$configRes = mysqli_query($connConfig, $configSql);
$sysConfig = [];
while ($row = mysqli_fetch_assoc($configRes)) {
$sysConfig[$row['k']] = $row['v'];
}
mysqli_close($connConfig);
$pageTitle = htmlspecialchars($sysConfig['page_title'] ?? "告警监控系统");
$themeColor = htmlspecialchars($sysConfig['theme_color'] ?? "#409eff");
$pageSize = $sysConfig['page_size'] ?? "20";
$footerText = htmlspecialchars($sysConfig['footer_text'] ?? "");
$sidebarRawLinks = $sysConfig['sidebar_links'] ?? "";
$currentLang = $sysConfig['lang'] ?? "zh";
$langMap = [
'zh' => [
'html_lang' => 'zh-CN',
'page_subtitle' => '爱德万测试 · 运维告警监控平台',
'monitor_panel' => '监控面板',
'alert_overview' => '告警监控总览',
'alert_list_page' => '历史告警查询',
'work_order_mgr' => '工单系统',
'docker_mgr' => 'Docker容器管理',
'system_manager' => '角色管理',
'quick_link' => '快捷外链',
'system_manage' => '系统管理',
'system_config' => '后台配置管理',
'current_user' => '当前用户:',
'sys_time' => '系统时间:',
'refresh_all' => '刷新全部数据',
'logout' => '退出登录',
'lang_text' => '语言:',
'container_list' => '容器列表',
'image_list' => '镜像列表',
'container_log' => '容器日志',
'network_info' => '网络详情',
'exec_container' => '进入容器执行命令',
'restart' => '重启',
'stop' => '停止',
'remove' => '强制删除',
'remove_image' => '删除镜像',
'bind_repo' => '绑定镜像仓库',
'input_cmd' => '仅允许 ls/pwd/cat/ps/df/free/top/du/whoami/env,禁止rm/wget/curl/chmod等高危指令',
'execute' => '执行',
'close' => '关闭',
'loading' => '加载中...',
'no_container' => '暂无容器',
'no_image' => '无本地镜像',
'request_fail' => '接口请求失败',
'container_id' => '容器ID',
'container_name' => '容器名称',
'image_name' => '镜像',
'status' => '运行状态',
'port_mapping' => '端口映射',
'operate' => '操作',
'repo' => '镜像仓库',
'tag' => '镜像标签',
'image_id' => '镜像ID',
'size' => '镜像大小',
'create_time' => '创建时间',
'confirm_remove' => '确认强制删除容器?操作不可恢复!',
'confirm_remove_img' => '确认删除本地镜像?不可恢复!',
'op_success' => '操作成功,已刷新状态',
'op_failed' => '操作执行失败',
'loading_mask' => '数据加载中,请稍候...',
'create_container' => '新建容器',
'batch_restart' => '批量重启',
'batch_stop' => '批量停止',
'batch_remove' => '批量删除',
'search_placeholder' => '搜索容器名称/镜像',
'op_menu' => '操作 ▼',
'view_log' => '查看日志',
'view_network' => '查看网络',
'enter_exec' => '交互式终端',
'stat_total' => '容器总数',
'stat_running' => '运行中',
'stat_stopped' => '已停止',
'stat_image' => '本地镜像',
'tip_exec_once' => '单次命令执行',
'tip_websocket' => '实时交互式TTY终端,支持输入、复制、窗口自适应',
'repo_addr' => '仓库地址',
'repo_user' => '仓库账号',
'repo_pwd' => '仓库密码',
'repo_name' => '仓库名称',
'bind_repo_title' => '绑定私有镜像仓库'
],
'en' => [
'html_lang' => 'en',
'page_subtitle' => 'Advantest · O&M Alert Monitor Platform',
'monitor_panel' => 'Monitor Panel',
'alert_overview' => 'Alert Overview',
'alert_list_page' => 'Alert Pagination List',
'work_order_mgr' => 'Work Order System',
'docker_mgr' => 'Docker Manager',
'system_manager' => 'Role & Permission Manage',
'quick_link' => 'Quick Links',
'system_manage' => 'System Manage',
'system_config' => 'System Config',
'current_user' => 'User: ',
'sys_time' => 'System Time: ',
'refresh_all' => 'Refresh All Data',
'logout' => 'Logout',
'lang_text' => 'Lang: ',
'container_list' => 'Container List',
'image_list' => 'Image List',
'container_log' => 'Container Logs',
'network_info' => 'Network Info',
'exec_container' => 'Exec Container Command',
'restart' => 'Restart',
'stop' => 'Stop',
'remove' => 'Force Remove',
'remove_image' => 'Remove Image',
'bind_repo' => 'Bind Registry',
'input_cmd' => 'Only allow ls/pwd/cat/ps/df/free/top/du/whoami/env, ban rm/wget/curl/chmod',
'execute' => 'Run',
'close' => 'Close',
'loading' => 'Loading...',
'no_container' => 'No Containers',
'no_image' => 'No Local Images',
'request_fail' => 'API Request Failed',
'container_id' => 'Container ID',
'container_name' => 'Name',
'image_name' => 'Image',
'status' => 'Status',
'port_mapping' => 'Ports',
'operate' => 'Operate',
'repo' => 'Repository',
'tag' => 'Tag',
'image_id' => 'Image ID',
'size' => 'Size',
'create_time' => 'Created At',
'confirm_remove' => 'Confirm force delete container? Irreversible!',
'confirm_remove_img' => 'Confirm delete local image? Irreversible!',
'op_success' => 'Operation succeeded, refreshed status',
'op_failed' => 'Operation failed',
'loading_mask' => 'Loading data, please wait...',
'create_container' => 'Create Container',
'batch_restart' => 'Batch Restart',
'batch_stop' => 'Batch Stop',
'batch_remove' => 'Batch Remove',
'search_placeholder' => 'Search container / image',
'op_menu' => 'Operate ▼',
'view_log' => 'Logs',
'view_network' => 'Network',
'enter_exec' => 'Interactive Terminal',
'stat_total' => 'Total Containers',
'stat_running' => 'Running',
'stat_stopped' => 'Stopped',
'stat_image' => 'Local Images',
'tip_exec_once' => 'Single command execution',
'tip_websocket' => 'Real-time interactive TTY terminal, input & resize support',
'repo_addr' => 'Registry Address',
'repo_user' => 'Username',
'repo_pwd' => 'Password',
'repo_name' => 'Registry Name',
'bind_repo_title' => 'Bind Private Registry'
]
];
$t = $langMap[$currentLang];
$sidebarLinkList = [];
if (!empty($sidebarRawLinks)) {
$lines = explode("\n", $sidebarRawLinks);
foreach ($lines as $line) {
$line = trim($line);
if (empty($line)) continue;
$item = explode("|", $line, 2);
if (count($item) === 2) {
$sidebarLinkList[] = [
"name" => trim($item[0]),
"url" => trim($item[1])
];
}
}
}
$pageSid = session_id();
// WebSocket HMAC 签名参数(和docker_api.py密钥完全一致)
$WS_SECRET = "DockerAdminPlatform2026SecretKey123456789";
$wsUser = $_SESSION['user_id'];
$wsRole = $_SESSION['role'];
$wsTs = time();
$wsRawSign = $wsUser . "|" . $wsRole . "|" . $wsTs;
$wsSign = hash_hmac("sha256", $wsRawSign, $WS_SECRET);
$wsClientIp = $_SERVER['REMOTE_ADDR'];
?>
- Advantest
当前页面SID: | 接口SID:(SID一致,会话互通)