Files
sam-kd/egimake/get_slatlist.php
hskwon aca1767eb9 초기 커밋: 5130 레거시 시스템
- URL 하드코딩 → .env APP_URL 기반 동적 URL로 변경
- DB 연결 하드코딩 → .env 기반으로 변경
- MySQL strict mode DATE 오류 수정
2025-12-10 20:14:31 +09:00

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);
?>