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 쪽인가요?
삭제 체크를 했을때 쿼리의 조건에 bf_content = '' 를 추가했는데
===
추가한 부분이 어디에 있나요?
답변을 작성하시기 전에 로그인 해주세요.