first commit 2
This commit is contained in:
@@ -0,0 +1,83 @@
|
||||
<?php
|
||||
$sub_menu = "800700";
|
||||
include_once('./_common.php');
|
||||
|
||||
if ($w == 'd')
|
||||
auth_check($auth[$sub_menu], 'd');
|
||||
else
|
||||
auth_check($auth[$sub_menu], 'w');
|
||||
|
||||
check_admin_token();
|
||||
|
||||
$act_button = isset($_POST['act_button']) ? $_POST['act_button'] : '';
|
||||
|
||||
if ($act_button == "선택수정") {
|
||||
|
||||
for ($i=0; $i<count($_POST['chk']); $i++) {
|
||||
$k = isset($_POST['chk'][$i]) ? (int) $_POST['chk'][$i] : 0;
|
||||
$id = isset($_POST['id'][$k]) ? (int) $_POST['id'][$k] : 0;
|
||||
|
||||
$sql = "UPDATE `order_window_brands`
|
||||
SET brand_name = '".sql_real_escape_string($_POST['brand_name'][$k])."',
|
||||
brand_code = '".sql_real_escape_string($_POST['brand_code'][$k])."',
|
||||
manufacturer = '".sql_real_escape_string($_POST['manufacturer'][$k])."',
|
||||
sort_order = '".(int)($_POST['sort_order'][$k])."',
|
||||
is_used = '".(isset($_POST['is_used'][$k]) ? 1 : 0)."'
|
||||
WHERE id = '{$id}'";
|
||||
sql_query($sql);
|
||||
}
|
||||
|
||||
} else if ($act_button == "선택삭제") {
|
||||
|
||||
for ($i=0; $i<count($_POST['chk']); $i++) {
|
||||
$k = isset($_POST['chk'][$i]) ? (int) $_POST['chk'][$i] : 0;
|
||||
$id = isset($_POST['id'][$k]) ? (int) $_POST['id'][$k] : 0;
|
||||
|
||||
// 소프트 삭제 (is_deleted 플래그 사용)
|
||||
$sql = "UPDATE `order_window_brands` SET is_deleted = 1 WHERE id = '{$id}'";
|
||||
sql_query($sql);
|
||||
}
|
||||
|
||||
} else if ($act_button == "추가") {
|
||||
|
||||
$brand_name = isset($_POST['brand_name']) ? trim(strip_tags(clean_xss_attributes($_POST['brand_name']))) : '';
|
||||
if (!$brand_name) {
|
||||
alert('브랜드명을 입력해주세요.');
|
||||
}
|
||||
|
||||
// 중복 체크
|
||||
$sql = "SELECT COUNT(*) as cnt FROM `order_window_brands` WHERE brand_name = '".sql_real_escape_string($brand_name)."' AND is_deleted = 0";
|
||||
$row = sql_fetch($sql);
|
||||
if ($row['cnt']) {
|
||||
alert('이미 등록된 브랜드명입니다.');
|
||||
}
|
||||
|
||||
$sql = "INSERT INTO `order_window_brands`
|
||||
SET brand_name = '".sql_real_escape_string($brand_name)."',
|
||||
brand_code = '".sql_real_escape_string($_POST['brand_code'])."',
|
||||
manufacturer = '".sql_real_escape_string($_POST['manufacturer'])."',
|
||||
sort_order = '".(int)($_POST['sort_order'])."',
|
||||
is_used = '".(isset($_POST['is_used']) ? 1 : 0)."',
|
||||
is_deleted = 0,
|
||||
created_at = NOW(),
|
||||
updated_at = NOW()";
|
||||
sql_query($sql);
|
||||
|
||||
} else if ($w == 'd') {
|
||||
|
||||
$id = isset($_GET['id']) ? (int) $_GET['id'] : 0;
|
||||
if (!$id) {
|
||||
alert('잘못된 접근입니다.');
|
||||
}
|
||||
|
||||
// 소프트 삭제 (is_deleted 플래그 사용)
|
||||
$sql = "UPDATE `order_window_brands` SET is_deleted = 1 WHERE id = '{$id}'";
|
||||
sql_query($sql);
|
||||
|
||||
} else {
|
||||
alert('잘못된 접근입니다.');
|
||||
}
|
||||
|
||||
$qstr = "page={$page}&stx={$stx}";
|
||||
goto_url("./brand_manager.php?{$qstr}");
|
||||
?>
|
||||
Reference in New Issue
Block a user