delete_all 부분 문의드립니다.

delete_all 부분 문의드립니다.

QA

delete_all 부분 문의드립니다.

답변 1

본문

https://sir.kr/g5_skin/319?sfl=wr_subject%7C%7Cwr_content&stx=%ED%8E%9C%EC%85%98

위 스킨을 사용하려고 하는데요

 

예약이 완료된 리스트 게시물을 관리자가 선택해서 예약취소를 누르면 /bbs/delete_all.php 화면으로 넘어가서 화면이 아무것도 안보이고 하얗게 나오면서 삭제가 안되는데 이럴경우는 왜그러는건가요?

 

아래 소스는 예약 리스트 페이지인데 여기서 예약취소 버튼을 누르면 /bbs/delete_all.php로 넘어가요.

 

list.skin.php 소스


<?php
// 스킨파일은 단독으로 실행할 수 없다
if(defined('_GNUBOARD_') == false)
{
    exit('스킨파일은 단독으로 실행할 수 없습니다.');
}
// 프로그램 연산에 필요한 선행함수를 실행한다
include_once($board_skin_path . '/skin.function.php');
// 관리자여부와 세션설정에 따라 화면출력을 변경한다
if($is_admin && $_SESSION['admin'])
{
?>
<script>
var g5_bbs_skin_url = "<?php echo $board_skin_url; ?>";
</script>
<script src="<?php echo $board_skin_url; ?>/script.js"></script>
<link rel="stylesheet" href="<?php echo $board_skin_url; ?>/style.css">
<form id="mara_list" name="fboardlist" method="post" style="width:<?php echo $width; ?>;">
    <p>
        <input type="hidden" name="bo_table" value="<?php echo $bo_table; ?>">
        <input type="hidden" name="page" value="<?php echo $page; ?>">
        <input type="hidden" name="sw" value="">
    </p>
    <table class="mara_rl">
    <caption>객실예약목록</caption>
    <colgroup>
        <col class="rm_grid_1"><!-- 5% -->
        <col class="rm_grid_3"><!-- 15% -->
        <col class="rm_grid_5"><!-- 25% -->
        <col class="rm_grid_5"><!-- 25% -->
        <col class="rm_grid_3"><!-- 15% -->
        <col class="rm_grid_3"><!-- 15% -->
    </colgroup>
    <thead>
    <tr>
        <?php if ($is_checkbox) { ?>
        <th scope="col">
            <label for="chkall" class="sound_only">게시물 전체</label>
            <input type="checkbox" id="chkall" onclick="if(this.checked) all_checked(true);else all_checked(false);">
        </th>
        <?php } ?>
        <th scope="col">예약일자</th>
        <th scope="col">숙박정보</th>
        <th scope="col">숙박일자</th>
        <th scope="col">예약자정보</th>
        <th scope="col">이용금액</th>
    </tr>
    </thead>
    <tbody>
    <?php for($i = 0; $i < count($list); $i++) { ?>
    <tr>
        <?php if ($is_checkbox) { ?>
        <td>
            <label for="chk_wr_id_<?php echo $i ?>" class="sound_only"><?php echo $list[$i]['subject'] ?></label>
            <input type="checkbox" name="chk_wr_id[]" value="<?php echo $list[$i]['wr_id'] ?>" id="chk_wr_id_<?php echo $i ?>">
        </td>
        <?php } ?>
        <td><?php echo $list[$i]['datetime2']; ?></td>
        <td>
            <span class="frm_info"><a href="<?php echo $list[$i]['href']; ?>"><strong><?php echo $list[$i]['subject']; ?></strong></a></span>
            (<?php echo $list[$i]['wr_3']; ?>박 <?php echo $list[$i]['wr_3'] + 1; ?>일, <?php echo $list[$i]['wr_4']; ?>명)
        </td>
        <td><?php echo $list[$i]['wr_1']; ?> ~ <?php echo $list[$i]['wr_2']; ?></td>
        <td>
            <span class="frm_info"><?php echo $list[$i]['name']; ?></span>
            <?php echo $list[$i]['wr_homepage']; ?>
        </td>
        <td>
            <span class="frm_info"><?php if($list[$i]['wr_7'] == 'T'){ echo '<strong>예약완료</strong>'; } else{ echo '<strong>예약접수</strong>'; } ?></span>
            <?php echo number_format($list[$i]['wr_6']); ?>원
        </td>
    </tr>
    <?php } // for 끝
    if ($i == 0) {
        if($is_checkbox) $colspan = 6;
        else $colspan = 6;
        echo '<tr><td colspan="'.$colspan.'" class="empty_table">예약 내역이 없습니다.</td></tr>';
    }
    ?>
    </tbody>
    </table>
    <?php echo $write_pages; ?>
    <div class="mara_btn_area">
        <a href="#none" onclick="selectFinish();"><img src="<?php echo $board_skin_url; ?>/img/b_finish.gif" alt="예약완료"></a>
        <a href="#none" onclick="select_delete();"><img src="<?php echo $board_skin_url; ?>/img/b_delete.gif" alt="예약취소"></a>
        <a href="<?php echo G5_BBS_URL; ?>/board.php?bo_table=<?php echo $bo_table; ?>&type=false"><img src="<?php echo $board_skin_url; ?>/img/b_calendar.gif" alt="달력보기"></a>
    </div>
</form>
<?php
}
else
{
    include_once($board_skin_path . '/calendar.skin.php');
}
?>

 

 

그리고 아래는 delete.all.php 소스인데요 이부분이 문제인것같은데 어떻게 해야하나요?


<?php
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
if(!$is_admin)
    alert('접근 권한이 없습니다.', G5_URL);
// 4.11
@include_once($board_skin_path.'/delete_all.head.skin.php');
$count_write = 0;
$count_comment = 0;
$tmp_array = array();
if ($wr_id) // 건별삭제
    $tmp_array[0] = $wr_id;
else // 일괄삭제
    $tmp_array = $_POST['chk_wr_id'];
$chk_count = count($tmp_array);
if($chk_count > (G5_IS_MOBILE ? $board['bo_mobile_page_rows'] : $board['bo_page_rows']))
    alert('올바른 방법으로 이용해 주십시오.');
// 사용자 코드 실행
@include_once($board_skin_path.'/delete_all.skin.php');

// 거꾸로 읽는 이유는 답변글부터 삭제가 되어야 하기 때문임
for ($i=$chk_count-1; $i>=0; $i--)
{
    $write = sql_fetch(" select * from $write_table where wr_id = '$tmp_array[$i]' ");
    if ($is_admin == 'super') // 최고관리자 통과
        ;
    else if ($is_admin == 'group') // 그룹관리자
    {
        $mb = get_member($write['mb_id']);
        if ($member['mb_id'] == $group['gr_admin']) // 자신이 관리하는 그룹인가?
        {
            if ($member['mb_level'] >= $mb['mb_level']) // 자신의 레벨이 크거나 같다면 통과
                ;
            else
                continue;
        }
        else
            continue;
    }
    else if ($is_admin == 'board') // 게시판관리자이면
    {
        $mb = get_member($write['mb_id']);
        if ($member['mb_id'] == $board['bo_admin']) // 자신이 관리하는 게시판인가?
            if ($member['mb_level'] >= $mb['mb_level']) // 자신의 레벨이 크거나 같다면 통과
                ;
            else
                continue;
        else
            continue;
    }
    else if ($member['mb_id'] && $member['mb_id'] == $write['mb_id']) // 자신의 글이라면
    {
        ;
    }
    else if ($wr_password && !$write['mb_id'] && check_password($wr_password, $write['wr_password'])) // 비밀번호가 같다면
    {
        ;
    }
    else
        continue;   // 나머지는 삭제 불가
    $len = strlen($write['wr_reply']);
    if ($len < 0) $len = 0;
    $reply = substr($write['wr_reply'], 0, $len);
    // 원글만 구한다.
    $sql = " select count(*) as cnt from $write_table
                where wr_reply like '$reply%'
                and wr_id <> '{$write['wr_id']}'
                and wr_num = '{$write['wr_num']}'
                and wr_is_comment = 0 ";
    $row = sql_fetch($sql);
    if ($row['cnt'])
            continue;
    // 나라오름님 수정 : 원글과 코멘트수가 정상적으로 업데이트 되지 않는 오류를 잡아 주셨습니다.
    //$sql = " select wr_id, mb_id, wr_comment from {$write_table} where wr_parent = '{$write[wr_id]}' order by wr_id ";
    $sql = " select wr_id, mb_id, wr_is_comment, wr_content from $write_table where wr_parent = '{$write['wr_id']}' order by wr_id ";
    $result = sql_query($sql);
    while ($row = sql_fetch_array($result))
    {
        // 원글이라면
        if (!$row['wr_is_comment'])
        {
            // 원글 포인트 삭제
            if (!delete_point($row['mb_id'], $bo_table, $row['wr_id'], '쓰기'))
                insert_point($row['mb_id'], $board['bo_write_point'] * (-1), "{$board['bo_subject']} {$row['wr_id']} 글 삭제");
            // 업로드된 파일이 있다면
            $sql2 = " select * from {$g5['board_file_table']} where bo_table = '$bo_table' and wr_id = '{$row['wr_id']}' ";
            $result2 = sql_query($sql2);
            while ($row2 = sql_fetch_array($result2)) {
                // 파일삭제
                @unlink(G5_DATA_PATH.'/file/'.$bo_table.'/'.$row2['bf_file']);
                // 썸네일삭제
                if(preg_match("/\.({$config['cf_image_extension']})$/i", $row2['bf_file'])) {
                    delete_board_thumbnail($bo_table, $row2['bf_file']);
                }
            }
            // 에디터 썸네일 삭제
            delete_editor_thumbnail($row['wr_content']);
            // 파일테이블 행 삭제
            sql_query(" delete from {$g5['board_file_table']} where bo_table = '$bo_table' and wr_id = '{$row['wr_id']}' ");
            $count_write++;
        }
        else
        {
            // 코멘트 포인트 삭제
            if (!delete_point($row['mb_id'], $bo_table, $row['wr_id'], '댓글'))
                insert_point($row['mb_id'], $board['bo_comment_point'] * (-1), "{$board['bo_subject']} {$write['wr_id']}-{$row['wr_id']} 댓글삭제");
            $count_comment++;
        }
    }
    // 게시글 삭제
    sql_query(" delete from $write_table where wr_parent = '{$write['wr_id']}' ");
    // 최근게시물 삭제
    sql_query(" delete from {$g5['board_new_table']} where bo_table = '$bo_table' and wr_parent = '{$write['wr_id']}' ");
    // 스크랩 삭제
    sql_query(" delete from {$g5['scrap_table']} where bo_table = '$bo_table' and wr_id = '{$write['wr_id']}' ");
    /*
    // 공지사항 삭제
    $notice_array = explode(',', trim($board['bo_notice']));
    $bo_notice = "";
    for ($k=0; $k<count($notice_array); $k++)
        if ((int)$write['wr_id'] != (int)$notice_array[$k])
            $bo_notice .= $notice_array[$k].',';
    $bo_notice = trim($bo_notice);
    */
    $bo_notice = board_notice($board['bo_notice'], $write['wr_id']);
    sql_query(" update {$g5['board_table']} set bo_notice = '$bo_notice' where bo_table = '$bo_table' ");
    $board['bo_notice'] = $bo_notice;
}
// 글숫자 감소
if ($count_write > 0 || $count_comment > 0)
    sql_query(" update {$g5['board_table']} set bo_count_write = bo_count_write - '$count_write', bo_count_comment = bo_count_comment - '$count_comment' where bo_table = '$bo_table' ");
// 4.11
@include_once($board_skin_path.'/delete_all.tail.skin.php');
delete_cache_latest($bo_table);
goto_url(G5_HTTP_BBS_URL.'/board.php?bo_table='.$bo_table.'&page='.$page.$qstr);
?>

 

이 질문에 댓글 쓰기 :

답변 1

에러가 발생했을 때, 에러 메시지가 출력되지 않은 환경이라면..

 

에러 메시지가 출력되도록 한 후, 질문내용에 추가하거나 새로 올리는 게 좋을 듯 합니다.

 

에러 메시지 출력 방법 참고글입니다. - https://sir.kr/pg_tip/13807

답변을 작성하시기 전에 로그인 해주세요.
QA 내용 검색
질문등록
전체 96
© SIRSOFT
현재 페이지 제일 처음으로