diff --git a/lib/shop.lib.php b/lib/shop.lib.php index 9d9d1baaf..f63adb941 100644 --- a/lib/shop.lib.php +++ b/lib/shop.lib.php @@ -1916,6 +1916,78 @@ function check_itemuse_write($close=true) } +// 구매 본인인증 체크 +function shop_member_cert_check($id, $type='list') +{ + global $g5, $member; + + $msg = ''; + + switch($type) + { + case 'item': + $sql = " select ca_id, ca_id2, ca_id3 from {$g5['g5_shop_item_table']} where it_id = '$id' "; + $it = sql_fetch($sql); + + $seq = ''; + for($i=0; $i<3; $i++) { + $ca_id = $it['ca_id'.$seq]; + $sql = " select ca_cert_use, ca_adult_use from {$g5['g5_shop_category_table']} where ca_id = '$ca_id' "; + $row = sql_fetch($sql); + + // 본인확인체크 + if($row['ca_cert_use'] && !$member['mb_certify']) { + if($member['mb_id']) + $msg = '회원정보 수정에서 본인확인 후 이용해 주십시오.'; + else + $msg = '본인확인된 로그인 회원만 이용할 수 있습니다.'; + + break; + } + + // 성인인증체크 + if($row['ca_adult_use'] && !$member['mb_adult']) { + if($member['mb_id']) + $msg = '본인확인으로 성인인증된 회원만 이용할 수 있습니다.\\n회원정보 수정에서 본인확인을 해주십시오.'; + else + $msg = '본인확인으로 성인인증된 회원만 이용할 수 있습니다.'; + + break; + } + + if($i == 0) + $seq = 1; + $seq++; + } + + break; + default: + $sql = " select * from {$g5['g5_shop_category_table']} where ca_id = '$id' "; + $ca = sql_fetch($sql); + + // 본인확인체크 + if($ca['ca_cert_use'] && !$member['mb_certify']) { + if($member['mb_id']) + $msg = '회원정보 수정에서 본인확인 후 이용해 주십시오.'; + else + $msg = '본인확인된 로그인 회원만 이용할 수 있습니다.'; + } + + // 성인인증체크 + if($ca['ca_adult_use'] && !$member['mb_adult']) { + if($member['mb_id']) + $msg = '본인확인으로 성인인증된 회원만 이용할 수 있습니다.\\n회원정보 수정에서 본인확인을 해주십시오.'; + else + $msg = '본인확인으로 성인인증된 회원만 이용할 수 있습니다.'; + } + + break; + } + + return $msg; +} + + // 사용후기의 확인된 건수를 상품테이블에 저장합니다. function update_use_cnt($it_id) { diff --git a/mobile/shop/item.php b/mobile/shop/item.php index 4984b64b8..c9b074fba 100644 --- a/mobile/shop/item.php +++ b/mobile/shop/item.php @@ -26,22 +26,11 @@ $sql = " select ca_include_head, ca_include_tail, ca_cert_use, ca_adult_use where ca_id = '{$it['ca_id']}' "; $ca = sql_fetch($sql); +// 본인인증, 성인인증체크 if(!$is_admin) { - // 본인확인체크 - if($ca['ca_cert_use'] && !$member['mb_certify']) { - if($is_member) - alert('회원정보 수정에서 본인확인 후 이용해 주십시오.'); - else - alert('본인확인된 로그인 회원만 이용할 수 있습니다.'); - } - - // 성인인증체크 - if($ca['ca_adult_use'] && !$member['mb_adult']) { - if($is_member) - alert('본인확인으로 성인인증된 회원만 이용할 수 있습니다.\\n회원정보 수정에서 본인확인을 해주십시오.'); - else - alert('본인확인으로 성인인증된 회원만 이용할 수 있습니다.'); - } + $msg = shop_member_cert_check($it_id, 'item'); + if($msg) + alert($msg); } // 오늘 본 상품 저장 시작 diff --git a/mobile/shop/list.php b/mobile/shop/list.php index 3b667f146..238254103 100644 --- a/mobile/shop/list.php +++ b/mobile/shop/list.php @@ -9,22 +9,11 @@ $ca = sql_fetch($sql); if (!$ca['ca_id']) alert('등록된 분류가 없습니다.'); +// 본인인증, 성인인증체크 if(!$is_admin) { - // 본인확인체크 - if($ca['ca_cert_use'] && !$member['mb_certify']) { - if($is_member) - alert('회원정보 수정에서 본인확인 후 이용해 주십시오.'); - else - alert('본인확인된 로그인 회원만 이용할 수 있습니다.'); - } - - // 성인인증체크 - if($ca['ca_adult_use'] && !$member['mb_adult']) { - if($is_member) - alert('본인확인으로 성인인증된 회원만 이용할 수 있습니다.\\n회원정보 수정에서 본인확인을 해주십시오.'); - else - alert('본인확인으로 성인인증된 회원만 이용할 수 있습니다.'); - } + $msg = shop_member_cert_check($ca_id); + if($msg) + alert($msg); } $g5['title'] = $ca['ca_name'].' 상품리스트'; diff --git a/shop/item.php b/shop/item.php index 68004c7ea..cfad0f1d7 100644 --- a/shop/item.php +++ b/shop/item.php @@ -24,22 +24,11 @@ if (!($it['ca_use'] && $it['it_use'])) { $sql = " select ca_include_head, ca_include_tail, ca_cert_use, ca_adult_use from {$g5['g5_shop_category_table']} where ca_id = '{$it['ca_id']}' "; $ca = sql_fetch($sql); +// 본인인증, 성인인증체크 if(!$is_admin) { - // 본인확인체크 - if($ca['ca_cert_use'] && !$member['mb_certify']) { - if($is_member) - alert('회원정보 수정에서 본인확인 후 이용해 주십시오.'); - else - alert('본인확인된 로그인 회원만 이용할 수 있습니다.'); - } - - // 성인인증체크 - if($ca['ca_adult_use'] && !$member['mb_adult']) { - if($is_member) - alert('본인확인으로 성인인증된 회원만 이용할 수 있습니다.\\n회원정보 수정에서 본인확인을 해주십시오.'); - else - alert('본인확인으로 성인인증된 회원만 이용할 수 있습니다.'); - } + $msg = shop_member_cert_check($it_id, 'item'); + if($msg) + alert($msg); } // 오늘 본 상품 저장 시작 diff --git a/shop/itembuy.php b/shop/itembuy.php index b15a05998..bb79ac24e 100644 --- a/shop/itembuy.php +++ b/shop/itembuy.php @@ -11,6 +11,13 @@ $it = sql_fetch($sql); if(!$it['it_id']) alert('상품정보가 존재하지 않습니다.', G5_SHOP_URL); +// 본인인증, 성인인증체크 +if(!$is_admin) { + $msg = shop_member_cert_check($it_id, 'item'); + if($msg) + alert($msg, G5_SHOP_URL); +} + if(is_soldout($it['it_id'])) alert('상품의 재고가 부족하여 구매할 수 없습니다.', G5_SHOP_URL); diff --git a/shop/list.php b/shop/list.php index c6583d259..6f539f5a6 100644 --- a/shop/list.php +++ b/shop/list.php @@ -11,22 +11,11 @@ $ca = sql_fetch($sql); if (!$ca['ca_id']) alert('등록된 분류가 없습니다.'); +// 본인인증, 성인인증체크 if(!$is_admin) { - // 본인확인체크 - if($ca['ca_cert_use'] && !$member['mb_certify']) { - if($is_member) - alert('회원정보 수정에서 본인확인 후 이용해 주십시오.'); - else - alert('본인확인된 로그인 회원만 이용할 수 있습니다.'); - } - - // 성인인증체크 - if($ca['ca_adult_use'] && !$member['mb_adult']) { - if($is_member) - alert('본인확인으로 성인인증된 회원만 이용할 수 있습니다.\\n회원정보 수정에서 본인확인을 해주십시오.'); - else - alert('본인확인으로 성인인증된 회원만 이용할 수 있습니다.'); - } + $msg = shop_member_cert_check($ca_id); + if($msg) + alert($msg); } $g5['title'] = $ca['ca_name'].' 상품리스트';