更改验证

This commit is contained in:
MasonLiu committed 2026-08-25 00:07:26 +08:00
1 parent 00617621f9
commit 9e85e64345
6 files changed
+260 -85

No files matched your search

+26 -10
View File
@@ -1,6 +1,7 @@
<?php
require_once __DIR__ . '/app/db_helper.php';
require_once __DIR__ . '/app/logger.php';
require_once __DIR__ . '/app/auth.php';
require_once __DIR__ . '/mofangidc.php';
require_once __DIR__ . '/tencentcloud.php';
require_once __DIR__ . '/aliyun.php';
@@ -17,15 +18,16 @@ if (!file_exists($tokenFile)) {
// 加载API_PASS
include $tokenFile;
// 验证pass参数
$pass = isset($_GET['pass']) ? $_GET['pass'] : '';
if (!defined('API_PASS') || $pass !== API_PASS) {
header('Content-Type: application/json; charset=utf-8');
echo json_encode(['status' => 403, 'msg' => '访问密码错误或者未输入密码,请拼接?pass=API_PASS后再尝试访问'], JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);
// 处理退出登录(需在会话认证之前,保证已登录用户也能退出)
if (isset($_GET['logout'])) {
logout();
header('Location: ' . $_SERVER['PHP_SELF']);
exit;
}
// 会话认证:前端输入密码验证后建立会话,30分钟滑动过期
requireAuth();
// 处理操作请求
$message = '';
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
@@ -295,6 +297,15 @@ foreach ($vpsList as $vps) {
.btn-refresh:hover {
background-color: #0056b3;
}
.btn-logout {
background-color: #6c757d;
color: white;
text-decoration: none;
}
.btn-logout:hover {
background-color: #5a6268;
color: white;
}
.config-title {
display: flex;
justify-content: space-between;
@@ -478,9 +489,14 @@ foreach ($vpsList as $vps) {
</button>
</form>
<a href="config_add.php?pass=<?php echo urlencode($pass); ?>" class="btn btn-success">
➕ 添加配置源
</a>
<div style="display: flex; gap: 10px; align-items: center;">
<a href="config_add.php" class="btn btn-success">
➕ 添加配置源
</a>
<a href="index.php?logout=1" class="btn btn-logout" onclick="return confirm('确认退出登录?')">
🚪 退出登录
</a>
</div>
</div>
<!-- 统计信息 -->
@@ -500,7 +516,7 @@ foreach ($vpsList as $vps) {
<div class="empty-state">
<h3>📭 暂无配置</h3>
<p>请先添加VPS配置才能开始管理</p>
<a href="config_add.php?pass=<?php echo urlencode($pass); ?>" class="btn btn-success" style="margin-top: 20px;">
<a href="config_add.php" class="btn btn-success" style="margin-top: 20px;">
➕ 添加第一个配置
</a>
</div>