Files
Gnuboard5/bbs/poll_etc_update.php
T
thisgun c450f8bbde 관리자 권한 문맥 오염 계열 접근권한 점검 및 보완
게시판/그룹 관리자 문맥(bo_table)으로 타 회원 콘텐츠에 접근·변조되지
않도록 $is_admin 판정을 최고관리자(super) 기준으로 통일.
- bbs/poll_etc_update.php : 설문 기타의견 삭제 소유권
- shop/itemqaformupdate.php : 상품문의 수정/삭제 소유권
- shop/itemuseformupdate.php : 사용후기 삭제 소유권
- bbs/current_connect.php : 게스트 IP 원본 표기
- shop/kakaopay/kakaopay_cancel.php : TID 기반 결제취소

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
(cherry picked from commit 46a005129464d1fbab518fcb70bf524b258e65fc)
2026-08-24 07:44:22 +00:00

71 lines
2.7 KiB
PHP

<?php
include_once('./_common.php');
include_once(G5_LIB_PATH.'/mailer.lib.php');
if (function_exists('check_request_origin')) check_request_origin(G5_BBS_URL);
if ($w == '')
{
$po_id = isset($_POST['po_id']) ? (int) $_POST['po_id'] : '';
$po = sql_fetch(" select * from {$g5['poll_table']} where po_id = '{$po_id}' ");
if (!$po['po_id'])
alert('po_id 값이 제대로 넘어오지 않았습니다.');
// 기타의견 사용 여부 검사
if (!$po['po_etc'])
alert('기타의견이 비활성화되어 있습니다.');
// 접근 권한 검사
if ($member['mb_level'] < $po['po_level'])
alert('권한이 없습니다.');
$pc_name = isset($_POST['pc_name']) ? addslashes(clean_xss_tags(stripslashes($_POST['pc_name']), 1, 1)) : '';
$pc_name = preg_replace("#[\\\]+$#", "", $pc_name);
$pc_idea = isset($_POST['pc_idea']) ? addslashes(clean_xss_tags(stripslashes($_POST['pc_idea']), 1, 1)) : '';
$tmp_row = sql_fetch(" select max(pc_id) as max_pc_id from {$g5['poll_etc_table']} ");
$pc_id = $tmp_row['max_pc_id'] + 1;
$sql = " insert into {$g5['poll_etc_table']}
( pc_id, po_id, mb_id, pc_name, pc_idea, pc_datetime )
values ( '{$pc_id}', '{$po_id}', '{$member['mb_id']}', '{$pc_name}', '{$pc_idea}', '".G5_TIME_YMDHIS."' ) ";
sql_query($sql);
$pc_idea = stripslashes($pc_idea);
$name = get_text(cut_str($pc_name, $config['cf_cut_name']));
$mb_id = '';
if ($member['mb_id'])
$mb_id = '('.$member['mb_id'].')';
// 환경설정의 투표 기타의견 작성시 최고관리자에게 메일발송 사용에 체크되어 있을 경우
if ($config['cf_email_po_super_admin'])
{
$subject = $po['po_subject'];
$content = $pc_idea;
ob_start();
include_once ('./poll_etc_update_mail.php');
$content = ob_get_contents();
ob_end_clean();
// 관리자에게 보내는 메일
$admin = get_admin('super');
$from_email = $member['mb_email'] ? $member['mb_email'] : $admin['mb_email'];
mailer($name, $from_email, $admin['mb_email'], '['.$config['cf_title'].'] 설문조사 기타의견 메일', $content, 1);
}
}
else if ($w == 'd')
{
if ($member['mb_id'] || $is_admin == 'super')
{
$sql = " delete from {$g5['poll_etc_table']} where pc_id = '{$pc_id}' ";
// 최고관리자가 아니면 본인 기타의견만 삭제 (게시판/그룹 관리자 문맥으로 우회 불가)
if ($is_admin !== 'super')
$sql .= " and mb_id = '{$member['mb_id']}' ";
sql_query($sql);
}
}
goto_url('./poll_result.php?po_id='.$po_id.'&amp;skin_dir='.$skin_dir);