source: temp/trunk/html/input_zip.php @ 1328

Revision 1328, 1.8 KB checked in by naka, 20 years ago (diff)

* empty log message *

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1<?php
2require_once("./require.php");
3
4class LC_Page {
5    var $tpl_state;
6    var $tpl_city;
7    var $tpl_town;
8    var $tpl_onload;
9    var $tpl_message;
10    function CPage() {
11        $this->tpl_message = "½»½ê¤ò¸¡º÷¤·¤Æ¤¤¤Þ¤¹¡£";
12    }
13}
14
15$conn = new SC_DBconn(ZIP_DSN);
16$objPage = new LC_Page();
17$objView = new SC_SiteView();
18
19// ÆþÎÏ¥¨¥é¡¼¥Á¥§¥Ã¥¯
20$arrErr = fnErrorCheck();
21
22// ÆþÎÏ¥¨¥é¡¼¤Î¾ì¹ç¤Ï½ªÎ»
23if(count($arrErr) > 0) {
24    $objPage->tpl_start = "window.close();";
25}
26
27// Í¹ÊØÈֹ渡º÷ʸºîÀ®
28$zipcode = $_GET['zip1'].$_GET['zip2'];
29$zipcode = mb_convert_kana($zipcode ,"n");
30$sqlse = "SELECT state, city, town FROM mtb_zip WHERE zipcode = ?";
31
32$data_list = $conn->getAll($sqlse, array($zipcode));
33
34// ¥¤¥ó¥Ç¥Ã¥¯¥¹¤ÈÃͤòȿž¤µ¤»¤ë¡£
35$arrREV_PREF = array_flip($arrPref);
36
37$objPage->tpl_state = $arrREV_PREF[$data_list[0]['state']];
38$objPage->tpl_city = $data_list[0]['city'];
39$town =  $data_list[0]['town'];
40/*
41    Áí̳¾Ê¤«¤é¥À¥¦¥ó¥í¡¼¥É¤·¤¿¥Ç¡¼¥¿¤ò¤½¤Î¤Þ¤Þ¥¤¥ó¥Ý¡¼¥È¤¹¤ë¤È
42    °Ê²¼¤Î¤è¤¦¤Êʸ»úÎ󤬯þ¤Ã¤Æ¤¤¤ë¤Î¤Ç  Âкö¤¹¤ë¡£
43    ¡¦¡Ê£±¢·£±£¹ÃúÌÜ¡Ë
44    ¡¦°Ê²¼¤Ë·ÇºÜ¤¬¤Ê¤¤¾ì¹ç
45*/
46$town = ereg_replace("¡Ê.*¡Ë$","",$town);
47$town = ereg_replace("°Ê²¼¤Ë·ÇºÜ¤¬¤Ê¤¤¾ì¹ç","",$town);
48$objPage->tpl_town = $town;
49
50// Í¹ÊØÈֹ椬ȯ¸«¤µ¤ì¤¿¾ì¹ç
51if(count($data_list) > 0) {
52    $func = "fnPutAddress('" . $_GET['input1'] . "','" . $_GET['input2']. "');";
53    $objPage->tpl_onload = "$func";
54    $objPage->tpl_start = "window.close();";
55} else {
56    $objPage->tpl_message = "³ºÅö¤¹¤ë½»½ê¤¬¸«¤Ä¤«¤ê¤Þ¤»¤ó¤Ç¤·¤¿¡£";
57}
58
59/* ¥Ú¡¼¥¸¤Îɽ¼¨¡¡*/
60$objView->assignobj($objPage);
61$objView->display("input_zip.tpl");
62
63/* ÆþÎÏ¥¨¥é¡¼¤Î¥Á¥§¥Ã¥¯ */
64function fnErrorCheck() {
65    // ¥¨¥é¡¼¥á¥Ã¥»¡¼¥¸ÇÛÎó¤Î½é´ü²½
66    $objErr = new SC_CheckError();
67   
68    // Í¹ÊØÈÖ¹æ
69    $objErr->doFunc( array("Í¹ÊØÈÖ¹æ1",'zip1',ZIP01_LEN ) ,array( "NUM_COUNT_CHECK" ) );
70    $objErr->doFunc( array("Í¹ÊØÈÖ¹æ2",'zip2',ZIP02_LEN ) ,array( "NUM_COUNT_CHECK" ) );
71   
72    return $objErr->arrErr;
73}
74
75?>
Note: See TracBrowser for help on using the repository browser.