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

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