그누보드5 정식버전

This commit is contained in:
chicpro
2014-06-09 14:48:44 +09:00
parent 0243dabe20
commit 7983affa68
1174 changed files with 136960 additions and 0 deletions

View File

@ -0,0 +1,3 @@
<?php
include_once('../../common.php');
?>

BIN
plugin/kcpcert/bin/ct_cli Normal file

Binary file not shown.

View File

@ -0,0 +1,54 @@
<?php
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
// 금일 인증시도 회수 체크
certify_count_check($member['mb_id'], 'hp');
// 서버상 bin 폴더 이전까지 경로
$home_dir = G5_KCPCERT_PATH; // ct_cli 절대경로 ( bin 전까지 )
// DI 를 위한 중복확인 식별 아이디
//web_siteid 값이 없으면 KCP 에서 지정한 값으로 설정됨
$web_siteid = '';
if ($config['cf_cert_use'] == 2) { // 실서비스
$site_cd = 'SM'.$config['cf_cert_kcp_cd'];
$cert_url = 'https://cert.kcp.co.kr/kcp_cert/cert_view.jsp';
} else if ($config['cf_cert_use'] == 1) { // 테스트사용
$site_cd = 'S6186';
$cert_url = 'https://testcert.kcp.co.kr/kcp_cert/cert_view.jsp';
} else { // 사용안함
$site_cd = '';
$cert_url = '';
}
if(!$site_cd)
alert('KCP 휴대폰 본인확인 서비스 사이트코드가 없습니다.\\관리자 > 기본환경설정에 KCP 사이트코드를 입력해 주십시오.', G5_URL);
// KCP 인증 라이브러리
require G5_KCPCERT_PATH.'/lib/ct_cli_lib.php';
/* ============================================================================== */
/* = null 값을 처리하는 메소드 = */
/* = -------------------------------------------------------------------------- = */
function f_get_parm_str( $val )
{
if ( $val == null ) $val = "";
if ( $val == "" ) $val = "";
return $val;
}
//!!중요 해당 함수는 year, month, day 변수가 null 일 경우 00 으로 치환합니다
function f_get_parm_int( $val )
{
$ret_val = "";
if ( $val == null ) $val = "00";
if ( $val == "" ) $val = "00";
$ret_val = strlen($val) == 1? ("0" . $val) : $val;
return $ret_val;
}
/* ============================================================================== */
?>

View File

@ -0,0 +1,55 @@
<?php
include_once('./_common.php');
// 금일 인증시도 회수 체크
certify_count_check($member['mb_id'], 'hp');
// kcp 휴대폰인증파일
include_once(G5_KCPCERT_PATH.'/kcpcert_config.php');
$ordr_idxx = get_session('ss_uniqid');
if(!$ordr_idxx)
$ordr_idxx = get_uniqid();
?>
<form name="form_auth" method="post" target="auth_popup" action="<?php echo $cert_url ?>">
<!-- 유저네임 -->
<input type="hidden" name="user_name" value="" />
<!-- 주문번호 -->
<input type="hidden" name="ordr_idxx" value="<?php echo $ordr_idxx ?>">
<!-- 요청종류 -->
<input type="hidden" name="req_tx" value="cert"/>
<!-- 인증종류 -->
<input type="hidden" name="cert_type" value="01"/>
<!-- 웹사이트아이디 -->
<input type="hidden" name="web_siteid" value=""/>
<!-- 노출 통신사 default 처리시 아래의 주석을 해제하고 사용하십시요
SKT : SKT , KT : KTF , LGU+ : LGT
<input type="hidden" name="fix_commid" value="KTF"/>
-->
<!-- 사이트코드 -->
<input type="hidden" name="site_cd" value="<?php echo $site_cd; ?>" />
<!-- Ret_URL : 인증결과 리턴 페이지 ( 가맹점 URL 로 설정해 주셔야 합니다. ) -->
<input type="hidden" name="Ret_URL" value="<?php echo G5_KCPCERT_URL; ?>/kcpcert_result.php" />
<!-- cert_otp_use 필수 ( 메뉴얼 참고)
Y : 실명 확인 + OTP 점유 확인 , N : 실명 확인 only
-->
<input type="hidden" name="cert_otp_use" value="Y"/>
<!-- cert_enc_use 필수 (고정값 : 메뉴얼 참고) -->
<input type="hidden" name="cert_enc_use" value="Y"/>
<input type="hidden" name="res_cd" value=""/>
<input type="hidden" name="res_msg" value=""/>
<!-- up_hash 검증 을 위한 필드 -->
<input type="hidden" name="veri_up_hash" value=""/>
<!-- 가맹점 사용 필드 (인증완료시 리턴)-->
<input type="hidden" name="param_opt_1" value="opt1"/>
<input type="hidden" name="param_opt_2" value="opt2"/>
<input type="hidden" name="param_opt_3" value="opt3"/>
</form>
<script>
document.form_auth.submit();
</script>

View File

@ -0,0 +1,196 @@
<?php
include_once('./_common.php');
include_once(G5_KCPCERT_PATH.'/kcpcert_config.php');
$site_cd = "";
$ordr_idxx = "";
$cert_no = "";
$cert_enc_use = "";
$enc_info = "";
$enc_data = "";
$req_tx = "";
$enc_cert_data = "";
$cert_info = "";
$tran_cd = "";
$res_cd = "";
$res_msg = "";
$dn_hash = "";
/*------------------------------------------------------------------------*/
/* :: 전체 파라미터 남기기 */
/*------------------------------------------------------------------------*/
// request 로 넘어온 값 처리
$key = array_keys($_POST);
$sbParam ="";
for($i=0; $i<count($key); $i++)
{
$nmParam = $key[$i];
$valParam = $_POST[$nmParam];
if ( $nmParam == "site_cd" )
{
$site_cd = f_get_parm_str ( $valParam );
}
if ( $nmParam == "ordr_idxx" )
{
$ordr_idxx = f_get_parm_str ( $valParam );
}
if ( $nmParam == "res_cd" )
{
$res_cd = f_get_parm_str ( $valParam );
}
if ( $nmParam == "cert_enc_use" )
{
$cert_enc_use = f_get_parm_str ( $valParam );
}
if ( $nmParam == "req_tx" )
{
$req_tx = f_get_parm_str ( $valParam );
}
if ( $nmParam == "cert_no" )
{
$cert_no = f_get_parm_str ( $valParam );
}
if ( $nmParam == "enc_cert_data" )
{
$enc_cert_data = f_get_parm_str ( $valParam );
}
if ( $nmParam == "dn_hash" )
{
$dn_hash = f_get_parm_str ( $valParam );
}
// 부모창으로 넘기는 form 데이터 생성 필드
$sbParam .= "<input type='hidden' name='" . $nmParam . "' value='" . f_get_parm_str( $valParam ) . "'/>";
}
$ct_cert = new C_CT_CLI;
$ct_cert->mf_clear();
$g5['title'] = '휴대폰인증 결과';
include_once(G5_PATH.'/head.sub.php');
// 결과 처리
if( $cert_enc_use == "Y" )
{
// 인증내역기록
@insert_cert_history($member['mb_id'], 'kcp', 'hp');
if( $res_cd == "0000" )
{
// dn_hash 검증
// KCP 가 리턴해 드리는 dn_hash 와 사이트 코드, 주문번호 , 인증번호를 검증하여
// 해당 데이터의 위변조를 방지합니다
$veri_str = $site_cd.$ordr_idxx.$cert_no; // 사이트 코드 + 주문번호 + 인증거래번호
if ( $ct_cert->check_valid_hash ( $home_dir , $dn_hash , $veri_str ) != "1" )
{
// 검증 실패시 처리 영역
echo "dn_hash 변조 위험있음 (".G5_KCPCERT_PATH."/bin/ct_cli 파일에 실행권한이 있는지 확인하세요.)";
exit;
// 오류 처리 ( dn_hash 변조 위험있음)
}
// 가맹점 DB 처리 페이지 영역
// 인증데이터 복호화 함수
// 해당 함수는 암호화된 enc_cert_data 를
// site_cd 와 cert_no 를 가지고 복화화 하는 함수 입니다.
// 정상적으로 복호화 된경우에만 인증데이터를 가져올수 있습니다.
$opt = "1" ; // 복호화 인코딩 옵션 ( UTF - 8 사용시 "1" )
$ct_cert->decrypt_enc_cert( $home_dir , $site_cd , $cert_no , $enc_cert_data , $opt );
$comm_id = $ct_cert->mf_get_key_value("comm_id" ); // 이동통신사 코드
$phone_no = $ct_cert->mf_get_key_value("phone_no" ); // 전화번호
$user_name = $ct_cert->mf_get_key_value("user_name" ); // 이름
$birth_day = $ct_cert->mf_get_key_value("birth_day" ); // 생년월일
$sex_code = $ct_cert->mf_get_key_value("sex_code" ); // 성별코드
$local_code = $ct_cert->mf_get_key_value("local_code" ); // 내/외국인 정보
$ci = $ct_cert->mf_get_key_value("ci" ); // CI
$di = $ct_cert->mf_get_key_value("di" ); // DI 중복가입 확인값
$ci_url = urldecode( $ct_cert->mf_get_key_value("ci" ) ); // CI
$di_url = urldecode( $ct_cert->mf_get_key_value("di" ) ); // DI 중복가입 확인값
$dec_res_cd = $ct_cert->mf_get_key_value("res_cd" ); // 암호화된 결과코드
$dec_mes_msg = $ct_cert->mf_get_key_value("res_msg" ); // 암호화된 결과메시지
// 정상인증인지 체크
if(!$phone_no)
alert_close("정상적인 인증이 아닙니다. 올바른 방법으로 이용해 주세요.");
$phone_no = hyphen_hp_number($phone_no);
$mb_dupinfo = $di;
$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 데이터
$cert_type = 'hp';
$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 if( $res_cd != "0000" )
{
// 인증실패
alert_close('코드 : '.$_POST['res_cd'].' '.urldecode($_POST['res_msg']));
exit;
}
}
else if( $cert_enc_use != "Y" )
{
// 암호화 인증 안함
alert_close("휴대폰 본인확인을 취소 하셨습니다.");
exit;
}
$ct_cert->mf_clear();
?>
<script>
$(function() {
var $opener = window.opener;
// 인증정보
$opener.$("input[name=cert_type]").val("<?php echo $cert_type; ?>");
$opener.$("input[name=mb_name]").val("<?php echo $user_name; ?>").attr("readonly", true);
$opener.$("input[name=mb_hp]").val("<?php echo $phone_no; ?>").attr("readonly", true);
$opener.$("input[name=cert_no]").val("<?php echo $md5_cert_no; ?>");
alert("본인의 휴대폰번호로 확인 되었습니다.");
window.close();
});
</script>
<?php
include_once(G5_PATH.'/tail.sub.php');
?>

View File

@ -0,0 +1,89 @@
<?php
/* ====================================================================== */
/* = PAGE : 인증 PHP 라이브러리 1.0.1 = */
/* = ------------------------------------------------------------------ = */
/* = Copyright (c) 2012 KCP Inc. All Rights Reserverd. = */
/* ====================================================================== */
/* ====================================================================== */
/* = 인증 연동 CLASS = */
/* ====================================================================== */
class C_CT_CLI
{
// 변수 선언 부분
var $m_dec_data;
// 변수 초기화 영역
function mf_clear()
{
$this->m_dec_data="";
}
// hash 처리 영역
function make_hash_data( $home_dir , $str )
{
$hash_data = $this -> mf_exec( $home_dir . "/bin/ct_cli" ,
"lf_CT_CLI__make_hash_data",
$str
);
if ( $hash_data == "" ) { $hash_data = "HS01"; }
return $hash_data;
}
// dn_hash 체크 함수
function check_valid_hash ($home_dir , $hash_data , $str )
{
$ret_val = $this -> mf_exec( $home_dir . "/bin/ct_cli" ,
"lf_CT_CLI__check_valid_hash" ,
$hash_data ,
$str
);
if ( $ret_val == "" ) { $ret_val = "HS02"; }
return $ret_val;
}
// 암호화 인증데이터 복호화
function decrypt_enc_cert ( $home_dir, $site_cd , $cert_no , $enc_cert_data , $opt)
{
$dec_data = $this -> mf_exec( $home_dir . "/bin/ct_cli" ,
"lf_CT_CLI__decrypt_enc_cert" ,
$site_cd ,
$cert_no ,
$enc_cert_data ,
$opt
);
if ( $dec_data == "" ) { $dec_data = "HS03"; }
parse_str( str_replace( chr( 31 ), "&", $dec_data ), $this->m_dec_data );
}
// 인증데이터 get data
function mf_get_key_value( $name )
{
return $this->m_dec_data[ $name ];
}
function mf_exec()
{
$arg = func_get_args();
if ( is_array( $arg[0] ) ) $arg = $arg[0];
$exec_cmd = array_shift( $arg );
while ( list(,$i) = each($arg) )
{
$exec_cmd .= " " . escapeshellarg( $i );
}
$rt = exec( $exec_cmd );
return $rt;
}
}
?>