ClassicASP 도로명+지번주소 우편번호 검색
페이지 정보
본문
신주소와 지번주소를 함께 검색을 사용하는 소스입니다.
<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=600, height=250, top=330, left=370";
window.open(url, 'new_window', opt);
}
</script>
<form name="hpwrite">
<input type="tex"t name='zip1' size="4" maxlength="3" readonly value='<% 'response.write mb_zip1 %>'>
-
<input type="text" name='zip2' size="4" maxlength="3" readonly value='<% 'response.write mb_zip2 %>'>
<a href="javascript:zipfind('zipcode.asp', this);"><img width="91" height="20" src="../img/post_search_btn.gif" border=0 align="absmiddle"></a><br />
<input type="text" name='add1' style="width:99%;" readonly="readonly" value='<% 'response.write mb_addr1 %>'><br />
<input type="text" name='add2' style="width:99%;" value='<% 'response.write mb_addr2 %>'>
</form>
### zipcode.asp 내용은 다음과 같습니다.
<%
dim conn
set conn = Server.CreateObject("ADODB.Connection")
conn.Open "Provider=SQLOLEDB.1;Password=디비비밀번호;Persist Security Info=True; User ID=디비아이디; Initial Catalog=디비이름; Data Source=디비주소"
dim tb_zipcode : tb_zipcode = "우편번호테이블이름"
dim ErrNum, MSG
dim TDStyle, str_zip, ErrFlag, i
dim tmp, tmp_zip, tmp_zip1, tmp_zip2
dim sido, gugun, dong, ri, bunji, road, road_building, road_dong
ErrNum = sqlCheck(Trim(Request("ErrNum")))
IF ErrNum <> "" Then
Select Case ErrNum
Case "0011"
MSG = "<div style='padding: 10px 0 0 30px; color:#f51515;'>해당 검색어에 해당하는 우편번호가 존재하지 않습니다.</div>"
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; "
' 인젝션 방지관련 https://www.happyjung.com/bbs/board.php?bo_table=lecture&wr_id=480
'function sqlCheck(str)
'...
'end function
str_zip = sqlCheck(Trim(Request("str_zip")))
IF len(str_zip) >= 2 then
SQL="SELECT * from "& tb_zipcode &" Where dong like '%"& str_zip &"%' or road 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-x: hidden; overflow-y: auto; }
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, d) {
opener.hpform.zip1.value = tmp_zip1;
opener.hpform.zip2.value = tmp_zip2;
opener.hpform.add1.value = c;
opener.hpform.add2.value = d;
//opener.hpform.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)
sido = rs("sido")
gugun = rs("gugun")
dong = rs("dong")
ri = rs("ri")
bunji = rs("bunji")
road = rs("road")
road_building = rs("road_building")
road_dong = rs("road_dong")
%>
<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 sido &" "
if gugun <> "" then
response.write gugun &" "
end if
if dong <> "" then
response.write dong &" "
end if
if ri <> "" then
response.write ri &" "
end if
if road <> "" then
response.write road &" "
end if
%>','<%
if road <> "" then
if road_building <> "" then
response.write road_building &" "
end if
if road_dong <> "" then
response.write "("& road_dong &")"
end if
end if
%>')">
<%
response.write "["& tmp_zip1 &"-"& tmp_zip2 &"] "
response.write sido &" "
if gugun <> "" then
response.write gugun &" "
end if
if dong <> "" then
response.write dong &" "
end if
if ri <> "" then
response.write ri &" "
end if
if road <> "" then
response.write road &" "
response.write bunji &" "
if road_building <> "" then
response.write road_building &" "
end if
if road_dong <> "" then
response.write "("& road_dong &")"
end if
else
response.write bunji &" "
end if
%></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/zipcode_top.gif" /></td>
</tr>
<tr>
<td background="../img/zipcode_middle.gif" style="padding-top:10px;">
<form name="InSearch" method="post" action="zipcode.asp" style="padding:0; margin:0;">
<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/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 />
ex) 구로동, 역삼, 디지털로
</td>
</tr>
<tr align="center">
<td colspan="2"><img src="../img/zipcode_close.gif" onclick="self.close();"border="0" /></td>
</tr>
</table></td>
</tr>
<tr>
<td><img src="../img/zipcode_bottom.gif" /></td>
</tr>
</table>
</body>
</html>
도로명+지번주소 우편번호 : https://www.happyjung.com/bbs/board.php?bo_table=lecture&wr_id=1366
<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=600, height=250, top=330, left=370";
window.open(url, 'new_window', opt);
}
</script>
<form name="hpwrite">
<input type="tex"t name='zip1' size="4" maxlength="3" readonly value='<% 'response.write mb_zip1 %>'>
-
<input type="text" name='zip2' size="4" maxlength="3" readonly value='<% 'response.write mb_zip2 %>'>
<a href="javascript:zipfind('zipcode.asp', this);"><img width="91" height="20" src="../img/post_search_btn.gif" border=0 align="absmiddle"></a><br />
<input type="text" name='add1' style="width:99%;" readonly="readonly" value='<% 'response.write mb_addr1 %>'><br />
<input type="text" name='add2' style="width:99%;" value='<% 'response.write mb_addr2 %>'>
</form>
### zipcode.asp 내용은 다음과 같습니다.
<%
dim conn
set conn = Server.CreateObject("ADODB.Connection")
conn.Open "Provider=SQLOLEDB.1;Password=디비비밀번호;Persist Security Info=True; User ID=디비아이디; Initial Catalog=디비이름; Data Source=디비주소"
dim tb_zipcode : tb_zipcode = "우편번호테이블이름"
dim ErrNum, MSG
dim TDStyle, str_zip, ErrFlag, i
dim tmp, tmp_zip, tmp_zip1, tmp_zip2
dim sido, gugun, dong, ri, bunji, road, road_building, road_dong
ErrNum = sqlCheck(Trim(Request("ErrNum")))
IF ErrNum <> "" Then
Select Case ErrNum
Case "0011"
MSG = "<div style='padding: 10px 0 0 30px; color:#f51515;'>해당 검색어에 해당하는 우편번호가 존재하지 않습니다.</div>"
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; "
' 인젝션 방지관련 https://www.happyjung.com/bbs/board.php?bo_table=lecture&wr_id=480
'function sqlCheck(str)
'...
'end function
str_zip = sqlCheck(Trim(Request("str_zip")))
IF len(str_zip) >= 2 then
SQL="SELECT * from "& tb_zipcode &" Where dong like '%"& str_zip &"%' or road 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-x: hidden; overflow-y: auto; }
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, d) {
opener.hpform.zip1.value = tmp_zip1;
opener.hpform.zip2.value = tmp_zip2;
opener.hpform.add1.value = c;
opener.hpform.add2.value = d;
//opener.hpform.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)
sido = rs("sido")
gugun = rs("gugun")
dong = rs("dong")
ri = rs("ri")
bunji = rs("bunji")
road = rs("road")
road_building = rs("road_building")
road_dong = rs("road_dong")
%>
<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 sido &" "
if gugun <> "" then
response.write gugun &" "
end if
if dong <> "" then
response.write dong &" "
end if
if ri <> "" then
response.write ri &" "
end if
if road <> "" then
response.write road &" "
end if
%>','<%
if road <> "" then
if road_building <> "" then
response.write road_building &" "
end if
if road_dong <> "" then
response.write "("& road_dong &")"
end if
end if
%>')">
<%
response.write "["& tmp_zip1 &"-"& tmp_zip2 &"] "
response.write sido &" "
if gugun <> "" then
response.write gugun &" "
end if
if dong <> "" then
response.write dong &" "
end if
if ri <> "" then
response.write ri &" "
end if
if road <> "" then
response.write road &" "
response.write bunji &" "
if road_building <> "" then
response.write road_building &" "
end if
if road_dong <> "" then
response.write "("& road_dong &")"
end if
else
response.write bunji &" "
end if
%></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/zipcode_top.gif" /></td>
</tr>
<tr>
<td background="../img/zipcode_middle.gif" style="padding-top:10px;">
<form name="InSearch" method="post" action="zipcode.asp" style="padding:0; margin:0;">
<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/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 />
ex) 구로동, 역삼, 디지털로
</td>
</tr>
<tr align="center">
<td colspan="2"><img src="../img/zipcode_close.gif" onclick="self.close();"border="0" /></td>
</tr>
</table></td>
</tr>
<tr>
<td><img src="../img/zipcode_bottom.gif" /></td>
</tr>
</table>
</body>
</html>
도로명+지번주소 우편번호 : https://www.happyjung.com/bbs/board.php?bo_table=lecture&wr_id=1366
댓글목록
등록된 댓글이 없습니다.