Files
ecs-controller/monitor.php
2026-01-17 10:22:04 +08:00

27 lines
635 B
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
// 此文件用于 Cron 任务
// 输出简洁的文本日志
require_once 'AliyunTrafficCheck.php';
header('Content-Type: text/plain; charset=utf-8');
$app = new AliyunTrafficCheck();
// CLI 模式直接运行Web 模式需要密码
$isCli = (PHP_SAPI === 'cli');
if (!$isCli) {
$inputKey = $_GET['key'] ?? '';
$adminPassword = $app->getAdminPassword();
if ($inputKey !== $adminPassword) {
http_response_code(403);
echo "Access Denied.";
exit;
}
}
// 输出简洁日志
echo "--- CDT Monitor Start: " . date('Y-m-d H:i:s') . " ---\n";
echo $app->monitor();
echo "\n--- End ---\n";