source: branches/dev/html/input_zip_json.php @ 12999

Revision 12999, 1.7 KB checked in by nakanishi, 15 years ago (diff)
Line 
1<?php
2/*
3 * Copyright(c) 2000-2007 LOCKON CO.,LTD. All Rights Reserved.
4 *
5 * http://www.lockon.co.jp/
6 */
7
8require_once("./require.php");
9//header("Content-Type: text/json; charset=euc-jp");
10
11
12$conn = new SC_DBconn(ZIP_DSN);
13$objPage = new LC_Page();
14$objView = new SC_SiteView(false);
15
16// ÆþÎÏ¥¨¥é¡¼¥Á¥§¥Ã¥¯
17$arrErr = fnErrorCheck();
18
19// ÆþÎÏ¥¨¥é¡¼¤Î¾ì¹ç¤Ï½ªÎ»
20if(count($arrErr) == 0) {
21
22// ͹ÊØÈֹ渡º÷ʸºîÀ®
23$zipcode = $_GET['zip1'].$_GET['zip2'];
24$zipcode = mb_convert_kana($zipcode ,"n");
25$sqlse = "SELECT state, city, town FROM mtb_zip WHERE zipcode = ?";
26
27$data_list = $conn->getAll($sqlse, array($zipcode));
28
29// ¥¤¥ó¥Ç¥Ã¥¯¥¹¤ÈÃͤòȿž¤µ¤»¤ë¡£
30$arrREV_PREF = array_flip($arrPref);
31
32$state = $arrREV_PREF[$data_list[0]['state']];
33$city = $data_list[0]['city'];
34$town =  $data_list[0]['town'];
35/*
36    Áí̳¾Ê¤«¤é¥À¥¦¥ó¥í¡¼¥É¤·¤¿¥Ç¡¼¥¿¤ò¤½¤Î¤Þ¤Þ¥¤¥ó¥Ý¡¼¥È¤¹¤ë¤È
37    °Ê²¼¤Î¤è¤¦¤Êʸ»úÎó¤¬Æþ¤Ã¤Æ¤¤¤ë¤Î¤Ç  Âкö¤¹¤ë¡£
38    ¡¦¡Ê£±¢·£±£¹ÃúÌÜ¡Ë
39    ¡¦°Ê²¼¤Ë·ÇºÜ¤¬¤Ê¤¤¾ì¹ç
40*/
41$town = ereg_replace("¡Ê.*¡Ë$","",$town);
42$town = ereg_replace("°Ê²¼¤Ë·ÇºÜ¤¬¤Ê¤¤¾ì¹ç","",$town);
43
44// ͹ÊØÈֹ椬ȯ¸«¤µ¤ì¤¿¾ì¹ç
45if(count($data_list) > 0) {
46    echo "{ 'POST' : 'test' , 'GET' : 'test' }";
47    //$func = "fnPutAddress('" . $_GET['input1'] . "','" . $_GET['input2']. "');";
48    //$objPage->tpl_onload = "$func";
49    //$objPage->tpl_start = "window.close();";
50} else {
51    echo "{'MSG':'½»½ê¤¬¸«¤Ä¤«¤ê¤Þ¤»¤ó¤Ç¤·¤¿¡£'}";
52    }
53}
54/* ÆþÎÏ¥¨¥é¡¼¤Î¥Á¥§¥Ã¥¯ */
55function fnErrorCheck() {
56    // ¥¨¥é¡¼¥á¥Ã¥»¡¼¥¸ÇÛÎó¤Î½é´ü²½
57    $objErr = new SC_CheckError();
58   
59    // ͹ÊØÈÖ¹æ
60    $objErr->doFunc( array("͹ÊØÈÖ¹æ1",'zip1',ZIP01_LEN ) ,array( "NUM_COUNT_CHECK" ) );
61    $objErr->doFunc( array("͹ÊØÈÖ¹æ2",'zip2',ZIP02_LEN ) ,array( "NUM_COUNT_CHECK" ) );
62   
63    return $objErr->arrErr;
64}
65
66?>
Note: See TracBrowser for help on using the repository browser.