영카트 주문내역 수정에 이미지 업로드를 해보려는 도움부탁드립니다.

영카트 주문내역 수정에 이미지 업로드를 해보려는 도움부탁드립니다.

QA

영카트 주문내역 수정에 이미지 업로드를 해보려는 도움부탁드립니다.

답변 1

본문

영카트 주문내역 수정에 이미지 업로드를 해보려는 도움부탁드립니다.

 

이미지는 /item 폴더에 저장이 잘되는데,

shop_order 테이블에 it_img1 varchar (250)으로 컬럼을 추가했고, od_id를 인덱스값으로 하여

이미지를 shop_order 테이블에 넣으려고

itemform.php와 itemformupdate.php의 소스를 활용하여 작업했는데 

왜 디비에는 INSERT가 안되는지 모르겠습니다.

고수님들 한번 봐주세요. 

 


<?php
$sub_menu = '400300';
include_once('./_common.php');
 
if ($w == "u" || $w == "d")
    check_demo();
 
if ($w == '' || $w == 'u')
    auth_check($auth[$sub_menu], "w");
else if ($w == 'd')
    auth_check($auth[$sub_menu], "d");
 
check_admin_token();
 
(G5_DATA_PATH."/item", G5_DIR_PERMISSION);
@chmod(G5_DATA_PATH."/item", G5_DIR_PERMISSION);
 
// input vars 체크
check_input_vars();
 
$ca_id = isset($ca_id) ? preg_replace('/[^0-9a-z]/i', '', $ca_id) : '';
$ca_id2 = isset($ca_id2) ? preg_replace('/[^0-9a-z]/i', '', $ca_id2) : '';
$ca_id3 = isset($ca_id3) ? preg_replace('/[^0-9a-z]/i', '', $ca_id3) : '';
 
if ($is_admin != 'super') {     // 최고관리자가 아니면 체크
    $sql = "select b.ca_mb_id from {$g5['g5_shop_item_table']} a , {$g5['g5_shop_category_table']} b where (a.ca_id = b.ca_id) and a.it_id = '$it_id'";
    $checks = sql_fetch($sql);
 
    if( ! $checks['ca_mb_id'] || $checks['ca_mb_id'] !== $member['mb_id'] ){
        alert("해당 분류의 관리회원이 아닙니다.");
    }
}
 
// 파일정보
if($w == "u") {
    $sql = " select it_img1
                from {$g5['g5_shop_order_table']}
                where od_id = '$od_id' ";
    $file = sql_fetch($sql);
 
    $it_img1    = $file['it_img1'];
 
 
}
 
$it_img_dir = G5_DATA_PATH.'/item';
 
// 파일삭제
if ($it_img1_del) {
    $file_img1 = $it_img_dir.'/'.$it_img1;
    @unlink($file_img1);
    delete_item_thumbnail(dirname($file_img1), basename($file_img1));
    $it_img1 = '';
}

 
// 이미지업로드
if ($_FILES['it_img1']['name']) {
    if($w == 'u' && $it_img1) {
        $file_img1 = $it_img_dir.'/'.$it_img1;
        @unlink($file_img1);
        delete_item_thumbnail(dirname($file_img1), basename($file_img1));
    }
    $it_img1 = it_img_upload($_FILES['it_img1']['tmp_name'], $_FILES['it_img1']['name'], $it_img_dir.'/'.$it_id);
}

 
if ($w == "" || $w == "u")
{
    // 다음 입력을 위해서 옵션값을 쿠키로 한달동안 저장함
    //@setcookie("ck_ca_id",  $ca_id,  time() + 86400*31, $default[de_cookie_dir], $default[de_cookie_domain]);
    //@setcookie("ck_maker",  stripslashes($it_maker),  time() + 86400*31, $default[de_cookie_dir], $default[de_cookie_domain]);
    //@setcookie("ck_origin", stripslashes($it_origin), time() + 86400*31, $default[de_cookie_dir], $default[de_cookie_domain]);
    @set_cookie("ck_ca_id", $ca_id, time() + 86400*31);
    @set_cookie("ck_ca_id2", $ca_id2, time() + 86400*31);
    @set_cookie("ck_ca_id3", $ca_id3, time() + 86400*31);
    @set_cookie("ck_maker", stripslashes($it_maker), time() + 86400*31);
    @set_cookie("ck_origin", stripslashes($it_origin), time() + 86400*31);
}

 
$it_name = strip_tags(clean_xss_attributes(trim($_POST['it_name'])));
 
// KVE-2019-0708
$check_sanitize_keys = array(
'it_order',             // 출력순서
'it_maker',             // 제조사
'it_origin',            // 원산지
'it_brand',             // 브랜드
'it_model',             // 모델
'it_tel_inq',           // 전화문의
'it_use',               // 판매가능
'it_nocoupon',          // 쿠폰적용안함
'ec_mall_pid',          // 네이버쇼핑 상품ID
'it_sell_email',        // 판매자 e-mail
'it_price',             // 판매가격
'it_cust_price',        // 시중가격
'it_point_type',        // 포인트 유형
'it_point',             // 포인트
'it_supply_point',      // 추가옵션상품 포인트
'it_soldout',           // 상품품절
'it_stock_sms',         // 재입고SMS 알림
'it_stock_qty',         // 재고수량
'it_noti_qty',          // 재고 통보수량
'it_buy_min_qty',       // 최소구매수량
'it_notax',             // 상품과세 유형
'it_sc_type',           // 배송비 유형
'it_sc_method',         // 배송비 결제
'it_sc_price',          // 기본배송비
'it_sc_minimum',        // 배송비 상세조건
);
 
foreach( $check_sanitize_keys as $key ){
    $$key = isset($_POST[$key]) ? strip_tags(clean_xss_attributes($_POST[$key])) : '';
}
 
$it_basic = preg_replace('#<script(.*?)>(.*?)<\/script>#is', '', $it_basic);
 
// $sql_common = "it_img1 = '$it_img1'";

 
if ($w == "")
{
    $od_id = $_POST['od_id'];
 
    //$t_it_id = preg_replace("/[A-Za-z0-9\-_]/", "", $it_id);
    //if($t_it_id)
    //    alert('상품 코드는 영문자, 숫자, -, _ 만 사용할 수 있습니다.');
 
    //$sql_common .= " , it_time = '".G5_TIME_YMDHIS."' ";
    //$sql_common .= " , it_update_time = '".G5_TIME_YMDHIS."' ";
 
    $sql = " insert {$g5['g5_shop_order_table']}
                set it_img1 = '$it_img1'
                where od_id = '$od_id'  ";
    sql_query($sql);
}

 
else if ($w == "u")
{
    //$sql_common .= " , it_update_time = '".G5_TIME_YMDHIS."' ";
    $sql = " update {$g5['g5_shop_order_table']}
                set it_img1 = '$it_img1'
              where od_id = '$od_id' ";
    sql_query($sql);
}
 
run_event('shop_admin_itemformupdate_test', $od_id, $w);

 
$qstr = "$qstr&sca=$sca&page=$page";
 
if ($w == "u") {
    goto_url("./orderform.php?w=u&od_id=$od_id&$qstr");
} else if ($w == "d")  {
    $qstr = "ca_id=$ca_id&sfl=$sfl&sca=$sca&page=$page&stx=".urlencode($stx)."&save_stx=".urlencode($save_stx);
    goto_url("./orderform.php?$qstr");
}
 
echo "<meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\">";
?>
<?php echo get_text($od['it_id']); ?>
<?php echo $od['it_id']; ?>
<?php echo $it_id; ?>
<script>
    if (confirm("계속 입력하시겠습니까?"))
        //location.href = "<?php echo "orderform.php?od_id=$od_id&sort1=$sort1&sort2=$sort2&search=$search&page=$page"?>";
        location.href = "<?php echo "orderform.php?od_id=$od_id&".str_replace('&', '&', $qstr); ?>";
    else
        location.href = "<?php echo "orderform.php?od_id=$od_id&".str_replace('&', '&', $qstr); ?>";
</script>

이 질문에 댓글 쓰기 :

답변 1

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