Files
Gnuboard5/adm/shop_admin/orderdeliveryupdate.php
thisgunandClaude Opus 4.7 f4f8c57a74 [security] 관리자 영역 권한 검증 누락 및 CSRF 토큰 누락 수정
- adm/qa_config_update.php / adm/contentformupdate.php :
  qa_include_head/tail, co_include_head/tail 가 super 가드 없이 변경 가능해
  하위 관리자가 임의 PHP 경로를 include 시킬 수 있던 LFI 위험을
  board_form_update.php 와 동일한 패턴(super 외에는 기존 값 유지)으로 차단.

- adm/member_form_update.php / adm/member_list_update.php :
  신규 회원 생성·일괄 수정 시 부여하려는 mb_level 상한 검증이 없어
  하위 관리자가 자기보다 높은 등급을 부여할 수 있던 권한 상승을 차단.

- adm/shop_admin/categorylistupdate.php /
  adm/shop_admin/itemformupdate.php :
  is_include_path_check 호출에서 두 번째 인자(is_input=1) 누락으로
  rar/php/zip wrapper 등 경로 wrapper 차단이 동작하지 않던 부분을
  is_include_path_check($file, 1) 로 강화.

- adm/shop_admin/orderdeliveryupdate.php /
  adm/shop_admin/orderpartcancelupdate.php /
  adm/sendmail_test.php :
  상태 변경 동작에 check_admin_token() 누락으로 발생하던 CSRF 위험을
  토큰 검증 추가로 차단. sendmail_test 폼에는 hidden token 필드 추가.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-26 03:35:29 +00:00

186 lines
6.4 KiB
PHP

<?php
$sub_menu = '400400';
include_once('./_common.php');
include_once('./admin.shop.lib.php');
include_once(G5_LIB_PATH.'/mailer.lib.php');
auth_check_menu($auth, $sub_menu, "w");
check_admin_token();
define("_ORDERMAIL_", true);
$sms_count = 0;
$sms_messages = array();
if(isset($_FILES['excelfile']['tmp_name']) && $_FILES['excelfile']['tmp_name']) {
$file = $_FILES['excelfile']['tmp_name'];
include_once(G5_LIB_PATH.'/PHPExcel/IOFactory.php');
$objPHPExcel = PHPExcel_IOFactory::load($file);
$sheet = $objPHPExcel->getSheet(0);
$num_rows = $sheet->getHighestRow();
$highestColumn = $sheet->getHighestColumn();
$fail_od_id = array();
$total_count = 0;
$fail_count = 0;
$succ_count = 0;
// $i 사용시 ordermail.inc.php의 $i 때문에 무한루프에 빠짐
for ($k = 2; $k <= $num_rows; $k++) {
$total_count++;
$rowData = $sheet->rangeToArray('A' . $k . ':' . $highestColumn . $k,
NULL,
TRUE,
FALSE);
$od_id = isset($rowData[0][0]) ? addslashes(trim($rowData[0][0])) : '';
$od_delivery_company = isset($rowData[0][8]) ? addslashes($rowData[0][8]) : '';
$od_invoice = isset($rowData[0][9]) ? addslashes($rowData[0][9]) : '';
if(!$od_id || !$od_delivery_company || !$od_invoice) {
$fail_count++;
$fail_od_id[] = $od_id;
continue;
}
// 주문정보
$od = sql_fetch(" select * from {$g5['g5_shop_order_table']} where od_id = '$od_id' ");
if (!$od) {
$fail_count++;
$fail_od_id[] = $od_id;
continue;
}
if($od['od_status'] != '준비') {
$fail_count++;
$fail_od_id[] = $od_id;
continue;
}
$delivery['invoice'] = $od_invoice;
$delivery['invoice_time'] = G5_TIME_YMDHIS;
$delivery['delivery_company'] = $od_delivery_company;
// 주문정보 업데이트
order_update_delivery($od_id, $od['mb_id'], '배송', $delivery);
change_status($od_id, '준비', '배송');
$succ_count++;
$send_sms = isset($_POST['send_sms']) ? clean_xss_tags($_POST['send_sms'], 1, 1) : '';
$od_send_mail = isset($_POST['od_send_mail']) ? clean_xss_tags($_POST['od_send_mail'], 1, 1) : '';
$send_escrow = isset($_POST['send_escrow']) ? clean_xss_tags($_POST['send_escrow'], 1, 1) : '';
// SMS
if($config['cf_sms_use'] == 'icode' && $send_sms && $default['de_sms_use5']) {
$sms_contents = conv_sms_contents($od_id, $default['de_sms_cont5']);
if($sms_contents) {
$receive_number = preg_replace("/[^0-9]/", "", $od['od_hp']); // 수신자번호
$send_number = preg_replace("/[^0-9]/", "", $default['de_admin_company_tel']); // 발신자번호
if($receive_number)
$sms_messages[] = array('recv' => $receive_number, 'send' => $send_number, 'cont' => $sms_contents);
}
}
// 메일
if($config['cf_email_use'] && $od_send_mail)
include './ordermail.inc.php';
// 에스크로 배송
if($send_escrow && $od['od_tno'] && $od['od_escrow']) {
$escrow_tno = $od['od_tno'];
$escrow_numb = $od_invoice;
$escrow_corp = $od_delivery_company;
include(G5_SHOP_PATH.'/'.$od['od_pg'].'/escrow.register.php');
}
}
}
// SMS
$sms_count = count($sms_messages);
if($sms_count > 0) {
if($config['cf_sms_type'] == 'LMS') {
include_once(G5_LIB_PATH.'/icode.lms.lib.php');
$port_setting = get_icode_port_type($config['cf_icode_id'], $config['cf_icode_pw']);
// SMS 모듈 클래스 생성
if($port_setting !== false) {
$SMS = new LMS;
$SMS->SMS_con($config['cf_icode_server_ip'], $config['cf_icode_id'], $config['cf_icode_pw'], $port_setting);
for($s=0; $s<$sms_count; $s++) {
$strDest = array();
$strDest[] = $sms_messages[$s]['recv'];
$strCallBack = $sms_messages[$s]['send'];
$strCaller = iconv_euckr(trim($default['de_admin_company_name']));
$strSubject = '';
$strURL = '';
$strData = iconv_euckr($sms_messages[$s]['cont']);
$strDate = '';
$nCount = count($strDest);
$res = $SMS->Add($strDest, $strCallBack, $strCaller, $strSubject, $strURL, $strData, $strDate, $nCount);
$SMS->Send();
$SMS->Init(); // 보관하고 있던 결과값을 지웁니다.
}
}
} else {
include_once(G5_LIB_PATH.'/icode.sms.lib.php');
$SMS = new SMS; // SMS 연결
$SMS->SMS_con($config['cf_icode_server_ip'], $config['cf_icode_id'], $config['cf_icode_pw'], $config['cf_icode_server_port']);
for($s=0; $s<$sms_count; $s++) {
$recv_number = $sms_messages[$s]['recv'];
$send_number = $sms_messages[$s]['send'];
$sms_content = iconv_euckr($sms_messages[$s]['cont']);
$SMS->Add($recv_number, $send_number, $config['cf_icode_id'], $sms_content, "");
}
$SMS->Send();
$SMS->Init(); // 보관하고 있던 결과값을 지웁니다.
}
}
$g5['title'] = '엑셀 배송일괄처리 결과';
include_once(G5_PATH.'/head.sub.php');
?>
<div class="new_win">
<h1><?php echo $g5['title']; ?></h1>
<div class="local_desc01 local_desc">
<p>배송일괄처리를 완료했습니다.</p>
</div>
<dl id="excelfile_result">
<dt>총배송건수</dt>
<dd><?php echo number_format($total_count); ?></dd>
<dt class="result_done">완료건수</dt>
<dd class="result_done"><?php echo number_format($succ_count); ?></dd>
<dt class="result_fail">실패건수</dt>
<dd class="result_fail"><?php echo number_format($fail_count); ?></dd>
<?php if($fail_count > 0) { ?>
<dt>실패주문코드</dt>
<dd><?php echo implode(', ', $fail_od_id); ?></dd>
<?php } ?>
</dl>
<div class="btn_confirm01 btn_confirm">
<button type="button" onclick="window.close();">창닫기</button>
</div>
</div>
<?php
include_once(G5_PATH.'/tail.sub.php');