<?php
header("Pragma: no-cache");
header("Cache-Control: no-cache,must-revalidate");

$tr_url     = WWW_CROSSMAP.'/m/common/kmc_mobile_callback'; // 본인인증 결과수신 POPUP URL
$tr_add     = 'N';          // IFrame사용여부


?>

<!doctype html>
<html lang="ko">
<head>
	<meta charset="utf-8">
	<meta name="apple-mobile-web-app-capable" content="yes">
	<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
	<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1, user-scalable=no" />
	<script src="/js/jquery-3.3.1.min.js"></script>
	<script src="/js/web/common.js"></script>
</head>
<body>


<form name="reqKMCISForm" method="post" action="#">
	<input type="hidden" name="tr_cert" id="tr_cert">
	<input type="hidden" name="tr_url"  id="tr_url" value = "<?=$tr_url?>">
	<input type="hidden" name="tr_add"  id="tr_add" value = "<?=$tr_add?>">
</form>


<script>


	function kmc_window_open(mobile, type){
		var form_data = {
			"mobile"			: mobile,
			"type"              : type
		};
		$.ajax({
			url: '/m/common/kmc_encode_proc',
			async: false,
			type: 'POST',
			dataType: 'JSON',
			data: form_data,
			success: function (rtnJson) {
				if(rtnJson.code=='9999') {
					alert("본인인증에 실패했습니다.");
					return false;

				} else {
					$("#tr_cert").val(rtnJson.data);
					openKMCISWindow();
				}
			},
			error: function (rtnHtml) {
				alert('본인인증에 실패했습니다.');
				return_state = false;
			}

		});
	}

	$(document).ready(function(){

		kmc_window_open("<?=@$_GET['mobile']?>","<?=$_GET['type']?>");
	});

	// kmc 본인인증
	window.name = "kmcis_web";
	var KMCIS_window;
	function openKMCISWindow(){
		var UserAgent = navigator.userAgent;
		/* 모바일 접근 체크*/
		// 모바일일 경우 (변동사항 있을경우 추가 필요)
			document.reqKMCISForm.target = '';

		document.reqKMCISForm.action = 'https://www.kmcert.com/kmcis/web/kmcisReq.jsp';
		document.reqKMCISForm.submit();
	}








</script>


</body>
</html>
