g5_board_file 관련 질문입니다

g5_board_file 관련 질문입니다

QA

g5_board_file 관련 질문입니다

본문


// 삭제에 체크가 되어있다면 파일을 삭제합니다.
        if (isset($_POST['bf_file_del'][$i]) && $_POST['bf_file_del'][$i]) {
            $upload[$i]['del_check'] = true;
            $row = sql_fetch(" select * from {$g5['board_file_table']} where bo_table = '{$bo_table}' and wr_id = '{$wr_id}' and bf_no = '{$i}' and bf_content = ''");
            $delete_file = run_replace('delete_file_path', G5_DATA_PATH.'/file/'.$bo_table.'/'.str_replace('../', '', $row['bf_file']), $row);
            if( file_exists($delete_file) ){
                @unlink($delete_file);
            }
            // 썸네일삭제
            if(preg_match("/\.({$config['cf_image_extension']})$/i", $row['bf_file'])) {
                delete_board_thumbnail($bo_table, $row['bf_file']);
            }
        }

if ($w == 'u') {
                // 존재하는 파일이 있다면 삭제합니다.
                $row = sql_fetch(" select * from {$g5['board_file_table']} where bo_table = '$bo_table' and wr_id = '$wr_id' and bf_no = '$i' and bf_content = ''");
                if(isset($row['bf_file']) && $row['bf_file']){
                    $delete_file = run_replace('delete_file_path', G5_DATA_PATH.'/file/'.$bo_table.'/'.str_replace('../', '', $row['bf_file']), $row);
                    if( file_exists($delete_file) ){
                        @unlink(G5_DATA_PATH.'/file/'.$bo_table.'/'.$row['bf_file']);
                    }
                    // 이미지파일이면 썸네일삭제
                    if(preg_match("/\.({$config['cf_image_extension']})$/i", $row['bf_file'])) {
                        delete_board_thumbnail($bo_table, $row['bf_file']);
                    }
                }
            }

 

/bbs/write_update.php입니다

 

특정 게시판은 회원마다 첨부파일을 다르게 하고 있어서 그 게시판에서 업로드를 하면 bf_content 컬럼에 회원 아이디가 들어가게 처리했습니다
(그누보드 기존 코드에는 bf_content 공란입니다)
삭제 체크를 했을때 쿼리의 조건에 bf_content = '' 를 추가했는데 bf_content의 값이 있는 것까지 포함되서 삭제되어 버리는데 어떤게 잘못일까요 ?? 도움 주시면 감사하겠습니다

이 질문에 댓글 쓰기 :

답변 2

삭제 체크를 했을때 쿼리의 조건에 bf_content = '' 를 추가했는데

==

이 부분은 이미지 파일을 삭제하기 위해 select 조건걸 부분이고

 

bf_content의 값이 있는 것까지 포함되서 삭제되어 버리는데

==

이 부분은 DB 쪽인가요?

네 삭제되는 부분은 DB 데이터가 삭제되는데
sql_query(" delete from {$g5['board_file_table']} where bo_table = '{$bo_table}' and wr_id = '{$wr_id}' and bf_no = '{$i}' ");

write_update.php 에서 이 코드에서 실행되는거 같긴합니다

삭제 체크를 했을때 쿼리의 조건에 bf_content = '' 를 추가했는데 

===

추가한 부분이 어디에 있나요?

bbs/write_update.php 파일에서
$row = sql_fetch(" select * from {$g5['board_file_table']} where bo_table = '{$bo_table}' and wr_id = '{$wr_id}' and bf_no = '{$i}' and bf_content = ''");

이 쿼리에 bf_content = '' 를 추가했습니다

답변을 작성하시기 전에 로그인 해주세요.
전체 9
QA 내용 검색

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1404호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT