- URL 하드코딩 → .env APP_URL 기반 동적 URL로 변경 - DB 연결 하드코딩 → .env 기반으로 변경 - MySQL strict mode DATE 오류 수정
36 lines
949 B
PHP
36 lines
949 B
PHP
<?php
|
|
require_once($_SERVER['DOCUMENT_ROOT'] . "/session.php");
|
|
require_once($_SERVER['DOCUMENT_ROOT'] . "/lib/mydb.php");
|
|
|
|
header("Content-Type: application/json");
|
|
|
|
$num = isset($_GET['num']) ? $_GET['num'] : '';
|
|
|
|
$response = ['success' => false];
|
|
|
|
if ($num) {
|
|
try {
|
|
$pdo = db_connect();
|
|
|
|
$sql = "SELECT slatlist FROM chandj.output WHERE num = ?";
|
|
$stmh = $pdo->prepare($sql);
|
|
$stmh->bindValue(1, $num, PDO::PARAM_INT);
|
|
$stmh->execute();
|
|
|
|
$row = $stmh->fetch(PDO::FETCH_ASSOC);
|
|
if ($row) {
|
|
$response['success'] = true;
|
|
$response['slatlist'] = json_decode($row['slatlist'], true);
|
|
} else {
|
|
http_response_code(404);
|
|
$response['message'] = "No data found";
|
|
}
|
|
} catch (PDOException $e) {
|
|
http_response_code(500);
|
|
$response['message'] = "Error: " . $e->getMessage();
|
|
}
|
|
}
|
|
|
|
echo json_encode($response);
|
|
?>
|