Files
firstgarden-web-gnu/manager/vip/vip_list_ent.enter.php

40 lines
1.4 KiB
PHP

<?php
include_once ('./_common.php');
if(!$_SESSION['user_id']) exit;
$isDebug = false; // 디버그 출력용 변수
if(isset($_POST['mode']) && trim($_POST['mode']) === "enter") {
$idx = trim($_POST['idx']);
$squery = "SELECT * FROM {$fg['vip_list_table']} WHERE idx='{$idx}'";
$list = sql_fetch($squery);
$ent_count = ++$list['ent_count']; // 입장처리시 방문카운트 증가
$date = date("Y-m-d");
$datetime = date("Y-m-d H:i:s");
// 리스트 DB에 최종사용일자 업데이트
$listquery = "UPDATE {$fg['vip_list_table']} SET last_ent_date='{$date}', ent_count='{$ent_count}' WHERE idx='{$idx}'";
$result = sql_query($listquery);
$data = array("isSuccess" => $result);
// 사용처리 목록 DB에 업데이트
$entQuery = "INSERT INTO {$fg['enter_table']} (cat_name, mem_no, ent_datetime, adm)
VALUES('VIP', '{$list['vip_card_no']}', '{$datetime}','{$_SESSION['user_id']}')";
$entQueryResult = sql_query($entQuery);
if ($isDebug && !$entQueryResult) echo "사용처리 목록 업데이트 실패\nquery : {$entQuery}";
// log 기록
$work = "VIP입장";
$work_detail = "카드번호 : ".$list['vip_card_no']." 처리자 : ".$_SESSION['user_name'];
$logUpdate = log_update($work, $work_detail, $_SESSION['user_id'], $datetime);
if ($isDebug && !$logUpdate) echo '로그 등록 실패\n';
}
header("Content-Type: application/json");
echo json_encode($data);