- URL 하드코딩 → .env APP_URL 기반 동적 URL로 변경 - DB 연결 하드코딩 → .env 기반으로 변경 - MySQL strict mode DATE 오류 수정
30 lines
895 B
PHP
30 lines
895 B
PHP
<?php
|
|
// 간단한 API 연결 테스트
|
|
require_once($_SERVER['DOCUMENT_ROOT'] . "/session.php");
|
|
|
|
// 권한 체크
|
|
if ($level > 5) {
|
|
die(json_encode(['ok' => false, 'error' => '접근 권한이 없습니다.']));
|
|
}
|
|
|
|
// API 키 읽기
|
|
$apiKeyFile = $_SERVER['DOCUMENT_ROOT'] . '/apikey/claude_api.txt';
|
|
|
|
$response = [
|
|
'file_exists' => file_exists($apiKeyFile),
|
|
'file_path' => $apiKeyFile,
|
|
'document_root' => $_SERVER['DOCUMENT_ROOT']
|
|
];
|
|
|
|
if (file_exists($apiKeyFile)) {
|
|
$apiKey = trim(file_get_contents($apiKeyFile));
|
|
$response['key_length'] = strlen($apiKey);
|
|
$response['key_prefix'] = substr($apiKey, 0, 20) . '...';
|
|
$response['key_valid_format'] = (strpos($apiKey, 'sk-ant-api') === 0);
|
|
} else {
|
|
$response['error'] = 'API 키 파일을 찾을 수 없습니다.';
|
|
}
|
|
|
|
header('Content-Type: application/json');
|
|
echo json_encode($response, JSON_PRETTY_PRINT);
|