231 lines
6.9 KiB
PHP
Executable File
231 lines
6.9 KiB
PHP
Executable File
<?php defined('BASEPATH') OR exit('No direct script access allowed');
|
|
header("Content-Type: text/html; charset=UTF-8");
|
|
/**
|
|
* 인클루드 class
|
|
*
|
|
* cm_controller: 부모 Class(CI_Controller 확장한 custome class)
|
|
*/
|
|
include_once(APPPATH.'core/m/cm_controller.php');
|
|
class common extends cm_Controller
|
|
{
|
|
|
|
#---------------------------------------------------------------------------
|
|
# PURPOSE : 리뷰쓰기
|
|
# CREATE : 2018-04-16
|
|
#---------------------------------------------------------------------------
|
|
function fn_kmc_mobile_auth()
|
|
{
|
|
$this->load->view("/m/common/kmc_mobile_auth");
|
|
}
|
|
|
|
function fn_kmc_mobile_callback(){
|
|
|
|
$rec_cert = trim($this->input->get_post('rec_cert', TRUE));
|
|
$certNum = trim($this->input->get_post('certNum', TRUE));
|
|
|
|
|
|
$SES_MEMBER_ID = $this->session->userdata('C_Member_Id');
|
|
|
|
if(strlen($rec_cert) == 0 || strlen($certNum) == 0){
|
|
gf_alert('본인인증에 실패했습니다.', 'self_close');
|
|
exit;
|
|
}
|
|
|
|
$iv = $certNum;
|
|
|
|
//암호화모듈 호출
|
|
if (extension_loaded('ICERTSecu')) {
|
|
//01.인증결과 1차 복호화
|
|
$rec_cert = ICertSeed(2,0,$iv,$rec_cert);
|
|
|
|
|
|
//02.복호화 데이터 Split (rec_cert 1차암호화데이터 / 위변조 검증값 / 암복화확장변수)
|
|
$decStr_Split = explode("/", $rec_cert);
|
|
|
|
$encPara = $decStr_Split[0]; //rec_cert 1차 암호화데이터
|
|
$encMsg = $decStr_Split[1]; //위변조 검증값
|
|
|
|
//03.인증결과 2차 복호화
|
|
$rec_cert = ICertSeed(2,0,$iv,$encPara);
|
|
|
|
//04. 복호화 된 결과자료 "/"로 Split 하기
|
|
$decStr_Split = explode("/", $rec_cert);
|
|
|
|
@$certNum = $decStr_Split[0];
|
|
@$date = $decStr_Split[1];
|
|
@$CI = $decStr_Split[2];
|
|
@$phoneNo = $decStr_Split[3];
|
|
@$phoneCorp = $decStr_Split[4];
|
|
@$birthDay = $decStr_Split[5];
|
|
@$gender = $decStr_Split[6];
|
|
@$nation = $decStr_Split[7];
|
|
@$name = $decStr_Split[8];
|
|
@$result = $decStr_Split[9];
|
|
@$certMet = $decStr_Split[10];
|
|
@$ip = $decStr_Split[11];
|
|
@$M_name = $decStr_Split[12];
|
|
@$M_birthDay = $decStr_Split[13];
|
|
@$M_Gender = $decStr_Split[14];
|
|
@$M_nation = $decStr_Split[15];
|
|
@$plusInfo = $decStr_Split[16];
|
|
@$DI = $decStr_Split[17];
|
|
|
|
|
|
|
|
//05. CI,DI 복호화
|
|
if(strlen($CI) > 0) $CI = ICertSeed(2,0,$iv,$CI);
|
|
if(strlen($DI) > 0) $DI = ICertSeed(2,0,$iv,$DI);
|
|
|
|
|
|
function paramChk($pattern, $param){
|
|
$result = preg_match($pattern, $param);
|
|
return $result;
|
|
}
|
|
|
|
// 요청번호 (최대 40byte까지 유효)
|
|
if(strlen($certNum) > 40 || strlen($certNum) == 0){
|
|
gf_alert('요청번호 비정상', 'self_close');
|
|
exit;
|
|
}
|
|
|
|
// 요청일시 (숫자 14자리만 유효)
|
|
$patn = "/^[0-9]*$/";
|
|
if(strlen($date) != 14 || paramchk($patn, $date) == 0){
|
|
gf_alert('휴대폰번호 비정상', 'self_close');
|
|
exit;
|
|
}
|
|
|
|
// 휴대폰번호 (값이 있는 경우에는 숫자 10 또는 11자리까지만 유효)
|
|
$patn = "/^[0-9]*$/";
|
|
if((strlen($phoneNo) != 10 && strlen($phoneNo) != 11) || paramChk($patn, $phoneNo) == 0){
|
|
gf_alert('휴대폰번호 비정상', 'self_close');
|
|
exit;
|
|
}
|
|
|
|
}else{
|
|
gf_alert('본인인증에 실패했습니다.', 'self_close');
|
|
exit;
|
|
}
|
|
|
|
$this->load->model('web/m_member');
|
|
if($plusInfo=='member_join1') {
|
|
$result = $this->m_member->member_where_mobile_CI_select($CI);
|
|
if(count($result) > 0) {
|
|
gf_alert('이미 가입되어있는 번호입니다.', 'self_close');
|
|
exit;
|
|
|
|
}
|
|
} else if($plusInfo=='member_join2') { // 14세 미만
|
|
$result = $this->m_member->member_where_parent_CI_select($CI);
|
|
if(count($result) > 0) {
|
|
gf_alert('이미 가입되어있는 부모님 번호입니다.', 'self_close');
|
|
exit;
|
|
|
|
}
|
|
|
|
|
|
} else if($plusInfo=='email_check') {
|
|
|
|
$req_data = array();
|
|
$req_data['member_id'] = $SES_MEMBER_ID;
|
|
$req_data['CI'] = $CI;
|
|
$count = $this->m_member->member_where_mobile_CI_member_id_count($req_data);
|
|
if($count == 0){
|
|
gf_alert('본인명의의 휴대폰 번호가 아닙니다.', 'self_close');
|
|
exit;
|
|
}
|
|
} else if($plusInfo=='member_edit') {
|
|
$req_data = array();
|
|
$req_data['member_id'] = $SES_MEMBER_ID;
|
|
$req_data['CI'] = $CI;
|
|
$count = $this->m_member->member_where_mobile_CI_member_id_count($req_data);
|
|
if($count == 0){
|
|
gf_alert('본인명의의 휴대폰 번호로만 변경가능합니다.', 'self_close');
|
|
exit;
|
|
}
|
|
}
|
|
|
|
$name = iconv("EUC-KR","UTF-8", $name);
|
|
|
|
$return_data = array();
|
|
$return_data['CI'] = $CI;
|
|
$return_data['type'] = $plusInfo;
|
|
$return_data['name'] = $name;
|
|
$return_data['phone'] = $phoneNo;
|
|
|
|
|
|
# view
|
|
return $this->load->view('/m/common/kmc_mobile_auth_fin', $return_data,true);
|
|
|
|
|
|
|
|
}
|
|
|
|
function fn_ajax_kmc_encode_proc() {
|
|
# request
|
|
$mobile = trim($this->input->get_post('mobile', TRUE));
|
|
$type = trim($this->input->get_post('type', TRUE));
|
|
|
|
$mobile = str_replace('-', '', $mobile);
|
|
$cur_time = date('YmdHis');
|
|
$rand_no = rand(100000, 999999);
|
|
|
|
//요청 번호 생성
|
|
$cert_num = $cur_time.$rand_no;
|
|
|
|
|
|
$cpId = 'CRMM1001'; // 회원사ID
|
|
$urlCode = '003003'; // URL 코드
|
|
$certNum = $cert_num; // 요청번호
|
|
$date = $cur_time; // 요청일시
|
|
$certMet = 'M'; // 본인인증방법
|
|
$birthDay = ''; // 생년월일
|
|
$gender = ''; // 성별
|
|
$name = ''; // 성명
|
|
$phoneNo = $mobile; // 휴대폰번호
|
|
$phoneCorp = ''; // 이동통신사
|
|
$nation = ''; // 내외국인 구분
|
|
$plusInfo = $type; // 추가DATA정보
|
|
$extendVar = "0000000000000000"; // 확장변수
|
|
|
|
$name = str_replace(" ", "+", $name) ; //성명에 space가 들어가는 경우 "+"로 치환하여 암호화 처리
|
|
|
|
// 02. tr_cert 데이터변수 조합 (서버로 전송할 데이터 "/"로 조합)
|
|
$tr_cert = $cpId . "/" . $urlCode . "/" . $certNum . "/" . $date . "/" . $certMet . "/" . $birthDay . "/" . $gender . "/" . $name . "/" . $phoneNo . "/" . $phoneCorp . "/" . $nation . "/" . $plusInfo . "/" . $extendVar;
|
|
|
|
|
|
//암호화모듈 호출
|
|
$enc_tr_cert = '';
|
|
if (extension_loaded('ICERTSecu')) {
|
|
//03. 1차암호화
|
|
$enc_tr_cert = ICertSeed(1,0,'',$tr_cert);
|
|
|
|
//04. 변조검증값 생성
|
|
$enc_tr_cert_hash = ICertHMac($enc_tr_cert);
|
|
|
|
//05. 2차암호화
|
|
$enc_tr_cert = $enc_tr_cert . "/" . $enc_tr_cert_hash . "/" . "0000000000000000";
|
|
|
|
$enc_tr_cert = ICertSeed(1,0,'',$enc_tr_cert);
|
|
|
|
}
|
|
|
|
if($enc_tr_cert == '') {
|
|
$return_data['result'] = array('code' => '9999');
|
|
} else {
|
|
$return_data['result'] = array('code' => '0000', 'data' => $enc_tr_cert);
|
|
|
|
}
|
|
|
|
# view
|
|
return $this->load->view('/web/comm/result_json', $return_data);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|