diff --git a/plugin/kgcert/kg_find_request.php b/plugin/kgcert/kg_find_request.php new file mode 100644 index 000000000..cfc37a061 --- /dev/null +++ b/plugin/kgcert/kg_find_request.php @@ -0,0 +1,65 @@ + +
+ + + + + + + + + + + + + + + + +
+ + $mid, + 'txId' => $txId + ); + + $post_data = json_encode($data); + + // curl 통신 시작 + $ch = curl_init(); + curl_setopt($ch, CURLOPT_URL, $_POST["authRequestUrl"]); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); + curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10); + curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data); + curl_setopt($ch, CURLOPT_POST, 1); + curl_setopt($ch, CURLOPT_HTTPHEADER, array('Accept: application/json', 'Content-Type: application/json')); + curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); + + $response = curl_exec($ch); + curl_close($ch); + $res_data = json_decode($response, true); + + if($res_data['resultCode'] == "0000") { + + @insert_cert_history('@password_lost@', 'kg', 'sa'); // 인증성공 시 내역 기록 + + $cert_type = 'sa'; // 인증타입 + $cert_no = $res_data['txId']; // 이니시스 트랜잭션 ID + $phone_no = $res_data['userPhone']; // 전화번호 + $user_name = $res_data['userName']; // 이름 + $birth_day = $res_data['userBirthday']; // 생년월일 + $ci = $res_data['userCi']; // CI + + if(!$phone_no) + alert_close("정상적인 인증이 아닙니다. 올바른 방법으로 이용해 주세요."); + + $md5_ci = md5($ci . $ci); + $phone_no = hyphen_hp_number($phone_no); + $mb_dupinfo = $md5_ci; + + $row = sql_fetch("select * from {$g5['member_table']} where mb_id <> '{$member['mb_id']}' and mb_dupinfo = '{$mb_dupinfo}'"); + if (!$row['mb_id']) { + $row = sql_fetch("select * from {$g5['member_table']} where mb_id <> '{$member['mb_id']}' and mb_name ='{$user_name}' and mb_birth='{$birth_day}' and mb_hp='{$phone_no}'"); + if(!$row['mb_id']){ + alert_close("인증하신 정보로 가입된 회원정보가 없습니다."); + exit; + } + } + }else{ + // 인증실패 curl의 인증실패 체크 + alert_close('코드 : '.$res_data['resultCode'].' '.urldecode($res_data['resultMsg'])); + exit; + } + } else { // resultCode===0000 아닐경우 아래 인증 실패를 출력함 + // 인증실패 + alert_close('코드 : '.$_POST['resultCode'].' '.urldecode($_POST['resultMsg'])); + exit; + } + + $g5['title'] = 'KG이니시스 통합인증 결과'; + include_once(G5_PATH.'/head.sub.php'); +?> +
+ "> +
+ + - - -
@@ -63,9 +52,14 @@ - +
+ '; - -print_r2($_COOKIE); -// STEP2 에 이어 인증결과가 성공일(resultCode=0000) 경우 STEP2 에서 받은 인증결과로 아래 승인요청 진행 -$txId = $_POST['txId']; -$mid = substr($txId, 6, 10); -print_r2($_SERVER); -print_r2($_SESSION); -print_r2($_POST); -die; -// echo '<인증결과내역>'."

"; -// echo 'resultCode : '.$_REQUEST["resultCode"]."
"; -// echo 'resultMsg : '.$_REQUEST["resultMsg"]."
"; -// echo 'authRequestUrl : '.$_REQUEST["authRequestUrl"]."
"; -// echo 'txId : '.$_REQUEST["txId"]."
"; - -// 인증실패 -alert_close('코드 : '.$_POST['res_cd'].' '.urldecode($_POST['res_msg'])); -exit; - -include_once(G5_PATH.'/tail.sub.php'); \ No newline at end of file diff --git a/plugin/kgcert/kg_result.php b/plugin/kgcert/kg_result.php index 8b83e836d..8e9e7337d 100644 --- a/plugin/kgcert/kg_result.php +++ b/plugin/kgcert/kg_result.php @@ -1,116 +1,109 @@ '; -$txId = $_POST['txId']; -$mid = substr($txId, 6, 10); -if ($_POST["resultCode"] === "0000") { + $txId = $_POST['txId']; + $mid = substr($txId, 6, 10); - $data = array( - 'mid' => $mid, - 'txId' => $txId - ); + if ($_POST["resultCode"] === "0000") { - $post_data = json_encode($data); + $data = array( + 'mid' => $mid, + 'txId' => $txId + ); - // curl 통신 시작 - $ch = curl_init(); - curl_setopt($ch, CURLOPT_URL, $_POST["authRequestUrl"]); - curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); - curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10); - curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data); - curl_setopt($ch, CURLOPT_POST, 1); - curl_setopt($ch, CURLOPT_HTTPHEADER, array('Accept: application/json', 'Content-Type: application/json')); - curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); - - $response = curl_exec($ch); - curl_close($ch); - $res_data = json_decode($response, true); - // -------------------- 결과 수신 ------------------------------------------- - echo '<결과내역>'." '{$mid}'

"; - echo $response; - print_r2($_SESSION); - // print_r2($response); - if($res_data['resultCode'] == "0000") { + $post_data = json_encode($data); - @insert_cert_history($member['mb_id'], 'kg', 'sa'); // 인증성공 시 내역 기록 - - $cert_no = $res_data['txId']; // LG 인증처리번호 - $phone_no = $res_data['userPhone']; // 전화번호 - $user_name = $res_data['userName']; // 이름 - $birth_day = $res_data['userBirthday']; // 생년월일 - $ci = $res_data['userCi']; // CI + // curl 통신 시작 + $ch = curl_init(); + curl_setopt($ch, CURLOPT_URL, $_POST["authRequestUrl"]); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); + curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10); + curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data); + curl_setopt($ch, CURLOPT_POST, 1); + curl_setopt($ch, CURLOPT_HTTPHEADER, array('Accept: application/json', 'Content-Type: application/json')); + curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); - if(!$phone_no) - alert_close("정상적인 인증이 아닙니다. 올바른 방법으로 이용해 주세요."); + $response = curl_exec($ch); + curl_close($ch); + $res_data = json_decode($response, true); + // -------------------- 결과 수신 ------------------------------------------- + // echo '<결과내역>'." '{$mid}'

"; + // echo $response; - $ci_hash = md5($ci . $ci); - $phone_no = hyphen_hp_number($phone_no); - $mb_dupinfo = $ci_hash; + if($res_data['resultCode'] == "0000") { - $sql = " select mb_id from {$g5['member_table']} where mb_id <> '{$member['mb_id']}' and mb_dupinfo = '{$mb_dupinfo}' "; - $row = sql_fetch($sql); - if ($row['mb_id']) { - alert_close("입력하신 본인확인 정보로 가입된 내역이 존재합니다.\\n회원아이디 : ".$row['mb_id']); + @insert_cert_history($member['mb_id'], 'kg', 'sa'); // 인증성공 시 내역 기록 + + $cert_type = 'sa'; // 인증타입 + $cert_no = $res_data['txId']; // 이니시스 트랜잭션 ID + $phone_no = $res_data['userPhone']; // 전화번호 + $user_name = $res_data['userName']; // 이름 + $birth_day = $res_data['userBirthday']; // 생년월일 + $ci = $res_data['userCi']; // CI + + if(!$phone_no) + alert_close("정상적인 인증이 아닙니다. 올바른 방법으로 이용해 주세요."); + + $md5_ci = md5($ci . $ci); + $phone_no = hyphen_hp_number($phone_no); + $mb_dupinfo = $md5_ci; + + $sql = " select mb_id from {$g5['member_table']} where mb_id <> '{$member['mb_id']}' and mb_dupinfo = '{$mb_dupinfo}' "; + $row = sql_fetch($sql); + if ($row['mb_id']) { + alert_close("입력하신 본인확인 정보로 가입된 내역이 존재합니다.\\n회원아이디 : ".$row['mb_id']); + } + + // hash 데이터 + + $md5_cert_no = md5($cert_no); + $hash_data = md5($user_name.$cert_type.$birth_day.$md5_cert_no); + + // 성인인증결과 + $adult_day = date("Ymd", strtotime("-19 years", G5_SERVER_TIME)); + $adult = ((int)$birth_day <= (int)$adult_day) ? 1 : 0; + + set_session("ss_cert_type", $cert_type); + set_session("ss_cert_no", $md5_cert_no); + set_session("ss_cert_hash", $hash_data); + set_session("ss_cert_adult", $adult); + set_session("ss_cert_birth", $birth_day); + //set_session("ss_cert_sex", ($sex_code=="01"?"M":"F")); // 이니시스 통합인증은 성별정보 리턴 없음 + set_session('ss_cert_dupinfo', $mb_dupinfo); + + }else{ + // 인증실패 curl의 인증실패 체크 + alert_close('코드 : '.$res_data['resultCode'].' '.urldecode($res_data['resultMsg'])); + exit; } - - // hash 데이터 - $cert_type = 'sa'; - $md5_cert_no = md5($cert_no); - $hash_data = md5($user_name.$cert_type.$birth_day.$md5_cert_no); - - // 성인인증결과 - $adult_day = date("Ymd", strtotime("-19 years", G5_SERVER_TIME)); - $adult = ((int)$birth_day <= (int)$adult_day) ? 1 : 0; - - set_session("ss_cert_type", $cert_type); - set_session("ss_cert_no", $md5_cert_no); - set_session("ss_cert_hash", $hash_data); - set_session("ss_cert_adult", $adult); - set_session("ss_cert_birth", $birth_day); - - //set_session("ss_cert_sex", ($sex_code=="01"?"M":"F")); - set_session('ss_cert_dupinfo', $mb_dupinfo); - }else{ + } else { // resultCode===0000 아닐경우 아래 인증 실패를 출력함 // 인증실패 - alert_close('코드 : '.$res_data['resultCode'].' '.urldecode($res_data['resultMsg'])); + alert_close('코드 : '.$_POST['resultCode'].' '.urldecode($_POST['resultMsg'])); exit; } -} else { // resultCode===0000 아닐경우 아래 인증 실패를 출력함 - // 인증실패 - alert_close('코드 : '.$_POST['resultCode'].' '.urldecode($_POST['resultMsg'])); - exit; -} -$g5['title'] = '통합인증 결과'; -include_once(G5_PATH.'/head.sub.php'); -?> + $g5['title'] = 'KG이니시스 통합인증 결과'; + include_once(G5_PATH.'/head.sub.php'); +?>