'Unauthorized']); exit; } // 세션 타임아웃 체크 if (isset($_SESSION['login_time']) && (time() - $_SESSION['login_time']) > SESSION_LIFETIME) { session_destroy(); http_response_code(401); echo json_encode(['error' => 'Session expired']); exit; } } // JSON 입력 받기 function get_json_input() { $input = file_get_contents('php://input'); return json_decode($input, true); } // 응답 헬퍼 function json_response($data, $status = 200) { http_response_code($status); echo json_encode($data, JSON_UNESCAPED_UNICODE); exit; }