CI 묻고 답하기

제목 iframe으로 target하여 페이지 전달은 어떻게 하나요?
글쓴이 무소유 작성시각 2013/04/16 18:51:22
댓글 : 3 추천 : 0 스크랩 : 0 조회수 : 27639   RSS

kcp 휴대폰 인증 달아보려고 하는데

샘플소스가 일반 소스더라고요. 그래서 보니... 사이즈 0인 iframe 으로 값전달해서 새창띄우게 끔 되어 있는데요..

기존 ci 사이트에 쉽게 붙여보려고 soap 폴더 하나 만들어서 그 폴더는 ci 필요없는 폴더 하나 만들고

거기에 kcp 소스 넣어서 연결해 보려고 하는데 안되네요..ㅜㅜ;;

클릭시 인증창 호출하게 자바스크립트로 처리하게 되어 있습니다.

// 인증창 호출 함수
function auth_type_check(){
  var auth_form = document.form_auth;
  if( auth_form.ordr_idxx.value == "" ){
    alert( "주문번호는 필수 입니다." );
    return false;
  } else{
    auth_form.user_name_temp.value = encodeURIComponent(auth_form.user_name_temp.value); // post 방식일경우 필요 없음.
    auth_form.user_name.value      = auth_form.user_name_temp.value;
    auth_form.user_name_temp.value = "";                                                 // post 방식일경우 필요 없음.

    auth_form.method = "post";
    auth_form.target = "kcp_cert";
    auth_form.action = "http://tiancai.yoons.or.kr/soap/kcpcert_enc/kcpcert_proc_req.php"; // 인증페이지 호출

    return true;
  }
}

이런식으로요... 당연히 파일 하단에

<iframe id="kcp_cert" name="kcp_cert" width="600" height="300" frameborder="1" scrolling="no"></iframe>
여기로 값넘기게 되어 있고요... 중간에 필수항목 전달하는 폼 <form name="form_auth"> 있습니다.

어떤식으로 호출을 하여야 할까요?  kcp에서 받은 소스를 그냥 사용하려고 했는데 방법은 없을까요?

소스 분석해서 다시 만드는 방법밖에 없을까요?

참고로 action으로 보내는 파일은 상단에 라이브러리 인클루드하고 로드시 자바스크립트 호출하여 kcp창

팝업으로 띄우게 되어 있습니다.


## kcpcert_proc_req.php

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=EUC-KR">
        <title>*** KCP Online Payment System [PHP Version] ***</title>
        <script type="text/javascript">
            window.onload=function(){
                var frm = document.form_auth;
                // 인증 요청 시 호출 함수
                if ( frm.req_tx.value == "cert" )
                {
                    parent.document.form_auth.veri_up_hash.value = frm.up_hash.value;   // up_hash 데이터 검증을 위한 필드

                    frm.action="https://testcert.kcp.co.kr/kcp_cert/cert_view.jsp  "; // KCP 인증 요청 페이지 URL
                    frm.submit();
                }
                // 인증 결과 데이터 리턴 페이지 호출 함수
                else if ( ( frm.req_tx.value == "auth" || frm.req_tx.value == "otp_auth" ) )
                {
                    frm.req_tx.value = "result";
                    frm.action ="http://tiancai.yoons.or.kr/soap/kcpcert_enc/kcpcert_proc_res.php";
                    frm.target ="kcp_cert";
                    frm.submit();

                    window.close();
                }
                else
                {
                    alert ("req_tx 값을 확인해 주세요");
                }

            }
        </script>
    </head>
    <body oncontextmenu="return false;" ondragstart="return false;" onselectstart="return false;">
        <form name="form_auth" method="post">
            <?= $sbParam ?>
        </form>
    </body>
</html>

 다음글 tank_auth 복호화 질문 드립니다. (6)
 이전글 tank_auth 세션 생성 질문 드립니다. (11)

댓글

변종원(웅파) / 2013/04/16 19:08:12 / 추천 0
 타겟이 주석처리 되어 있는거 같은데요?

그리고 index.php 없애기위한 htacess 사용중이면 그 안에 soap이라는 디렉토리 넣어줘야 합니다.
무소유 / 2013/04/16 19:30:39 / 추천 0
웅파님 답변 감사드립니다.

soap 에서 kcp 샘플은 잘 돌아가더라고요..

http://tiancai.yoons.or.kr/soap/kcpcert_enc/kcpcert_start.php

요렇게 테스트서버에 올려 놓고 돌려 보았습니다.

위에 주석처리는 올리다가 오타여서 지웠습니다. 전부 get 방식으로 쿼리스트링 만들어서

열어보니 전달은 되더라고요..ㅡㅜ; 역시 초보티가 팍팍 나고 있습니다.

무소유 / 2013/04/19 18:48:03 / 추천 0
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_URI} !^/index\.php
RewriteCond %{REQUEST_URI} !^/img/
RewriteCond %{REQUEST_URI} !^/css/
RewriteCond %{REQUEST_URI} !^/js/
RewriteCond %{REQUEST_URI} !^/datafile/
RewriteCond %{REQUEST_URI} !^/data/
RewriteCond %{REQUEST_URI} !^/editor/
RewriteCond %{REQUEST_URI} !^/myadmin/
RewriteCond %{REQUEST_URI} !^/soap/
RewriteCond %{REQUEST_URI} !^/bookfile/
RewriteRule ^(.*)$ /index.php/$1 [L]
</IfModule>

이런식으로 htaccess 설정해 놓아서 그냥은 열리는데

http://tiancai.yoons.or.kr/soap/kcpcert_enc/kcpcert_proc_res.php

왜 iframe으로 타켓을 줬을 때 동작을 안하는지 모르겠네요...

다른곳에 설정을 보아야 할까요?