통합인증 : 코드정리

This commit is contained in:
projectSylas
2021-10-06 08:10:45 +00:00
parent c7f19057e5
commit cbd9fc4a86
5 changed files with 200 additions and 201 deletions

View File

@ -795,7 +795,7 @@ if(!empty($extend_file) && is_array($extend_file)) {
}
unset($extend_file);
if(!$is_admin && $is_member && (!defined("G5_CERT_IN_PROG") || !G5_CERT_IN_PROG) && $config['cf_cert_use'] <> 0 && $config['cf_cert_req']) { // 본인인증이 필수일때
if($is_member && !$is_admin && (!defined("G5_CERT_IN_PROG") || !G5_CERT_IN_PROG) && $config['cf_cert_use'] <> 0 && $config['cf_cert_req']) { // 본인인증이 필수일때
if ((empty($member['mb_certify']) || (!empty($member['mb_certify']) && strlen($member['mb_dupinfo']) == 64))) { // di로 인증되어 있거나 본인인증이 안된 계정일때
goto_url(G5_BBS_URL."/member_cert_refresh.php");
}

View File

@ -135,7 +135,6 @@ define('G5_PHPMAILER_PATH', G5_PLUGIN_PATH.'/'.G5_PHPMAILER_DIR);
//------------------------------------------------------------------------------
define('G5_SET_DEVICE', 'both');
// define('G5_CERT_IN_PROG', false); // 재인증페이지 리디렉션 사용여부
define('G5_USE_MOBILE', true); // 모바일 홈페이지를 사용하지 않을 경우 false 로 설정
define('G5_USE_CACHE', true); // 최신글등에 cache 기능 사용 여부

View File

@ -1,10 +1,10 @@
<?php
include_once('./_common.php');
include_once('./_common.php');
$txId = $_POST['txId'];
$mid = substr($txId, 6, 10);
$txId = $_POST['txId'];
$mid = substr($txId, 6, 10);
if ($_POST["resultCode"] === "0000") {
if ($_POST["resultCode"] === "0000") {
$data = array(
'mid' => $mid,
@ -29,7 +29,7 @@
if($res_data['resultCode'] === "0000") {
@insert_cert_history('@password_lost@', 'kg', 'sa'); // 인증성공 시 내역 기록
@insert_cert_history($member['mb_id'], 'kg', 'sa'); // 인증성공 시 내역 기록
$cert_type = 'sa'; // 인증타입
$cert_no = $res_data['txId']; // 이니시스 트랜잭션 ID
@ -55,17 +55,17 @@
alert_close('코드 : '.$res_data['resultCode'].' '.urldecode($res_data['resultMsg']));
exit;
}
} else { // resultCode===0000 아닐경우 아래 인증 실패를 출력함
} else { // resultCode===0000 아닐경우 아래 인증 실패를 출력함
// 인증실패
alert_close('코드 : '.$_POST['resultCode'].' '.urldecode($_POST['resultMsg']));
exit;
}
}
$g5['title'] = 'KG이니시스 통합인증 결과';
include_once(G5_PATH.'/head.sub.php');
$g5['title'] = 'KG이니시스 통합인증 결과';
include_once(G5_PATH.'/head.sub.php');
?>
<form name="mbFindForm" method="POST">
<input type="hidden" name="mb_id" value="<?php echo $row["mb_id"]; ?>">
<input type="hidden" name="mb_id" value="<?php echo $row["mb_id"]; ?>">
</form>
<script>
jQuery(function($) {

View File

@ -1,48 +1,48 @@
<?php
include_once('./_common.php');
include_once('./_common.php');
if($_GET['directAgency'] == "KFTC") alert_close("서비스 준비중입니다.");
if($_GET['directAgency'] == "KFTC") alert_close("서비스 준비중입니다.");
$sql = "select MAX(cr_id) as max_cr_id from {$g5['cert_history_table']} limit 1";
$res = sql_fetch($sql);
$max_cr_id = $res['max_cr_id'];
if(empty($max_cr_id)) $max_cr_id = 0;
$sql = "select MAX(cr_id) as max_cr_id from {$g5['cert_history_table']} limit 1";
$res = sql_fetch($sql);
$max_cr_id = $res['max_cr_id'];
if(empty($max_cr_id)) $max_cr_id = 0;
if($config['cf_cert_use'] == 2) { // 실서비스 일때
if($config['cf_cert_use'] == 2) { // 실서비스 일때
$mid = 'SRA'.$config['cf_cert_kg_mid']; // 부여받은 MID(상점ID) 입력(영업담당자 문의)
$apiKey = $config['cf_cert_kg_cd']; // 부여받은 MID 에 대한 apiKey
$mTxId ='SIR_'.$max_cr_id;
certify_count_check($member['mb_id'], 'sa'); // 금일 인증시도 횟수 체크
} else { // 테스트 일때
} else { // 테스트 일때
$mid = "INIiasTest";
$apiKey = "TGdxb2l3enJDWFRTbTgvREU3MGYwUT09";
$mTxId ='test_'.$max_cr_id;
}
$reqSvcCd ='01';
}
$reqSvcCd ='01';
// 등록가맹점 확인
$plainText1 = hash("sha256",(string)$mid.(string)$mTxId.(string)$apiKey);
$authHash = $plainText1;
// 등록가맹점 확인
$plainText1 = hash("sha256",(string)$mid.(string)$mTxId.(string)$apiKey);
$authHash = $plainText1;
//$flgFixedUser = (!empty($member['mb_id']) && !empty($member['mb_name']) && !empty($member['mb_hp']) && !empty($member['mb_birth']))? 'Y' : 'N'; // 특정사용자 고정시 : Y 세팅및 아래 해시 데이터 생성
$flgFixedUser = 'N'; // 특정사용자 구분하지 않기로 하여 수정
//$flgFixedUser = (!empty($member['mb_id']) && !empty($member['mb_name']) && !empty($member['mb_hp']) && !empty($member['mb_birth']))? 'Y' : 'N'; // 특정사용자 고정시 : Y 세팅및 아래 해시 데이터 생성
$flgFixedUser = 'N'; // 특정사용자 구분하지 않기로 하여 수정
// php8버전 값체크 경고 때문에 필수값이 아닌 값이 없을수 있는 선택값들은 초기화해주어야함
$userName = '';
$userPhone = '';
$userBirth = '';
$userHash = '';
// php8버전 값체크 경고 때문에 필수값이 아닌 값이 없을수 있는 선택값들은 초기화해주어야함
$userName = '';
$userPhone = '';
$userBirth = '';
$userHash = '';
if($flgFixedUser == 'Y') {
if($flgFixedUser == 'Y') {
$userName = $member['mb_name']; // 사용자 이름
$userPhone = preg_replace("/-/","" , $member['mb_hp']); // 사용자 전화번호 하이픈만 제거
$userBirth = $member['mb_birth']; // 사용자 생년월일
$plainText2 = hash("sha256",(string)$userName.(string)$mid.(string)$userPhone.(string)$mTxId.(string)$userBirth.(string)$reqSvcCd);
$userHash = $plainText2;
}
}
switch($_GET['pageType']) {
switch($_GET['pageType']) {
case "register":
$resultPage = "/kg_result.php";
break;
@ -51,11 +51,11 @@
break;
default:
alert_close('잘못된 접근입니다.');
}
}
$resultUrl = G5_KGCERT_URL . $resultPage;
$g5['title'] = 'KG이니시스 통합인증';
include_once(G5_PATH.'/head.sub.php');
$resultUrl = G5_KGCERT_URL . $resultPage;
$g5['title'] = 'KG이니시스 통합인증';
include_once(G5_PATH.'/head.sub.php');
?>
<form name="saForm">
<input type="hidden" name="mid" value="<?php echo $mid ?>"> <!-- 필수 값 -->
@ -82,4 +82,4 @@
document.saForm.submit();
</script>
<?php
include_once(G5_PATH.'/tail.sub.php');
include_once(G5_PATH.'/tail.sub.php');

View File

@ -1,10 +1,10 @@
<?php
include_once('./_common.php');
include_once('./_common.php');
$txId = $_POST['txId'];
$mid = substr($txId, 6, 10);
$txId = $_POST['txId'];
$mid = substr($txId, 6, 10);
if ($_POST["resultCode"] === "0000") {
if ($_POST["resultCode"] === "0000") {
$data = array(
'mid' => $mid,
@ -76,14 +76,14 @@
alert_close('코드 : '.$res_data['resultCode'].' '.urldecode($res_data['resultMsg']));
exit;
}
} else { // resultCode===0000 아닐경우 아래 인증 실패를 출력함
} else { // resultCode===0000 아닐경우 아래 인증 실패를 출력함
// 인증실패
alert_close('코드 : '.$_POST['resultCode'].' '.urldecode($_POST['resultMsg']));
exit;
}
}
$g5['title'] = 'KG이니시스 통합인증 결과';
include_once(G5_PATH.'/head.sub.php');
$g5['title'] = 'KG이니시스 통합인증 결과';
include_once(G5_PATH.'/head.sub.php');
?>
<script>
jQuery(function($) {