초기 커밋: 5130 레거시 시스템
- URL 하드코딩 → .env APP_URL 기반 동적 URL로 변경 - DB 연결 하드코딩 → .env 기반으로 변경 - MySQL strict mode DATE 오류 수정
This commit is contained in:
13
holiday/_request.php
Normal file
13
holiday/_request.php
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
$num = isset($_REQUEST['num']) ? $_REQUEST['num'] : '';
|
||||
$registedate = isset($_REQUEST['registedate']) ? $_REQUEST['registedate'] : '';
|
||||
$comment = isset($_REQUEST['comment']) ? $_REQUEST['comment'] : '';
|
||||
$is_deleted = isset($_REQUEST['is_deleted']) ? $_REQUEST['is_deleted'] : '';
|
||||
$searchtag = isset($_REQUEST['searchtag']) ? $_REQUEST['searchtag'] : '';
|
||||
$update_log = isset($_REQUEST['update_log']) ? $_REQUEST['update_log'] : '';
|
||||
|
||||
// 휴무일 관련 필드 추가
|
||||
$startdate = isset($_REQUEST['startdate']) ? $_REQUEST['startdate'] : '';
|
||||
$enddate = isset($_REQUEST['enddate']) ? $_REQUEST['enddate'] : '';
|
||||
$periodcheck = isset($_REQUEST['periodcheck']) ? $_REQUEST['periodcheck'] : '0';
|
||||
?>
|
||||
13
holiday/_row.php
Normal file
13
holiday/_row.php
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
$num = isset($row['num']) ? $row['num'] : '';
|
||||
$registedate = isset($row['registedate']) ? $row['registedate'] : '';
|
||||
$comment = isset($row['comment']) ? $row['comment'] : '';
|
||||
$is_deleted = isset($row['is_deleted']) ? $row['is_deleted'] : '';
|
||||
$searchtag = isset($row['searchtag']) ? $row['searchtag'] : '';
|
||||
$update_log = isset($row['update_log']) ? $row['update_log'] : '';
|
||||
|
||||
// 휴무일 관련 필드 추가
|
||||
$startdate = isset($row['startdate']) ? $row['startdate'] : '';
|
||||
$enddate = isset($row['enddate']) ? $row['enddate'] : '';
|
||||
$periodcheck = isset($row['periodcheck']) ? $row['periodcheck'] : '0';
|
||||
?>
|
||||
135
holiday/css/style.css
Normal file
135
holiday/css/style.css
Normal file
@@ -0,0 +1,135 @@
|
||||
#openModalBtn {
|
||||
padding: 10px 20px;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.modal {
|
||||
display: none;
|
||||
position: fixed;
|
||||
z-index: 1;
|
||||
left: 0;
|
||||
top: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
overflow: hidden; /* Changed from 'auto' to 'hidden' to prevent closing on outside click */
|
||||
background-color: rgba(0, 0, 0, 0.4);
|
||||
padding-top: 80px;
|
||||
}
|
||||
|
||||
.modal-content {
|
||||
background-color: #fefefe;
|
||||
margin: auto;
|
||||
border-radius: 10px;
|
||||
width: 80%;
|
||||
max-width: 1200px;
|
||||
animation: fadeIn 0.5s;
|
||||
box-shadow: 0 5px 15px rgba(0,0,0,0.3);
|
||||
}
|
||||
|
||||
|
||||
@keyframes fadeIn {
|
||||
from { opacity: 0; }
|
||||
to { opacity: 1; }
|
||||
}
|
||||
|
||||
.modal-header {
|
||||
background-color: #1f48d4;
|
||||
color: white;
|
||||
padding: 10px;
|
||||
border-top-left-radius: 10px;
|
||||
border-top-right-radius: 10px;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.modal-title {
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
.close {
|
||||
color: white;
|
||||
font-size: 18px;
|
||||
font-weight: bold;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.close:hover,
|
||||
.close:focus {
|
||||
color: #bbb;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.modal-body {
|
||||
padding: 15px;
|
||||
}
|
||||
|
||||
.custom-card {
|
||||
background-color: #f9f9f9;
|
||||
padding: 20px;
|
||||
border: 1px solid #ddd;
|
||||
border-radius: 5px;
|
||||
box-shadow: 0 1px 3px rgba(0,0,0,0.1);
|
||||
}
|
||||
|
||||
|
||||
.tooltip-inner {
|
||||
background-color: black !important; /* 배경색 */
|
||||
color: white !important; /* 글자색 */
|
||||
}
|
||||
.tooltip-arrow {
|
||||
color: black !important; /* 화살표 색상 */
|
||||
}
|
||||
|
||||
/* 입력창에 대한 설계 */
|
||||
.ui-autocomplete {
|
||||
max-height: 500px;
|
||||
overflow-y: auto;
|
||||
overflow-x: hidden;
|
||||
}
|
||||
|
||||
.specialinputWrap {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
width:100%;
|
||||
}
|
||||
|
||||
.specialbtnClear {
|
||||
position: absolute;
|
||||
right: 10px;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
background: transparent;
|
||||
border: none;
|
||||
color: black;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.specialbtnClear:before {
|
||||
content: 'X';
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.specialbtnClear:hover {
|
||||
color: black;
|
||||
}
|
||||
|
||||
.btnClear_lot {
|
||||
position: absolute;
|
||||
right: 10px;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
background: transparent;
|
||||
border: none;
|
||||
color: black;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.btnClear_lot:before {
|
||||
content: 'X';
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.btnClear_lot:hover {
|
||||
color: black;
|
||||
}
|
||||
94
holiday/fetch_modal.php
Normal file
94
holiday/fetch_modal.php
Normal file
@@ -0,0 +1,94 @@
|
||||
<?php
|
||||
require_once($_SERVER['DOCUMENT_ROOT'] . "/session.php");
|
||||
|
||||
$mode = isset($_POST['mode']) ? $_POST['mode'] : '';
|
||||
$num = isset($_POST['num']) ? $_POST['num'] : '';
|
||||
|
||||
$tablename = 'holiday';
|
||||
require_once($_SERVER['DOCUMENT_ROOT'] . "/lib/mydb.php");
|
||||
$pdo = db_connect();
|
||||
|
||||
if ($mode === 'update' && $num) {
|
||||
try {
|
||||
$sql = "SELECT * FROM ". $DB . "." . $tablename . " WHERE num=?";
|
||||
$stmh = $pdo->prepare($sql);
|
||||
$stmh->bindValue(1, $num, PDO::PARAM_INT);
|
||||
$stmh->execute();
|
||||
$row = $stmh->fetch(PDO::FETCH_ASSOC);
|
||||
|
||||
include '_row.php';
|
||||
} catch (PDOException $Exception) {
|
||||
echo "오류: ".$Exception->getMessage();
|
||||
exit;
|
||||
}
|
||||
} else {
|
||||
include '_request.php';
|
||||
$mode = 'insert';
|
||||
$registedate = date('Y-m-d');
|
||||
}
|
||||
|
||||
$title_message = ($mode === 'update') ? '휴무 수정' : '휴무 신규 등록';
|
||||
?>
|
||||
|
||||
<input type="hidden" id="update_log" name="update_log" value="<?=$update_log?>">
|
||||
<input type="hidden" id="registedate" name="registedate" value="<?=$registedate?>">
|
||||
|
||||
<div class="container-fluid">
|
||||
<div class="d-flex align-items-center justify-content-center">
|
||||
<div class="card justify-content-center">
|
||||
<div class="card-header text-center">
|
||||
<span class="text-center fs-5 "><?=$title_message?></span>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="row justify-content-center text-center">
|
||||
<div class="d-flex align-items-center justify-content-center m-2">
|
||||
<table class="table table-bordered">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="text-center fs-6 fw-bold" style="width:150px;">기간 설정</td>
|
||||
<td class="text-start" style="width:450px;">
|
||||
<input type="checkbox" id="periodcheck" name="periodcheck" value="1" <?= $periodcheck ? 'checked' : '' ?> >
|
||||
<span>
|
||||
<input type="date" class="form-control d-inline fs-6" id="startdate" name="startdate" style="width:130px;" value="<?=$startdate?>">
|
||||
<span id="enddateWrapper" style="<?= $periodcheck ? '' : 'display:none;' ?>">
|
||||
~
|
||||
<input type="date" class="form-control d-inline fs-6" id="enddate" name="enddate" style="width:130px;" value="<?=$enddate?>">
|
||||
</span>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="text-center fs-6 fw-bold" style="width:150px;">비고</td>
|
||||
<td class="text-center">
|
||||
<input type="text" class="form-control fs-6" id="comment" name="comment" value="<?=$comment?>" autocomplete="off" >
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="d-flex justify-content-center">
|
||||
<button type="button" id="saveBtn" class="btn btn-dark btn-sm me-3">
|
||||
<i class="bi bi-floppy-fill"></i> 저장
|
||||
</button>
|
||||
<?php if($mode != 'insert') { ?>
|
||||
<button type="button" id="deleteBtn" class="btn btn-danger btn-sm me-3">
|
||||
<i class="bi bi-trash"></i> 삭제
|
||||
</button>
|
||||
<?php } ?>
|
||||
<button type="button" id="closeBtn" class="btn btn-outline-dark btn-sm me-2">
|
||||
× 닫기
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
document.getElementById('periodcheck').addEventListener('change', function() {
|
||||
const periodFields = document.getElementById('periodFields');
|
||||
periodFields.style.display = this.checked ? 'inline' : 'none';
|
||||
});
|
||||
</script>
|
||||
303
holiday/list.php
Normal file
303
holiday/list.php
Normal file
@@ -0,0 +1,303 @@
|
||||
<?php
|
||||
require_once($_SERVER['DOCUMENT_ROOT'] . "/session.php");
|
||||
|
||||
if (!isset($_SESSION["level"]) || $_SESSION["level"] > 5) {
|
||||
sleep(1);
|
||||
header("Location:" . $WebSite . "login/login_form.php");
|
||||
exit;
|
||||
}
|
||||
include $_SERVER['DOCUMENT_ROOT'] . '/load_header.php';
|
||||
$title_message = '일정표 휴일';
|
||||
?>
|
||||
|
||||
<link href="css/style.css" rel="stylesheet">
|
||||
<title> <?=$title_message?> </title>
|
||||
|
||||
<style>
|
||||
/* 테이블에 테두리 추가 */
|
||||
#myTable, #myTable th, #myTable td {
|
||||
border: 1px solid black;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
/* 테이블 셀 패딩 조정 */
|
||||
#myTable th, #myTable td {
|
||||
padding: 8px;
|
||||
text-align: center;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<?php
|
||||
$header = isset($_REQUEST['header']) ? $_REQUEST['header'] : '';
|
||||
|
||||
if ($header == 'header')
|
||||
require_once($_SERVER['DOCUMENT_ROOT'] . '/myheader.php');
|
||||
|
||||
function checkNull($strtmp) {
|
||||
return ($strtmp !== null && trim($strtmp) !== '');
|
||||
}
|
||||
|
||||
$search = isset($_REQUEST['search']) ? $_REQUEST['search'] : '';
|
||||
$mode = isset($_REQUEST["mode"]) ? $_REQUEST["mode"] : '';
|
||||
|
||||
$tablename = 'holiday';
|
||||
|
||||
require_once($_SERVER['DOCUMENT_ROOT'] . "/lib/mydb.php");
|
||||
$pdo = db_connect();
|
||||
|
||||
$order = " ORDER BY registedate DESC, num desc ";
|
||||
|
||||
if (checkNull($search)) {
|
||||
$sql = "SELECT * FROM ".$DB.".".$tablename."
|
||||
WHERE searchtag LIKE '%$search%' AND is_deleted IS NULL " . $order;
|
||||
} else {
|
||||
$sql = "SELECT * FROM ".$DB.".".$tablename . " WHERE is_deleted IS NULL " . $order;
|
||||
}
|
||||
|
||||
try {
|
||||
$stmh = $pdo->query($sql);
|
||||
$total_row = $stmh->rowCount();
|
||||
?>
|
||||
|
||||
<form id="board_form" name="board_form" method="post" enctype="multipart/form-data">
|
||||
<input type="hidden" id="mode" name="mode" value="<?=$mode?>">
|
||||
<input type="hidden" id="num" name="num">
|
||||
<input type="hidden" id="tablename" name="tablename" value="<?=$tablename?>">
|
||||
<input type="hidden" id="header" name="header" value="<?=$header?>">
|
||||
|
||||
|
||||
<div class="container">
|
||||
<!-- Modal -->
|
||||
<div id="myModal" class="modal">
|
||||
<div class="modal-content" style="width:600px;">
|
||||
<div class="modal-header">
|
||||
<span class="modal-title">일정표 휴일</span>
|
||||
<span class="close closeBtn">×</span>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="custom-card"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="container" style="width:40%;">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<div class="d-flex justify-content-center align-items-center">
|
||||
<span class="text-center fs-5 me-4"><?=$title_message?></span>
|
||||
<button type="button" class="btn btn-dark btn-sm me-1" onclick='location.href="list.php?header=header"'>
|
||||
<i class="bi bi-arrow-clockwise"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="d-flex justify-content-center align-items-center mt-1 mb-3">
|
||||
<i class="bi bi-caret-right"></i> <?= $total_row ?>
|
||||
<div class="inputWrap30">
|
||||
<input type="text" id="search" class="form-control" style="width:150px;" name="search" value="<?=$search?>" onKeyPress="if (event.keyCode == 13) { this.form.submit(); }">
|
||||
<button class="btnClear"></button>
|
||||
</div>
|
||||
|
||||
<button class="btn btn-outline-dark btn-sm" type="button" id="searchBtn"> <i class="bi bi-search"></i> </button>
|
||||
<button id="newBtn" type="button" class="btn btn-dark btn-sm me-2"> <i class="bi bi-pencil-square"></i> 신규 </button>
|
||||
<?php if($header !== 'header')
|
||||
print '<button id="closeBtn" type="button" class="btn btn-outline-dark btn-sm"> <i class="bi bi-x-lg"></i> 창닫기 </button>';
|
||||
?>
|
||||
</div>
|
||||
|
||||
<div class="row d-flex">
|
||||
<div class="table-responsive ">
|
||||
<table class="table table-hover" id="myTable">
|
||||
<thead class="table-info">
|
||||
<th class="text-center " >번호</th>
|
||||
<th class="text-center " >휴일시작</th>
|
||||
<th class="text-center " >휴일종료</th>
|
||||
<th class="text-center " >기간체크</th>
|
||||
<th class="text-center " >내용</th>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
$start_num = $total_row;
|
||||
while($row = $stmh->fetch(PDO::FETCH_ASSOC)) {
|
||||
$num = $row['num'];
|
||||
$registedate = $row['registedate'];
|
||||
$startdate = $row['startdate'];
|
||||
$enddate = $row['enddate'];
|
||||
$periodcheck = $row['periodcheck'] ? '예' : '아니오';
|
||||
$comment = $row['comment'];
|
||||
?>
|
||||
<tr onclick="loadForm('update', '<?=$num?>');">
|
||||
<td class="text-center"><?= $start_num ?></td>
|
||||
<td class="text-center"><?= $startdate ?></td>
|
||||
<td class="text-center"> <?= $enddate === '0000-00-00' ? '' : $enddate ?> </td>
|
||||
<td class="text-center"><?= $periodcheck ?></td>
|
||||
<td class="text-start"><?= $comment ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
$start_num--;
|
||||
}
|
||||
} catch (PDOException $Exception) {
|
||||
print "오류: ".$Exception->getMessage();
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
// Loader 숨기기
|
||||
var loader = document.getElementById('loadingOverlay');
|
||||
if (loader) {
|
||||
loader.style.display = 'none';
|
||||
}
|
||||
|
||||
// Modal 닫기 기능
|
||||
var modal = document.getElementById("myModal");
|
||||
var span = document.getElementsByClassName("close")[0];
|
||||
|
||||
span.onclick = function() {
|
||||
modal.style.display = "none";
|
||||
}
|
||||
|
||||
// 신규 버튼 클릭 시
|
||||
$("#newBtn").on("click", function() {
|
||||
loadForm('insert');
|
||||
});
|
||||
|
||||
// 검색 버튼 클릭 시
|
||||
$("#searchBtn").on("click", function() {
|
||||
$("#board_form").submit();
|
||||
});
|
||||
});
|
||||
|
||||
function loadForm(mode, num = null) {
|
||||
if (num == null) {
|
||||
$("#mode").val('insert');
|
||||
} else {
|
||||
$("#mode").val('update');
|
||||
$("#num").val(num);
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "fetch_modal.php",
|
||||
data: { mode: mode, num: num },
|
||||
dataType: "html",
|
||||
success: function(response) {
|
||||
document.querySelector(".modal-body .custom-card").innerHTML = response;
|
||||
$("#myModal").show();
|
||||
|
||||
// 동적 기간체크 기능 추가
|
||||
$("#periodcheck").on("change", function() {
|
||||
if ($(this).is(":checked")) {
|
||||
$("#enddate").parent().show(); // 종료일 필드와 라벨 표시
|
||||
} else {
|
||||
$("#enddate").parent().hide(); // 종료일 필드와 라벨 숨기기
|
||||
$("#enddate").val(""); // 종료일 초기화
|
||||
}
|
||||
});
|
||||
|
||||
// 초기 로드 시 체크박스 상태에 따른 필드 표시/숨김
|
||||
if ($("#periodcheck").is(":checked")) {
|
||||
$("#enddate").parent().show(); // 종료일 필드와 라벨 표시
|
||||
} else {
|
||||
$("#enddate").parent().hide(); // 종료일 필드와 라벨 숨기기
|
||||
}
|
||||
|
||||
$("#closeBtn").on("click", function() {
|
||||
$("#myModal").hide();
|
||||
});
|
||||
|
||||
$(".closeBtn").on("click", function() {
|
||||
$("#myModal").hide();
|
||||
});
|
||||
|
||||
// 저장 버튼
|
||||
$("#saveBtn").on("click", function() {
|
||||
var formData = $("#board_form").serialize();
|
||||
|
||||
$.ajax({
|
||||
url: "process.php",
|
||||
type: "post",
|
||||
data: formData,
|
||||
success: function(response) {
|
||||
Toastify({
|
||||
text: "저장완료",
|
||||
duration: 3000,
|
||||
close: true,
|
||||
gravity: "top",
|
||||
position: "center",
|
||||
backgroundColor: "#4fbe87",
|
||||
}).showToast();
|
||||
|
||||
$("#myModal").hide();
|
||||
location.reload();
|
||||
},
|
||||
error: function(jqxhr, status, error) {
|
||||
console.log(jqxhr, status, error);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// 삭제 버튼
|
||||
$("#deleteBtn").on("click", function() {
|
||||
deleteHoliday(num);
|
||||
});
|
||||
},
|
||||
error: function(jqxhr, status, error) {
|
||||
console.log("AJAX Error: ", status, error);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function deleteHoliday(num) {
|
||||
Swal.fire({
|
||||
title: '자료 삭제',
|
||||
text: "정말 삭제하시겠습니까?",
|
||||
icon: 'warning',
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: '#3085d6',
|
||||
cancelButtonColor: '#d33',
|
||||
confirmButtonText: '삭제',
|
||||
cancelButtonText: '취소'
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
$("#mode").val('delete');
|
||||
$("#num").val(num);
|
||||
var formData = $("#board_form").serialize();
|
||||
|
||||
$.ajax({
|
||||
url: "process.php",
|
||||
type: "post",
|
||||
data: formData,
|
||||
success: function(response) {
|
||||
Toastify({
|
||||
text: "삭제 완료",
|
||||
duration: 2000,
|
||||
close: true,
|
||||
gravity: "top",
|
||||
position: "center",
|
||||
backgroundColor: "#ff5f5f",
|
||||
}).showToast();
|
||||
|
||||
location.reload();
|
||||
},
|
||||
error: function(jqxhr, status, error) {
|
||||
console.log(jqxhr, status, error);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
92
holiday/process.php
Normal file
92
holiday/process.php
Normal file
@@ -0,0 +1,92 @@
|
||||
<?php
|
||||
require_once($_SERVER['DOCUMENT_ROOT'] . "/session.php");
|
||||
|
||||
$tablename = 'holiday';
|
||||
$mode = isset($_REQUEST['mode']) ? $_REQUEST['mode'] : '';
|
||||
|
||||
header("Content-Type: application/json"); // Use JSON content type
|
||||
|
||||
require_once($_SERVER['DOCUMENT_ROOT'] . "/lib/mydb.php");
|
||||
$pdo = db_connect();
|
||||
|
||||
include "_request.php";
|
||||
|
||||
// 검색 태그 생성 (등록일자와 코멘트를 조합)
|
||||
$searchtag = $registedate . ' ' . $comment;
|
||||
|
||||
if ($mode == "update") {
|
||||
$update_log = date("Y-m-d H:i:s") . " - " . $_SESSION["name"] . " " . $update_log . "
";
|
||||
try {
|
||||
$pdo->beginTransaction();
|
||||
$sql = "UPDATE " . $DB . "." . $tablename . " SET ";
|
||||
$sql .= "registedate = ?, startdate = ?, enddate = ?, periodcheck = ?, comment = ?, searchtag = ?, update_log = ? ";
|
||||
$sql .= "WHERE num = ? LIMIT 1"; // Update only one record matching the 'num'
|
||||
|
||||
$stmh = $pdo->prepare($sql);
|
||||
|
||||
$stmh->bindValue(1, $registedate, PDO::PARAM_STR);
|
||||
$stmh->bindValue(2, $startdate, PDO::PARAM_STR);
|
||||
$stmh->bindValue(3, $enddate, PDO::PARAM_STR);
|
||||
$stmh->bindValue(4, $periodcheck, PDO::PARAM_INT);
|
||||
$stmh->bindValue(5, $comment, PDO::PARAM_STR);
|
||||
$stmh->bindValue(6, $searchtag, PDO::PARAM_STR);
|
||||
$stmh->bindValue(7, $update_log, PDO::PARAM_STR);
|
||||
$stmh->bindValue(8, $num, PDO::PARAM_INT);
|
||||
|
||||
$stmh->execute();
|
||||
$pdo->commit();
|
||||
} catch (PDOException $Exception) {
|
||||
$pdo->rollBack();
|
||||
print "오류: " . $Exception->getMessage();
|
||||
}
|
||||
}
|
||||
|
||||
if ($mode == "insert" || $mode == '' || $mode == null) {
|
||||
$update_log = date("Y-m-d H:i:s") . " - " . $_SESSION["name"] . " " . $update_log . "
";
|
||||
try {
|
||||
$pdo->beginTransaction();
|
||||
|
||||
$sql = "INSERT INTO " . $DB . "." . $tablename . " (";
|
||||
$sql .= "registedate, startdate, enddate, periodcheck, comment, searchtag, update_log ";
|
||||
$sql .= ") VALUES (?, ?, ?, ?, ?, ?, ?)";
|
||||
|
||||
$stmh = $pdo->prepare($sql);
|
||||
|
||||
$stmh->bindValue(1, $registedate, PDO::PARAM_STR);
|
||||
$stmh->bindValue(2, $startdate, PDO::PARAM_STR);
|
||||
$stmh->bindValue(3, $enddate, PDO::PARAM_STR);
|
||||
$stmh->bindValue(4, $periodcheck, PDO::PARAM_INT);
|
||||
$stmh->bindValue(5, $comment, PDO::PARAM_STR);
|
||||
$stmh->bindValue(6, $searchtag, PDO::PARAM_STR);
|
||||
$stmh->bindValue(7, $update_log, PDO::PARAM_STR);
|
||||
|
||||
$stmh->execute();
|
||||
$pdo->commit();
|
||||
} catch (PDOException $Exception) {
|
||||
$pdo->rollBack();
|
||||
print "오류: " . $Exception->getMessage();
|
||||
}
|
||||
}
|
||||
|
||||
if ($mode == "delete") { // Data deletion
|
||||
try {
|
||||
$pdo->beginTransaction();
|
||||
$sql = "UPDATE " . $DB . "." . $tablename . " SET is_deleted=1 WHERE num = ?";
|
||||
$stmh = $pdo->prepare($sql);
|
||||
$stmh->bindValue(1, $num, PDO::PARAM_INT);
|
||||
$stmh->execute();
|
||||
$pdo->commit();
|
||||
} catch (PDOException $ex) {
|
||||
$pdo->rollBack();
|
||||
print "오류: ".$ex->getMessage();
|
||||
}
|
||||
}
|
||||
|
||||
$data = [
|
||||
'num' => $num,
|
||||
'mode' => $mode
|
||||
];
|
||||
|
||||
echo json_encode($data, JSON_UNESCAPED_UNICODE);
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user