/** * @breif view kcb result page */ function dispAuthenticationKcbResult() { $oAuthenticationModel =& getModel('authentication'); $config = $oAuthenticationModel->getModuleConfig(); $rqstSiteNm = $_POST["rqst_site_nm"]; // 접속도메인 $hsCertRqstCausCd = $_POST["hs_cert_rqst_caus_cd"]; // 인증요청사유코드 2byte (00:회원가입, 01:성인인증, 02:회원정보수정, 03:비밀번호찾기, 04:상품구매, 99:기타) $encInfo = $_POST["encInfo"]; // 인증결과 암호화 데이터 $WEBPUBKEY = trim($_POST["WEBPUBKEY"]); // KCB서버 공개키 $WEBSIGNATURE = trim($_POST["WEBSIGNATURE"]); // KCB서버 서명값 // 파라미터에 대한 유효성여부를 검증한다. if (preg_match('~[^0-9a-zA-Z+/=]~', $encInfo, $match)) { return $this->stop('check_parameater'); } if (preg_match('~[^0-9a-zA-Z+/=]~', $WEBPUBKEY, $match)) { return $this->stop('check_parameater'); } if (preg_match('~[^0-9a-zA-Z+/=]~', $WEBSIGNATURE, $match)) { return $this->stop('check_parameater'); } $memId = $config->kcb_id; // KCB로부터 부여받은 회원사코드 설정 (12자리) $keyPath = "./safecert_{$memId}.key"; $logPath = "./files/authentication/logs"; $endPointUrl = "http://safe.ok-name.co.kr/KcbWebService/OkNameService"; // 운영 서버 $options = "SUL"; // S:인증결과복호화 //run CMD $cmd = array($keyPath, $memId, $endPointUrl, $WEBPUBKEY, $WEBSIGNATURE, $encInfo, $logPath, $options); $output = NULL; $ret = okname($cmd, $output); if ($ret == 0) { $result = explode("\n", $output); $retcode = $result[0]; //인증결과 복호화 성공 // 인증결과를 확인하여 페이지분기등의 처리를 수행해야한다. if ($retcode == "B000") { echo "<script>alert('본인인증성공'); fncOpenerSubmit();</script>"; } else { echo "<script>alert('본인인증실패 : " . $retcode . "'); fncOpenerSubmit();</script>"; } } else { if ($ret <= 200) { $retcode = sprintf("B%03d", $ret); } else { $retcode = sprintf("S%03d", $ret); } //인증결과 복호화 실패 echo "<script>alert('인증결과복호화 실패 : " . $ret . "'); self.close(); </script>"; } //세션에 저장 $authinfo = array(); $authinfo["resultCd"] = $result[0]; //처리결과코드 $authinfo["resultMsg"] = $result[1]; //처리결과메시지 $authinfo["hsCertSvcTxSeqno"] = $result[2]; //거래일련번호 (sequence처리) $authinfo["auth_date"] = $result[3]; //인증일시 $authinfo["DI"] = $result[4]; //DI $authinfo["CI"] = $result[5]; //CI $authinfo["user_name"] = $result[7]; //성명 $authinfo["birthday"] = $result[8]; //생년월일 $authinfo["age"] = substr(date('Ymd') - $result[8], 0, 2); //만 나이 $authinfo["agency"] = $result[11]; //통신사코드 $authinfo["mobile"] = $result[12]; //휴대폰번호 $authinfo["ori_sex"] = $result[9] == 1 ? "M" : "F"; $authinfo["ori_for"] = $result[10] == 1 ? "N" : "Y"; $authinfo["ori_auth"] = "M"; $args->authentication_srl = getNextSequence(); $args->country_code = '82'; $args->clue = $authinfo["mobile"]; $args->authcode = 'kcb'; $args->ipaddress = $_SERVER['REMOTE_ADDR']; $args->passed = 'Y'; $output = executeQuery('authentication.insertAuthentication', $args); if (!$output->toBool()) { return $output; } // 인증성공 $_SESSION['authentication_pass'] = '******'; $_SESSION['authentication_srl'] = $args->authentication_srl; Context::set('authinfo', $authinfo); Context::set('hsCertMsrCd', $hsCertMsrCd); $this->setLayoutFile(''); $this->setTemplateFile('auth_result'); }
function ajax_upin_kcb2() { // kcb-ipin cert post-process /*{{{*/ list($cpCode, $keyfile, $logpath) = dob_upin_get_options(); $req_headers = apache_request_headers(); //upin_log('header',$req_headers); //upin_log('server',$_SERVER); //upin_log('post',$_POST); // tc, encPsnlInfo, IDENTIFYDATA, WEBPUBKEY, WEBSIGNATURE @($encPsnlInfo = $_POST['encPsnlInfo']); //아이핀팝업에서 조회한 PERSONALINFO @($WEBPUBKEY = trim($_POST['WEBPUBKEY'])); //KCB서버 공개키 @($WEBSIGNATURE = trim($_POST['WEBSIGNATURE'])); //KCB서버 서명값 //파라미터에 대한 유효성여부를 검증한다. if (preg_match('~[^0-9a-zA-Z+/=]~', $encPsnlInfo, $match)) { upin_error("encPsnlInfo 입력 값 확인이 필요합니다\n{$encPsnlInfo}"); } if (preg_match('~[^0-9a-zA-Z+/=]~', $WEBPUBKEY, $match)) { upin_error("WEBPUBKEY 입력 값 확인이 필요합니다\n{$WEBPUBKEY}"); } if (preg_match('~[^0-9a-zA-Z+/=]~', $WEBSIGNATURE, $match)) { upin_error("WEBSIGNATURE 입력 값 확인이 필요합니다\n{$WEBSIGNATURE}"); } // decrypt $servURL = 'http://www.ok-name.co.kr/KcbWebService/OkNameService'; // 운영 서버 $options = 'SUL'; $cmd = array($keyfile, $cpCode, $servURL, $WEBPUBKEY, $WEBSIGNATURE, $encPsnlInfo, $logpath, $options); $output = NULL; $ret = okname($cmd, $output); //upin_log('output',$output); if ($ret) { upin_error(sprintf(($ret <= 200 ? 'B' : 'S') . '%03d', $ret)); } $keys = array('dupinfo', 'coinfo1', 'coinfo2', 'ciupdate', 'virtualno', 'cpcode', 'realname', 'cprequestnumber', 'age', 'sex', 'nationalinfo', 'birthdate', 'authinfo'); $upin_info = array(); $result = explode("\n", $output); for ($i = 0; $i < count($keys); ++$i) { $upin_info[$keys[$i]] = $result[$i]; } $_SESSION['upin_info'] = $upin_info; upin_log('info', $upin_info); $form = $_SESSION['upin_form']; $html_toggle = ''; if ($form == 'registerform') { //$html_toggle = "opener.document.forms.$form.btn_upin.disabled = true;"; } elseif ($form == 'formCart') { $html_toggle = "opener.document.forms.{$form}.submit.disabled = false;"; } $label_check_ok = 'IPIN 인증완료'; //__('Successfully Certified', DOBslug); echo <<<HTML <script type="text/javascript"> opener.document.forms.{$form}.upin_cert.value = '1'; opener.document.forms.{$form}.btn_upin.value = '{$label_check_ok}'; opener.document.forms.{$form}.btn_upin.disabled = true; {$html_toggle} self.close(); </script> HTML; wp_die(); }
$fspath = $root . '/' . $webpath; if (!is_dir($fspath)) { $fspath = $root; } $ufile = $_FILES['userfile']['tmp_name']; //GOT UPLOAD if ($ufile) { $ufilename = $_FILES['userfile']['name']; if (!preg_match("/\\.({$browselist})\$/", $ufilename)) { echo "<body>{$ufilename} {$NotAllowed}"; } else { $uferr = $_FILES['userfile']['error']; if ($uferr > 0) { exit("[Upload error {$uferr} for {$ufilename}] "); } $newname = okname($ufilename); $target = "{$fspath}/{$newname}"; $webname = $webpath ? "{$webpath}/{$newname}" : $newname; if (file_exists($target)) { @cp($target, "{$target}.bak"); } //Note, previous version silently backed up if (!@move_uploaded_file($ufile, $target)) { exit("[Failed to move upload {$ufilename} to {$webname}]"); } else { exit('<body onload="' . $fun . '(\'' . $webname . '\');"> ' . $webname . ' </body></html>'); } } } else { echo '<body>'; }
/** * @breif kcb 본인인증 필요정보 가져오기 * @return resultcode */ function getKcbMobileData() { $oAuthenticationModel =& getModel('authentication'); $config = $oAuthenticationModel->getModuleConfig(); // kcb설정이 제대로 되어있지 않다면 return resultcode '999' if (!$config->kcb_id || !$config->domain) { return "999"; } //set Default Variables $name = "x"; $birthday = "x"; $gender = "x"; $nation = "x"; $telComCd = "x"; $telNo = "x"; // 0 = not posted data, no use Filter $inTpBit = 0; $svcTxSeqno = getNextSequence(); $memId = $config->kcb_id; $serverIp = $_SERVER["SERVER_ADDR"]; $rsv1 = "0"; $rsv2 = "0"; $rsv3 = "0"; $hsCertMsrCd = "10"; // 요청수단코드 (10:핸드폰) $hsCertRqstCausCd = "00"; // 인증요청사유코드 (00:회원가입, 01:성인인증, 02:회원정보수정, 03:비밀번호찾기, 04:상품구매, 99:기타) $returnMsg = "x"; $returnUrl = "http://{$_SERVER['HTTP_HOST']}{$_SERVER['PHP_SELF']}?act=dispAuthenticationKcbResult"; $endPointURL = "http://safe.ok-name.co.kr/KcbWebService/OkNameService"; // is real server //$exe = "./kcb/php_okname.so"; $logPath = "./files/authentication/logs"; if (!FileHandler::makeDir($logPath)) { return new Object(-1, 'msg_error'); } $siteUrl = "www." . $config->domain; // 회원사 사이트 URL $siteDomain = $config->domain; // 회원사 사이트 도메인 $options = "QUL"; $cmd = array($svcTxSeqno, $name, $birthday, $gender, $nation, $telComCd, $telNo, $rsv1, $rsv2, $rsv3, $returnMsg, $returnUrl, $inTpBit, $hsCertMsrCd, $hsCertRqstCausCd, $memId, $serverIp, $siteDomain, $endPointURL, $logPath, $options); //run Module $output = NULL; $ret = okname($cmd, $output); //성공일 경우 변수를 결과에서 얻음 if ($ret == 0) { $result = explode("\n", $output); $retcode = $result[0]; $retmsg = $result[1]; $e_rqstData = $result[2]; } else { if ($ret <= 200) { $retcode = sprintf("B%03d", $ret); } else { $retcode = sprintf("S%03d", $ret); } } Context::set('rqst_data', $e_rqstData); return sprintf("%03u", $ret); }