adm 상품관리에서 상품선택삭제가 안됩니다. 코드좀 봐주세요 ㅠㅠ
본문
<?php
// giftitemlistdelete.php 에서 include 하는 파일
if (!defined('_GNUBOARD_')) exit;
if (!defined('_ITEM_DELETE_')) exit; // 개별 페이지 접근 불가
if (!function_exists("itemdelete")) {
// 상품삭제
// 메세지출력후 주문개별내역페이지로 이동
function itemdelete($it_id)
{
global $g5, $is_admin;
$sql = " select it_explan, it_mobile_explan, it_img1, it_img2, it_img3, it_img4, it_img5, it_img6, it_img7, it_img8, it_img9, it_img10
from {$g5['g5_shop_giftitem_table']} where it_id = '$it_id' ";
$it = sql_fetch($sql);
// 상품 이미지 삭제
$dir_list = array();
for($i=1; $i<=10; $i++) {
$file = G5_DATA_PATH.'/giftitem/'.$it['it_img'.$i];
if(is_file($file) && $it['it_img'.$i]) {
@unlink($file);
$dir = dirname($file);
delete_item_thumbnail($dir, basename($file));
if(!in_array($dir, $dir_list))
$dir_list[] = $dir;
}
}
// 이미지디렉토리 삭제
for($i=0; $i<count($dir_list); $i++) {
if(is_dir($dir_list[$i]))
rmdir($dir_list[$i]);
}
// 상, 하단 이미지 삭제
@unlink(G5_DATA_PATH."/giftitem/$it_id"."_h");
@unlink(G5_DATA_PATH."/giftitem/$it_id"."_t");
// 장바구니 삭제
//$sql = " delete from {$g5['g5_shop_cart_table']} where it_id = '$it_id' and ct_status = '쇼핑' ";
//sql_query($sql);
// 이벤트삭제
//$sql = " delete from {$g5['g5_shop_event_item_table']} where it_id = '$it_id' ";
//sql_query($sql);
// 사용후기삭제
//$sql = " delete from {$g5['g5_shop_item_use_table']} where it_id = '$it_id' ";
//sql_query($sql);
// 상품문의삭제
//$sql = " delete from {$g5['g5_shop_item_qa_table']} where it_id = '$it_id' ";
//sql_query($sql);
// 관련상품삭제
//$sql = " delete from {$g5['g5_shop_item_relation_table']} where it_id = '$it_id' or it_id2 = '$it_id' ";
//sql_query($sql);
// 옵션삭제
//sql_query(" delete from {$g5['g5_shop_item_option_table']} where it_id = '$it_id' ");
//------------------------------------------------------------------------
// HTML 내용에서 에디터에 올라간 이미지의 경로를 얻어 삭제함
//------------------------------------------------------------------------
$imgs = get_editor_image($it['it_explan'], false);
for($i=0;$i<count($imgs[1]);$i++) {
$p = parse_url($imgs[1][$i]);
if(strpos($p['path'], "/data/") != 0)
$data_path = preg_replace("/^\/.*\/data/", "/data", $p['path']);
else
$data_path = $p['path'];
$destfile = G5_PATH.$data_path;
if(is_file($destfile))
@unlink($destfile);
}
$imgs = get_editor_image($it['it_mobile_explan'], false);
for($i=0;$i<count($imgs[1]);$i++) {
$p = parse_url($imgs[1][$i]);
if(strpos($p['path'], "/data/") != 0)
$data_path = preg_replace("/^\/.*\/data/", "/data", $p['path']);
else
$data_path = $p['path'];
$destfile = G5_PATH.$data_path;
if(is_file($destfile))
@unlink($destfile);
}
//------------------------------------------------------------------------
// 상품 삭제
$sql = " delete from {$g5['g5_shop_giftitem_table']} where it_id = '$it_id' ";
sql_query($sql);
}
}
itemdelete($it_id);
?>
데이터베이스에 'g5_shop_giftitem_table이란 데이터베이스를 만들고 해당하는 필드들을 다 넣었구요..
일단 상품관리에 상품 등록은 정상적으로 실행이 됩니다. data폴더에 정상적으로 giftitem이란 폴더가 생성되고 이미지도 정상 등록이 됩니다. 그런데 이상한건 리스트에서 삭제할 상품을 체크한뒤 선택삭제를 클릭하면
삭제할거냔 메시지가 뜨고 실행을하면 상품이 그대로 존재합니다. 물론 db에도 이미지 및 데이터가 그대로 남아있구요
혹 상품을 삭제할려면 어디어디 파일을 손을 봐야하나요 ㅠㅠ 좀 도와주세요...
!-->답변 2
삭제가 안된다는건
$sql
=
" delete from {$g5['g5_shop_giftitem_table']} where it_id = '$it_id' "
;
부분이 실행이 안댄다는 이야긴데
바로 아래에 echo $sql; 찍어서 확인해보세요 까지 실행이되고있는지
이미지조차 삭제가 안되는거로 봐선 giftitemlistdelete.inc.php 파일이 작동을 안하는걸로 보여집니다 .ㅜㅜ
lib > shop.lib.php 여기에도 이상이 있는지 확인해보고 또해봐도 계속 작동을 안하네요...
giftitemlist.php > giftitemlistupdate.php 파일까진 이상없이 값이 주어지는거 같은데 giftitemlistupdate.php > giftitemdelete.inc.php 여기에 명령어 실행이 안되는거 같습니다.
혹시 giftitemdelete.inc.php 이파일과 연동되어지는 파일들이 각각 어느 파일인지 알 수 있을까요?