function myshop_item_delete($it_id) { global $g5, $is_auth; //거래내역이 있으면 그냥 통과 if (!$is_auth) { $ct = sql_fetch(" select it_id from {$g5['g5_shop_cart_table']} where it_id = '{$it_id}' and od_id <> '' and ct_status != '쇼핑' "); if ($ct['it_id']) { return; } } //삭제시작 $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\n\t\t\t\t\tfrom {$g5['g5_shop_item_table']} where it_id = '{$it_id}' "; $it = sql_fetch($sql); // 상품 이미지 삭제 $dir_list = array(); for ($i = 1; $i <= 10; $i++) { $file = G5_DATA_PATH . '/item/' . $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 . "/item/{$it_id}" . "_h"); @unlink(G5_DATA_PATH . "/item/{$it_id}" . "_t"); // 장바구니 삭제 sql_query(" delete from {$g5['g5_shop_cart_table']} where it_id = '{$it_id}' and ct_status = '쇼핑' "); // 이벤트삭제 sql_query(" delete from {$g5['g5_shop_event_item_table']} where it_id = '{$it_id}' "); // 사용후기삭제 sql_query(" delete from {$g5['g5_shop_item_use_table']} where it_id = '{$it_id}' "); // 상품문의삭제 sql_query(" delete from {$g5['g5_shop_item_qa_table']} where it_id = '{$it_id}' "); // 관련상품삭제 sql_query(" delete from {$g5['g5_shop_item_relation_table']} where it_id = '{$it_id}' or it_id2 = '{$it_id}' "); // 옵션삭제 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_query(" delete from {$g5['g5_shop_item_table']} where it_id = '{$it_id}' "); // 댓글삭제 apms_delete_comment($it_id); // 태그삭제 apms_delete_tag($it_id); // 파일삭제 apms_delete_file('item', $it_id); // 폴더삭제 apms_delete_dir($it_id); }
<?php if (!defined('_GNUBOARD_')) { exit; } $mb = apms_partner($pt_id); if (!$mb['pt_id']) { alert('존재하지 않는 파트너입니다.'); } if ($mode == "pform") { check_token(); //삭제시 if (isset($_POST['pt_del']) && $_POST['pt_del']) { //파일 삭제 apms_delete_file("partner", $pt_id); //파트너 삭제 sql_query(" delete from {$g5['apms_partner']} where pt_id = '{$pt_id}' "); //회원정보에서 정보변경 sql_query(" update {$g5['member_table']} set as_partner = '0', as_marketer = '0' where mb_id = '{$pt_id}' ", false); //이동하기 goto_url('./apms.admin.php?ap=plist&' . $qstr); } //업데이트 $sql = " update {$g5['apms_partner']}\n set pt_type\t\t\t\t\t= '{$_POST['pt_type']}'\n\t\t\t\t\t, pt_register\t\t\t= '{$_POST['pt_register']}'\n\t\t\t\t\t, pt_leave\t\t\t\t= '{$_POST['pt_leave']}'\n\t\t\t\t\t, pt_name\t\t\t\t= '{$_POST['pt_name']}'\n\t\t\t\t\t, pt_hp\t\t\t\t\t= '{$_POST['pt_hp']}'\n\t\t\t\t\t, pt_email\t\t\t\t= '{$_POST['pt_email']}'\n\t\t\t\t\t, pt_partner\t\t\t= '{$_POST['pt_partner']}'\n\t\t\t\t\t, pt_marketer\t\t\t= '{$_POST['pt_marketer']}'\n\t\t\t\t\t, pt_company\t\t\t= '{$_POST['pt_company']}'\n\t\t\t\t\t, pt_company_name\t\t= '{$_POST['pt_company_name']}'\n\t\t\t\t\t, pt_company_president\t= '{$_POST['pt_company_president']}'\n\t\t\t\t\t, pt_company_saupja\t\t= '{$_POST['pt_company_saupja']}'\n\t\t\t\t\t, pt_company_addr\t\t= '{$_POST['pt_company_addr']}'\n\t\t\t\t\t, pt_company_type\t\t= '{$_POST['pt_company_type']}'\n\t\t\t\t\t, pt_company_item\t\t= '{$_POST['pt_company_item']}'\n\t\t\t\t\t, pt_bank_name\t\t\t= '{$_POST['pt_bank_name']}'\n\t\t\t\t\t, pt_bank_account\t\t= '{$_POST['pt_bank_account']}'\n\t\t\t\t\t, pt_bank_holder\t\t= '{$_POST['pt_bank_holder']}'\n\t\t\t\t\t, pt_bank_limit\t\t\t= '{$_POST['pt_bank_limit']}'\n\t\t\t\t\t, pt_flag\t\t\t\t= '{$_POST['pt_flag']}'\n\t\t\t\t\t, pt_point\t\t\t\t= '{$_POST['pt_point']}'\n\t\t\t\t\t, pt_benefit\t\t\t= '{$_POST['pt_benefit']}'\n\t\t\t\t\t, pt_level\t\t\t\t= '{$_POST['pt_level']}'\n\t\t\t\t\t, pt_limit\t\t\t\t= '{$_POST['pt_limit']}'\n\t\t\t\t\t, pt_commission_1\t\t= '{$_POST['pt_commission_1']}'\n\t\t\t\t\t, pt_commission_2\t\t= '{$_POST['pt_commission_2']}'\n\t\t\t\t\t, pt_commission_3\t\t= '{$_POST['pt_commission_3']}'\n\t\t\t\t\t, pt_commission_4\t\t= '{$_POST['pt_commission_4']}'\n\t\t\t\t\t, pt_commission_5\t\t= '{$_POST['pt_commission_5']}'\n\t\t\t\t\t, pt_incentive_1\t\t= '{$_POST['pt_incentive_1']}'\n\t\t\t\t\t, pt_incentive_2\t\t= '{$_POST['pt_incentive_2']}'\n\t\t\t\t\t, pt_incentive_3\t\t= '{$_POST['pt_incentive_3']}'\n\t\t\t\t\t, pt_incentive_4\t\t= '{$_POST['pt_incentive_4']}'\n\t\t\t\t\t, pt_incentive_5\t\t= '{$_POST['pt_incentive_5']}'\n\t\t\t\t\t, pt_memo\t\t\t\t= '{$_POST['pt_memo']}'\n\t\t\t\t\t, pt_1\t\t\t\t\t= '{$_POST['pt_1']}'\n\t\t\t\t\t, pt_2\t\t\t\t\t= '{$_POST['pt_2']}'\n\t\t\t\t\t, pt_3\t\t\t\t\t= '{$_POST['pt_3']}'\n\t\t\t\t\t, pt_4\t\t\t\t\t= '{$_POST['pt_4']}'\n\t\t\t\t\t, pt_5\t\t\t\t\t= '{$_POST['pt_5']}'\n\t\t\t\t\t, pt_6\t\t\t\t\t= '{$_POST['pt_6']}'\n\t\t\t\t\t, pt_7\t\t\t\t\t= '{$_POST['pt_7']}'\n\t\t\t\t\t, pt_8\t\t\t\t\t= '{$_POST['pt_8']}'\n\t\t\t\t\t, pt_9\t\t\t\t\t= '{$_POST['pt_9']}'\n\t\t\t\t\t, pt_10\t\t\t\t\t= '{$_POST['pt_10']}'\n\t\t\t\twhere pt_id\t\t\t\t\t= '{$pt_id}' "; sql_query($sql); if ($_POST['pt_register']) { // 승인정보가 있을 경우 sql_query(" update {$g5['member_table']} set as_partner = '{$_POST['pt_partner']}', as_marketer = '{$_POST['pt_marketer']}' where mb_id = '{$pt_id}' ", false); } else { // 없다면 sql_query(" update {$g5['member_table']} set as_partner = '0', as_marketer = '0' where mb_id = '{$pt_id}' ", false);