- 상품이벤트/개인결제복사/SMS 번호·그룹·폼·업로드/방문로그 삭제 등 POST 기반 상태변경 처리에 check_request_origin() 적용 (스킨 수정 불필요) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
83 lines
3.1 KiB
PHP
83 lines
3.1 KiB
PHP
<?php
|
|
$sub_menu = "900700";
|
|
include_once("./_common.php");
|
|
|
|
$post_chk = (isset($_POST['chk']) && is_array($_POST['chk'])) ? $_POST['chk'] : array();
|
|
|
|
auth_check_menu($auth, $sub_menu, "w");
|
|
|
|
if (function_exists('check_request_origin')) check_request_origin(G5_ADMIN_URL);
|
|
|
|
if ($w == 'u') // 업데이트
|
|
{
|
|
for ($i=0; $i<count($post_chk); $i++)
|
|
{
|
|
// 실제 번호를 넘김
|
|
$k = $post_chk[$i];
|
|
$bg_no = isset($_POST['bg_no'][$k]) ? (int) $_POST['bg_no'][$k] : 0;
|
|
$bg_name = isset($_POST['bg_name'][$k]) ? strip_tags(clean_xss_attributes(stripslashes($_POST['bg_name'][$k]))) : '';
|
|
|
|
if (!is_numeric($bg_no))
|
|
alert('그룹 고유번호가 없습니다.');
|
|
|
|
$res = sql_fetch("select * from {$g5['sms5_book_group_table']} where bg_no='$bg_no'");
|
|
if (!$res)
|
|
alert('존재하지 않는 그룹입니다.');
|
|
|
|
if (!strlen(trim($bg_name)))
|
|
alert('그룹명을 입력해주세요');
|
|
|
|
$res = sql_fetch("select bg_name from {$g5['sms5_book_group_table']} where bg_no<>'$bg_no' and bg_name='".sql_real_escape_string($bg_name)."'");
|
|
if ($res)
|
|
alert('같은 그룹명이 존재합니다.');
|
|
|
|
sql_query("update {$g5['sms5_book_group_table']} set bg_name='".sql_real_escape_string($bg_name)."' where bg_no='$bg_no'");
|
|
}
|
|
}
|
|
else if ($w == 'de') // 그룹삭제
|
|
{
|
|
for ($i=0; $i<count($post_chk); $i++)
|
|
{
|
|
// 실제 번호를 넘김
|
|
$k = $post_chk[$i];
|
|
$bg_no = isset($_POST['bg_no'][$k]) ? (int) $_POST['bg_no'][$k] : 0;
|
|
|
|
if (!is_numeric($bg_no))
|
|
alert('그룹 고유번호가 없습니다.');
|
|
|
|
$res = sql_fetch("select * from {$g5['sms5_book_group_table']} where bg_no='$bg_no'");
|
|
if (!$res)
|
|
alert('존재하지 않는 그룹입니다.');
|
|
|
|
sql_query("delete from {$g5['sms5_book_group_table']} where bg_no='$bg_no'");
|
|
sql_query("update {$g5['sms5_book_table']} set bg_no=1 where bg_no='$bg_no'");
|
|
}
|
|
}
|
|
else if ($w == 'em') // 비우기
|
|
{
|
|
for ($i=0; $i<count($post_chk); $i++)
|
|
{
|
|
// 실제 번호를 넘김
|
|
$k = $post_chk[$i];
|
|
$bg_no = isset($_POST['bg_no'][$k]) ? (int) $_POST['bg_no'][$k] : 0;
|
|
|
|
sql_query("update {$g5['sms5_book_group_table']} set bg_count = 0, bg_member = 0, bg_nomember = 0, bg_receipt = 0, bg_reject = 0 where bg_no='$bg_no'");
|
|
sql_query("delete from {$g5['sms5_book_table']} where bg_no='$bg_no'");
|
|
}
|
|
}
|
|
else // 등록
|
|
{
|
|
$bg_name = isset($_REQUEST['bg_name']) ? strip_tags(clean_xss_attributes(stripslashes($_REQUEST['bg_name']))) : '';
|
|
|
|
if (!strlen(trim($bg_name)))
|
|
alert('그룹명을 입력해주세요');
|
|
|
|
$res = sql_fetch("select bg_name from {$g5['sms5_book_group_table']} where bg_name='".sql_real_escape_string($bg_name)."'");
|
|
if ($res)
|
|
alert('같은 그룹명이 존재합니다.');
|
|
|
|
sql_query("insert into {$g5['sms5_book_group_table']} set bg_name='".sql_real_escape_string($bg_name)."'");
|
|
}
|
|
|
|
goto_url('./num_group.php');
|