초기 커밋: 5130 레거시 시스템
- URL 하드코딩 → .env APP_URL 기반 동적 URL로 변경 - DB 연결 하드코딩 → .env 기반으로 변경 - MySQL strict mode DATE 오류 수정
This commit is contained in:
43
lot/insert_sheet.php
Normal file
43
lot/insert_sheet.php
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
require_once($_SERVER['DOCUMENT_ROOT'] . "/session.php");
|
||||
|
||||
$tablename = isset($_REQUEST['tablename']) ? $_REQUEST['tablename'] : '';
|
||||
$mode = isset($_REQUEST['mode']) ? $_REQUEST['mode'] : '';
|
||||
$recordsheet = isset($_REQUEST['recordsheet']) ? $_REQUEST['recordsheet'] : '{}'; // recordsheet 데이터 추가
|
||||
$update_log = isset($_REQUEST['update_log']) ? $_REQUEST['update_log'] : ''; // update_log 추가
|
||||
$num = isset($_REQUEST['num']) ? $_REQUEST['num'] : ''; // update_log 추가
|
||||
|
||||
header("Content-Type: application/json");
|
||||
|
||||
require_once($_SERVER['DOCUMENT_ROOT'] . "/lib/mydb.php");
|
||||
$pdo = db_connect();
|
||||
|
||||
$recordsheet_jsondata = json_decode($recordsheet, true); // JSON 데이터로 변환
|
||||
|
||||
$update_log = date("Y-m-d H:i:s") . " - " . $_SESSION["name"] . " " . $update_log . "
";
|
||||
try {
|
||||
$pdo->beginTransaction();
|
||||
$sql = "UPDATE " . $DB . "." . $tablename . " SET recordsheet = ?, update_log = ? WHERE num = ? LIMIT 1";
|
||||
|
||||
$stmh = $pdo->prepare($sql);
|
||||
$stmh->bindValue(1, json_encode($recordsheet_jsondata), PDO::PARAM_STR); // recordsheet 저장
|
||||
$stmh->bindValue(2, $update_log, PDO::PARAM_STR); // update_log 저장
|
||||
$stmh->bindValue(3, $num, PDO::PARAM_STR);
|
||||
|
||||
$stmh->execute();
|
||||
$pdo->commit();
|
||||
} catch (PDOException $Exception) {
|
||||
$pdo->rollBack();
|
||||
print "오류: " . $Exception->getMessage();
|
||||
}
|
||||
|
||||
// 최종 결과 데이터 반환
|
||||
$data = [
|
||||
'num' => $num,
|
||||
'mode' => $mode,
|
||||
'recordsheet' => $recordsheet_jsondata,
|
||||
'update_log' => $update_log
|
||||
];
|
||||
|
||||
echo json_encode($data, JSON_UNESCAPED_UNICODE);
|
||||
?>
|
||||
Reference in New Issue
Block a user