-
Notifications
You must be signed in to change notification settings - Fork 0
/
zip_srch.php
68 lines (66 loc) · 1.98 KB
/
zip_srch.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<?php
header("Content-Type: text/html; charset=UTF-8");
define('__ZBXE__', true);
include("../files/config/db.config.php");
$dbname=$db_info->master_db['db_userid'];
$dbpass=$db_info->master_db['db_password'];
class DBConnection{
function getConnection($dbname,$dbpass){
//change to your database server/user name/password
mysql_connect("localhost",$dbname,$dbpass) or
die("Could not connect: " . mysql_error());
//change to your database name
mysql_select_db($dbname) or
die("Could not select database: " . mysql_error());
}
}
$db = new DBConnection();
$db->getConnection($dbname,$dbpass);
include_once("functions.php");
mysql_query("set session character_set_connection=utf8;");
mysql_query("set session character_set_results=utf8;");
mysql_query("set session character_set_client=utf8;");
$sql = "select * from `kr_zipcode` where `addr3` LIKE '%" . $_GET["zip_kwd"]."%' LIMIT 0,20";
if($_GET["ho"]){//직장 또는 집에 대한 플래그
$ho=1;
}else{
$ho=0;
}
?>
<html>
<head>
</head>
<body>
<form action="./zip_srch.php" method="GET">
<input type="text" id="zip_kwd" name="zip_kwd"></input>
<input type="hidden" id="ho" name="ho" value="<?php echo $ho;?>"></input>
<input type="submit" value="검색"></input>
</form>
<?php
$handle = mysql_query($sql);
while($row = mysql_fetch_array($handle)){
echo "<a href='#' onclick='in_box(\"".$row[0]."\",\"".$row[1]." ".$row[2]." ".$row[3]." ".$row[4]."\",".$ho.");'>".$row[0]."</a> ".$row[1]." ".$row[2]." ".$row[3]." ".$row[4]."<br />";
}
?>
<script>
// if(opener.name==""){
// self.close();
// }else{
// }
var op=opener.document.getElementById("OFFI_POST");
var hp=opener.document.getElementById("HOME_POST");
var oa=opener.document.getElementById("OFFI_ADDR");
var ha=opener.document.getElementById("HOME_ADDR");
function in_box(zip, addr, ho){
if(ho==1){
//oa.value = addr;
op.value = zip;
}else{
//ha.value = addr;
hp.value = zip;
}
self.close();
}
</script>
</body>
</html>