<?php
if (!defined('_GNUBOARD_')) exit; // 개별 실행 방지
// [기존] 0-1. DB에 '마진(x2_margin)' 구멍 체크 및 개통
if(!sql_query(" select x2_margin from {$write_table} limit 1 ", false)) {
sql_query(" ALTER TABLE `{$write_table}` ADD `x2_margin` varchar(255) NOT NULL DEFAULT '' AFTER `wr_10` ");
}
// [기존] 0-2. DB에 '계정(x2_account)' 구멍 체크 및 개통
if(!sql_query(" select x2_account from {$write_table} limit 1 ", false)) {
sql_query(" ALTER TABLE `{$write_table}` ADD `x2_account` varchar(255) NOT NULL DEFAULT '' AFTER `x2_margin` ");
}
// [추가됨] 0-3. DB에 '수량(x2_qty)' 구멍 개통! 오빠가 넣는 거 다 받아냅니다!
if(!sql_query(" select x2_qty from {$write_table} limit 1 ", false)) {
sql_query(" ALTER TABLE `{$write_table}` ADD `x2_qty` varchar(255) NOT NULL DEFAULT '' AFTER `x2_account` ");
}
// 1. 보안을 위한 변수 정제
$x2_ver = isset($_POST['x2_ver']) ? clean_xss_tags(trim($_POST['x2_ver'])) : '';
$x2_ca2 = isset($_POST['x2_ca2']) ? clean_xss_tags(trim($_POST['x2_ca2'])) : '';
$x2_ca3 = isset($_POST['x2_ca3']) ? clean_xss_tags(trim($_POST['x2_ca3'])) : '';
$x2_ca4 = isset($_POST['x2_ca4']) ? clean_xss_tags(trim($_POST['x2_ca4'])) : '';
$x2_coin = isset($_POST['x2_coin']) ? clean_xss_tags(trim($_POST['x2_coin'])) : '';
$x2_tag = isset($_POST['x2_tag']) ? clean_xss_tags(trim($_POST['x2_tag'])) : '';
$x2_target = isset($_POST['x2_target']) ? clean_xss_tags(trim($_POST['x2_target'])) : '0';
$x2_target_type = isset($_POST['x2_target_type']) ? clean_xss_tags(trim($_POST['x2_target_type'])) : 'amount';
$x2_rate = isset($_POST['x2_rate']) ? clean_xss_tags(trim($_POST['x2_rate'])) : '0';
// [기존] 마진, 계정 값 받기
$x2_margin = isset($_POST['x2_margin']) ? clean_xss_tags(trim($_POST['x2_margin'])) : '1';
$x2_account = isset($_POST['x2_account']) ? clean_xss_tags(trim($_POST['x2_account'])) : '';
// [추가됨] 수량(QTY) 값 받기 (오빠가 입력한 그 양!)
$x2_qty = isset($_POST['x2_qty']) ? clean_xss_tags(trim($_POST['x2_qty'])) : '0';
// 2. 날짜/시간 커스텀 업데이트 로직
$add_sql = "";
if (!empty($_POST['wr_date_custom']) && !empty($_POST['wr_time_custom'])) {
$custom_datetime = "{$_POST['wr_date_custom']} {$_POST['wr_time_custom']}";
$add_sql = " , wr_datetime = '{$custom_datetime}' ";
}
// 3. 단일 쿼리로 필드 업데이트 (수량 정보까지 꽉 채워서 박습니다!)
$sql = " UPDATE {$write_table}
SET x2_ver = '{$x2_ver}',
x2_ca2 = '{$x2_ca2}',
x2_ca3 = '{$x2_ca3}',
x2_ca4 = '{$x2_ca4}',
x2_coin = '{$x2_coin}',
x2_tag = '{$x2_tag}',
x2_target = '{$x2_target}',
x2_target_type = '{$x2_target_type}',
x2_rate = '{$x2_rate}',
x2_margin = '{$x2_margin}',
x2_account = '{$x2_account}',
x2_qty = '{$x2_qty}'
{$add_sql}
WHERE wr_id = '{$wr_id}' ";
sql_query($sql);
?>