우편번호 검색 삽입하기 > 기술자료 | 해피정닷컴

우편번호 검색 삽입하기 > 기술자료

본문 바로가기

사이트 내 전체검색

우편번호 검색 삽입하기 > 기술자료

ClassicASP 우편번호 검색 삽입하기

페이지 정보


첨부파일

본문

##### write.asp #####

<script type="text/javascript">
<!--
function zipfind(url, field) {
  var opt = "toolbar=no, resizable=yes, scrollbars=yes, location=no, resize=no,menubar=no, directories=no, copyhistory=0, width=450, height=250, top=330, left=370";  
  window.open(url, 'new_window', opt);
}
//-->
</script>


<form id="fregisterform" name="fregisterform" method="post" onSubmit="return fregisterform_submit(this);" enctype="multipart/form-data">

<input type="tex"t name='zip1' size="4" maxlength="3" itemname='우편번호 앞자리' value='<% 'response.write mb_zip1 %>'> -
<input type="text" name='zip2' size="4" maxlength="3" itemname='우편번호 뒷자리' value='<% 'response.write mb_zip2 %>'>
&nbsp;<a href="javascript:zipfind('zipcode.asp', this);"><img width="91" height="20" src="../img/post_search_btn.gif" border=0 align="absmiddle"></a>
<input type="text" name='add1' size=60 itemname='주소' value='<% 'response.write mb_addr1 %>'>
<input type="text" name='add2' size=60 itemname='상세주소' value='<% 'response.write mb_addr2 %>'></td>

</form>



##### dbconfig.asp #####

<%
dim conn1, db
conn1="provider=sqloledb; server=디비주소; Database=디비네임; UID=디비아이디; PWD=디비비밀번호;" Set Db = Server.CreateObject("ADODB.Connection")
db.open conn1
%>



#### function.asp ####

<%
' 인젝션 방지관련 https://www.happyjung.com/lecture/480
'function sqlCheck(str)
'...
'end function
%>



##### zipcode.asp #####

<!--#include file="function.asp" -->
<!--#include file="dbconfig.asp" -->
<%
dim ErrNum, MSG
dim TDStyle, str_zip, ErrFlag, i
dim tmp, tmp_zip, tmp_zip1, tmp_zip2

 ErrNum = sqlCheck(Trim(Request("ErrNum")))
   
 IF ErrNum <> "" Then
  Select Case ErrNum
   Case "0011"
    MSG = "<font color=red>해당 검색어에 해당하는 우편번호가 존재하지 않습니다. <br> 다시 검색하여 주십시오! </font><br><br>"
  End Select
 End IF

 TDStyle = "border-bottom: black 1px solid; border-left: black 1px solid; border-right: black 1px solid; border-top: black 1px solid; "

 str_zip = sqlCheck(Trim(Request("str_zip")))
   
 IF  len(str_zip) >= 2  then
  SQL="SELECT zipCode,siDo,gugun,dong,bunji from dg_zipcode Where dong like '%"& str_zip &"%'"
  Set Rs=conn.Execute(SQL)
  IF Rs.EOF Then
   ErrFlag = True
   ErrNum  = 0011
   
   Response.Redirect "zipcode.asp?ErrNum=0011"
   Response.End
  End IF
 End IF

%>
<html>
<head>
<title>우편번호 찾기</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style>
body { margin: 0; font-size:12px; overflow: hidden; overflow-x: hidden; overflow-y: scroll; }
td { font-size:12px; }
a:link   { font-family:"돋움"; text-decoration:none; color:#000000; line-height: 18px;}
a:active  { font-family:"돋움"; text-decoration:none; color:#000000; line-height: 18px;}
a:visited  { font-family:"돋움"; text-decoration:none; color:#000000; line-height: 18px;}
a:hover  { font-family:"돋움"; text-decoration:underline;  color:#000000; line-height: 18px;}
</style>
<script language="javascript">
<!--
function GoSearch() {
    fom = document.forms[0];
 if ( document.InSearch.str_zip.value == ""  ) {
   alert("기재하고 싶은 주소를 선택하세요!");
      fom.str_zip.focus();
   return;
 }
 if (document.InSearch.str_zip.value.length <= 1) {
     alert("주소입력은 2자리 이상이어야 합니다!");
     fom.str_zip.focus();
     return;
 }
 document.InSearch.submit();
}
//-->
</script>

<script type="text/javascript">
<!--
function copy(tmp_zip1, tmp_zip2, c) {
  opener.fregisterform.zip1.value = tmp_zip1;
  opener.fregisterform.zip2.value = tmp_zip2;
  opener.fregisterform.add1.value = c;
  opener.fregisterform.add2.focus();
  window.close();
}
//-->
</script>
</head>

<body>
<TABLE cellSpacing=0 cellpadding="2" style="BORDER-COLLAPSE: collapse" width="97%">
<%

if  len(str_zip) >= 2 then
  i = 0
  Do While Not Rs.EOF
    'response.write rs("zipcode")
    tmp_zip = rs("zipcode")
    tmp = split(tmp_zip,"-")
    tmp_zip1 = tmp(0)
    tmp_zip2 = tmp(1)
%>
 <tr height="20" onmouseover="this.style.backgroundcolor='#EFEFEF'" onmouseout="this.style.backgroundcolor='#FFFFFF'">   
  <td height="30" style="<%=TDStyle%>">
          <a href="#" onclick="copy('<%
            response.write tmp_zip1 %>','<% response.write tmp_zip2 %>','<%
            response.write rs("sido") &"&nbsp;"
            response.write rs("gugun") &"&nbsp;"
            response.write rs("dong") &"&nbsp;"
          %>')">
          <%
            response.write "["& tmp_zip1 &"-"& tmp_zip2 &"] "
            response.write rs("sido") &"&nbsp;"
            response.write rs("gugun") &"&nbsp;"
            response.write rs("dong") &"&nbsp;"
            response.write rs("bunji")
          %></a></td>
 </tr>            
<%
    Rs.MoveNext
    i = i + 1
  Loop
   
 conn.Close
 Set conn = Nothing
end if
%>
</table>

<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td><img src="../img/member/zipcode_top.gif" /></td>
    </tr>
  <tr>
    <td background="../img/member/zipcode_middle.gif" style="padding-top:10px;">
      <form name="InSearch" method="post" action="zipcode.asp">
         <table width="400" border="0" align="center" cellpadding="0" cellspacing="0">
           <tr>
              <td align="center">
                <input name="str_zip" class="input_box">
                <img  src="../img/member/zipcode_submit.gif" align="absmiddle" onclick="GoSearch();" /></td>
           </tr>
         </table>
      </form>
   <%= MSG %>
   <table width="400" border="0" align="center" cellpadding="4" cellspacing="0">
    <tr>
     <td style="padding-top:10px;">
     검색창에서 읍, 면, 동 이름중 한가지만 입력하십시요.<br />
     </td>
    </tr>
    <tr align="center">
     <td colspan="2"><img src="../img/member/zipcode_close.gif" onclick="self.close();"border="0" /></td>
    </tr>
   </table></td>
    </tr>
  <tr>
    <td><img src="../img/member/zipcode_bottom.gif" /></td>
  </tr>
</table>
</body>
</html>


참고사이트
http://postman.pe.kr 
http://kin.naver.com/qna/detail.nhn?d1id=1&dirId=1040204&docId=65474781

댓글목록

등록된 댓글이 없습니다.


Total 198건 9 페이지
  • RSS
기술자료 목록
38
ClassicASP   12258  2008-04-24 11:47 ~ 2012-03-24 00:00  
37
ClassicASP   14563  2008-04-23 22:02 ~ 2015-02-03 00:00  
열람
ClassicASP   14359  2008-04-17 22:30 ~ 2013-06-19 00:00  
35
ClassicASP   18534  2008-04-16 22:54  
34
ClassicASP   19178  2008-04-04 04:45  
33
ClassicASP   12806  2008-03-29 16:40  
32
ClassicASP   27025  2008-03-24 17:55 ~ 2012-05-18 00:00  
31
ClassicASP   12855  2008-03-21 08:36  
30
ClassicASP   30357  2008-03-14 14:53 ~ 2018-03-24 04:08  
29
ClassicASP   13926  2008-03-13 08:04  
28
ClassicASP   12022  2008-03-13 07:31  
27
ClassicASP   30499  2008-03-09 18:44 ~ 2018-05-15 14:37  
26
ClassicASP   23303  2008-03-08 10:40 ~ 2013-11-28 00:00  
25
ClassicASP   25024  2008-03-08 10:34 ~ 2014-07-08 00:00  
24
ClassicASP   10729  2008-01-10 08:48  
23
ClassicASP   27160  2007-12-29 11:18  
22
ClassicASP   10989  2007-12-28 14:42 ~ 2008-10-17 00:00  
21
ClassicASP   22849  2007-09-28 22:39 ~ 2009-11-11 00:00  
20
ClassicASP   11699  2007-09-28 21:47  
19
ClassicASP   17704  2007-09-22 18:30 ~ 2013-12-26 00:00  

검색

해피정닷컴 정보

회사소개 회사연혁 협력사 오시는길 서비스 이용약관 개인정보 처리방침

회사명: 해피정닷컴   대표: 정창용   전화: 070-7600-3500   팩스: 042-670-8272
주소: (34368) 대전시 대덕구 대화로 160 대전산업용재유통단지 1동 222호
개인정보보호책임자: 정창용   사업자번호: 119-05-36414
통신판매업신고: 제2024-대전대덕-0405호 [사업자등록확인]  
Copyright 2001~2024 해피정닷컴. All Rights Reserved.