source: branches/dev/html/mobile/shopping/nonmember.php @ 12487

Revision 12487, 19.1 KB checked in by nakanishi, 19 years ago (diff)
Line 
1<?php
2/*
3 * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
4 *
5 * http://www.lockon.co.jp/
6 */
7
8require_once("../require.php");
9
10class LC_Page {
11    function LC_Page() {
12        $this->tpl_mainpage = 'shopping/nonmember.tpl';        // ¥á¥¤¥ó¥Æ¥ó¥×¥ì¡¼¥È
13        $this->tpl_title .= '¤ªµÒÍ;ðÊóÆþÎÏ(1/3)';            //¡¡¥Ú¡¼¥¸¥¿¥¤¥È¥ë
14    }
15}
16
17//---- ¥Ú¡¼¥¸½é´üÀßÄê
18$CONF = sf_getBasisData();                  // ŹÊÞ´ðËܾðÊó
19$objConn = new SC_DbConn();
20$objPage = new LC_Page();
21$objView = new SC_MobileView();
22$objDate = new SC_Date(START_BIRTH_YEAR, date("Y",strtotime("now")));
23$objPage->arrPref = $arrPref;
24$objPage->arrJob = $arrJob;
25$objPage->arrReminder = $arrReminder;
26$objPage->arrYear = $objDate->getYear('', 1950);    //¡¡ÆüÉÕ¥×¥ë¥À¥¦¥óÀßÄê
27$objPage->arrMonth = $objDate->getMonth();
28$objPage->arrDay = $objDate->getDay();
29
30//SSLURLȽÄê
31if (SSLURL_CHECK == 1){
32    $ssl_url= sfRmDupSlash(MOBILE_SSL_URL.$_SERVER['REQUEST_URI']);
33    if (!ereg("^https://", $non_ssl_url)){
34        sfDispSiteError(URL_ERROR, "", false, "", true);
35    }
36}
37
38// ¥ì¥¤¥¢¥¦¥È¥Ç¥¶¥¤¥ó¤ò¼èÆÀ
39$objPage = sfGetPageLayout($objPage, false, DEF_LAYOUT);
40
41//---- ÅÐÏ¿ÍÑ¥«¥é¥àÇÛÎó
42$arrRegistColumn = array(
43                             array(  "column" => "name01", "convert" => "aKV" ),
44                             array(  "column" => "name02", "convert" => "aKV" ),
45                             array(  "column" => "kana01", "convert" => "CKV" ),
46                             array(  "column" => "kana02", "convert" => "CKV" ),
47                             array(  "column" => "zip01", "convert" => "n" ),
48                             array(  "column" => "zip02", "convert" => "n" ),
49                             array(  "column" => "pref", "convert" => "n" ),
50                             array(  "column" => "addr01", "convert" => "aKV" ),
51                             array(  "column" => "addr02", "convert" => "aKV" ),
52                             array(  "column" => "email", "convert" => "a" ),
53                             array(  "column" => "email2", "convert" => "a" ),
54                             array(  "column" => "email_mobile", "convert" => "a" ),
55                             array(  "column" => "email_mobile2", "convert" => "a" ),
56                             array(  "column" => "tel01", "convert" => "n" ),
57                             array(  "column" => "tel02", "convert" => "n" ),
58                             array(  "column" => "tel03", "convert" => "n" ),
59                             array(  "column" => "fax01", "convert" => "n" ),
60                             array(  "column" => "fax02", "convert" => "n" ),
61                             array(  "column" => "fax03", "convert" => "n" ),
62                             array(  "column" => "sex", "convert" => "n" ),
63                             array(  "column" => "job", "convert" => "n" ),
64                             array(  "column" => "birth", "convert" => "n" ),
65                             array(  "column" => "reminder", "convert" => "n" ),
66                             array(  "column" => "reminder_answer", "convert" => "aKV"),
67                             array(  "column" => "password", "convert" => "a" ),
68                             array(  "column" => "password02", "convert" => "a" ),
69                             array(  "column" => "mailmaga_flg", "convert" => "n" ),
70                         );
71
72//---- ÅÐÏ¿½ü³°ÍÑ¥«¥é¥àÇÛÎó
73//$arrRejectRegistColumn = array("year", "month", "day", "email02", "email_mobile02","password","password02","reminder","reminder_answer");
74$arrRejectRegistColumn = array("year", "month", "day");
75
76if ($_SERVER["REQUEST_METHOD"] == "POST") {
77    //-- POST¥Ç¡¼¥¿¤Î°ú¤­·Ñ¤®
78    $objPage->arrForm = $_POST;
79   
80    if($objPage->arrForm['year'] == '----') {
81        $objPage->arrForm['year'] = '';
82    }
83   
84    //$objPage->arrForm['email'] = strtolower($objPage->arrForm['email']);        // email¤Ï¤¹¤Ù¤Æ¾®Ê¸»ú¤Ç½èÍý
85   
86    //-- ÆþÎϥǡ¼¥¿¤ÎÊÑ´¹
87    $objPage->arrForm = lfConvertParam($objPage->arrForm, $arrRegistColumn);
88
89    // Ìá¤ë¥Ü¥¿¥óÍѽèÍý
90    if (!empty($_POST["return"])) {
91        switch ($_POST["mode"]) {
92        case "complete":
93            $_POST["mode"] = "set3";
94            break;
95        case "confirm":
96            $_POST["mode"] = "set2";
97            break;
98        default:
99            $_POST["mode"] = "set1";
100            break;
101        }
102    }
103
104    //--¡¡ÆþÎÏ¥¨¥é¡¼¥Á¥§¥Ã¥¯
105    if (!empty($_POST["mode"])) {
106            if ($_POST["mode"] == "set1") {
107            $objPage->arrErr = lfErrorCheck1($objPage->arrForm);
108            $objPage->tpl_mainpage = 'shopping/nonmember.tpl';
109            $objPage->tpl_title = '¤ªµÒÍ;ðÊóÆþÎÏ(1/3)';
110        } elseif ($_POST["mode"] == "set2") {
111            $objPage->arrErr = lfErrorCheck2($objPage->arrForm);
112            $objPage->tpl_mainpage = 'shopping/nonmember_set1.tpl';
113            $objPage->tpl_title = '¤ªµÒÍ;ðÊóÆþÎÏ(2/3)';
114        } else {
115            $objPage->arrErr = lfErrorCheck3($objPage->arrForm);
116            $objPage->tpl_mainpage = 'shopping/nonmember_set2.tpl';
117            $objPage->tpl_title = '¤ªµÒÍ;ðÊóÆþÎÏ(3/3)';
118        }
119   
120   foreach($objPage->arrForm as $key => $val) {
121        $objPage->$key = $val;
122        }
123 
124    }
125
126
127    if ($objPage->arrErr || !empty($_POST["return"])) {     // ÆþÎÏ¥¨¥é¡¼¤Î¥Á¥§¥Ã¥¯
128
129        //-- ¥Ç¡¼¥¿¤ÎÀßÄê
130        if ($_POST["mode"] == "set1") {
131            $checkVal = array("email", "name01", "name02", "kana01", "kana02");
132        } elseif ($_POST["mode"] == "set2") {
133            $checkVal = array("sex", "year", "month", "day", "zip01", "zip02");
134        } else {
135            $checkVal = array("pref", "addr01", "addr02", "tel01", "tel02", "tel03", "mail_flag");
136        }
137
138        foreach($objPage->arrForm as $key => $val) {
139            if ($key != "mode" && $key != "submit" && $key != "return" && $key != session_name() && !in_array($key, $checkVal))
140                $objPage->list_data[ $key ] = $val;
141        }
142
143
144
145    } else {
146
147        //--¡¡¥Æ¥ó¥×¥ì¡¼¥ÈÀßÄê
148        if ($_POST["mode"] == "set1") {
149            $objPage->tpl_mainpage = 'shopping/nonmember_set1.tpl';
150            $objPage->tpl_title = '¤ªµÒÍ;ðÊóÆþÎÏ(2/3)';
151        } elseif ($_POST["mode"] == "set2") {
152            $objPage->tpl_mainpage = 'shopping/nonmember_set2.tpl';
153            $objPage->tpl_title = '¤ªµÒÍ;ðÊóÆþÎÏ(3/3)';
154
155            if (@$objPage->arrForm['pref'] == "" && @$objPage->arrForm['addr01'] == "" && @$objPage->arrForm['addr02'] == "") {
156                $address = lfGetAddress($_REQUEST['zip01'].$_REQUEST['zip02']);
157                $objPage->pref = @$address[0]['state'];
158                $objPage->addr01 = @$address[0]['city'] . @$address[0]['town'];
159            }
160        } /*elseif ($_POST["mode"] == "deliv") {
161            //¥Ñ¥¹¥ï¡¼¥Éɽ¼¨
162           
163            //¥á¡¼¥ë¼õ¤±¼è¤ê
164            if (strtolower($objPage->arrForm['mail_flag']) == "on") {
165                $objPage->arrForm['mail_flag']  = "2";
166            } else {
167                $objPage->arrForm['mail_flag']  = "3";
168            }
169
170            $objPage->tpl_mainpage = 'shopping/deliv.tpl';
171            $objPage->tpl_title = '¤ªµÒÍ;ðÊó(³Îǧ¥Ú¡¼¥¸)';
172
173        }*/
174
175        //-- ¥Ç¡¼¥¿ÀßÄê
176        unset($objPage->list_data);
177        if ($_POST["mode"] == "set1") {
178            $checkVal = array("sex", "year", "month", "day", "zip01", "zip02");
179        } elseif ($_POST["mode"] == "set2") {
180            $checkVal = array("pref", "addr01", "addr02", "tel01", "tel02", "tel03", "mail_flag");
181        } else {
182            $checkVal = array();
183        }
184
185        foreach($objPage->arrForm as $key => $val) {
186            if ($key != "mode" && $key != "submit" && $key != "confirm" && $key != "return" && $key != session_name() && !in_array($key, $checkVal)) {
187                $objPage->list_data[ $key ] = $val;
188            }
189        }
190
191        if ($_POST["mode"] == "deliv") {
192           
193            $objFormParam = new SC_FormParam();
194            // ¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½
195           
196            // POSTÃͤμèÆÀ
197            $objFormParam->setParam($_POST);
198           
199            // ÆþÎÏÃͤμèÆÀ
200            $objPage->arrForm = $objFormParam->getFormParamList();
201            $objPage->arrErr = $arrErr;
202           
203//            $cnt = 1;
204//            foreach($objOtherAddr as $val) {
205//                $objPage->arrAddr[$cnt] = $val;
206//                $cnt++;
207//            }
208           
209           $objPage->arrAddr['zip01'] = $objPage->zip01;
210           //$objPage->arrAddr = $objPage->zip01;
211           //$objPage->arrAddr[2] = $objPage->pref;
212           //$objPage->arrAddr[3] = $objPage->pref;
213            //print($objPage->zip01.$objPage->zip02);
214           
215            $objPage->tpl_mainpage = 'shopping/deliv.tpl';
216            $objPage->tpl_title = '¤ªÆÏ¤±Àè¾ðÊó';
217        }
218       
219        //--¡¡²¾ÅÐÏ¿¤È´°Î»²èÌÌ
220        if ($_POST["mode"] == "complete") {
221            //$objPage->uniqid = lfRegistData ($objPage->arrForm, $arrRegistColumn, $arrRejectRegistColumn);
222
223            // ¶õ¥á¡¼¥ë¤ò¼õ¿®ºÑ¤ß¤Î¾ì¹ç¤Ï¤¹¤°¤ËËÜÅÐÏ¿´°Î»¤Ë¤¹¤ë¡£
224            if (isset($_SESSION['mobile']['kara_mail_from'])) {
225                header("Location:" . gfAddSessionId(MOBILE_URL_DIR . "regist/index.php?mode=regist&id=" . $objPage->uniqid));
226                exit;
227            }
228
229            $objPage->tpl_mainpage = 'shopping/complete.tpl';
230            $objPage->tpl_title = '¤ªµÒÍ;ðÊóÆþÎÏ(´°Î»¥Ú¡¼¥¸)';
231
232            /*sfMobileSetExtSessionId('id', $objPage->uniqid, 'regist/index.php');
233
234            //¡¡²¾ÅÐÏ¿´°Î»¥á¡¼¥ëÁ÷¿®
235            $objPage->CONF = $CONF;
236            $objPage->to_name01 = $_POST['name01'];
237            $objPage->to_name02 = $_POST['name02'];
238            $objMailText = new SC_MobileView();
239            $objMailText->assignobj($objPage);
240            $subject = sfMakesubject('¤ªµÒÍ;ðÊó¤Î¤´³Îǧ');
241            $toCustomerMail = $objMailText->fetch("mail_templates/customer_mail.tpl");
242            $objMail = new GC_SendMail();
243            $objMail->setItem(
244                                ''                                  //¡¡°¸Àè
245                                , $subject                          //¡¡¥µ¥Ö¥¸¥§¥¯¥È
246                                , $toCustomerMail                   //¡¡ËÜʸ
247                                , $CONF["email03"]                  //¡¡ÇÛÁ÷¸µ¥¢¥É¥ì¥¹
248                                , $CONF["shop_name"]                //¡¡ÇÛÁ÷¸µ¡¡Ì¾Á°
249                                , $CONF["email03"]                  //¡¡reply_to
250                                , $CONF["email04"]                  //¡¡return_path
251                                , $CONF["email04"]                  //  Errors_to
252                                , $CONF["email01"]                  //  Bcc
253                                                                );
254            // °¸Àè¤ÎÀßÄê
255            $name = $_POST["name01"] . $_POST["name02"] ." ÍÍ";
256            $objMail->setTo($_POST["email"], $name);
257            $objMail->sendMail();
258*/
259            // ´°Î»¥Ú¡¼¥¸¤Ë°Üư¤µ¤»¤ë¡£
260            header("Location:" . gfAddSessionId("./complete.php"));
261            exit;
262        }
263    }
264}
265
266//----¡¡¥Ú¡¼¥¸É½¼¨
267$objView->assignobj($objPage);
268$objView->display(SITE_FRAME);
269
270//----------------------------------------------------------------------------------------------------------------------
271
272//---- function·²
273function lfRegistData ($array, $arrRegistColumn, $arrRejectRegistColumn) {
274    global $objConn;
275
276    // ²¾ÅÐÏ¿
277    foreach ($arrRegistColumn as $data) {
278        if (strlen($array[ $data["column"] ]) > 0 && ! in_array($data["column"], $arrRejectRegistColumn)) {
279            $arrRegist[ $data["column"] ] = $array[ $data["column"] ];
280        }
281    }
282       
283    // ÃÂÀ¸Æü¤¬ÆþÎϤµ¤ì¤Æ¤¤¤ë¾ì¹ç
284    if (strlen($array["year"]) > 0 ) {
285        $arrRegist["birth"] = $array["year"] ."/". $array["month"] ."/". $array["day"] ." 00:00:00";
286    }
287   
288    // ¥Ñ¥¹¥ï¡¼¥É¤Î°Å¹æ²½
289    $arrRegist["password"] = sha1($arrRegist["password"] . ":" . AUTH_MAGIC);
290   
291    $count = 1;
292    while ($count != 0) {
293        $uniqid = sfGetUniqRandomId("t");
294        $count = $objConn->getOne("SELECT COUNT(*) FROM dtb_customer WHERE secret_key = ?", array($uniqid));
295    }
296
297    switch($array["mailmaga_flg"]) {
298        case 1:
299            $arrRegist["mailmaga_flg"] = 4;
300            break;
301        case 2:
302            $arrRegist["mailmaga_flg"] = 5;
303            break;
304        default:
305            $arrRegist["mailmaga_flg"] = 6;
306            break;
307    }
308       
309    $arrRegist["secret_key"] = $uniqid;     // ²¾ÅÐÏ¿IDȯ¹Ô
310    $arrRegist["create_date"] = "now()";    // ºîÀ®Æü
311    $arrRegist["update_date"] = "now()";    // ¹¹¿·Æü
312    $arrRegist["first_buy_date"] = "";      // ºÇ½é¤Î¹ØÆþÆü
313   
314    // ·ÈÂӥ᡼¥ë¥¢¥É¥ì¥¹
315    $arrRegist['email_mobile'] = $arrRegist['email'];
316
317    //-- ²¾ÅÐÏ¿¼Â¹Ô
318    $objConn->query("BEGIN");
319
320    $objQuery = new SC_Query();
321    $objQuery->insert("dtb_customer", $arrRegist);
322
323/* ¥á¥ë¥Þ¥¬²ñ°÷µ¡Ç½¤Ï¸½ºßÄä»ßÃæ¡¡2007/03/07
324    //--¡¡Èó²ñ°÷¤Ç¥á¥ë¥Þ¥¬ÅÐÏ¿¤·¤Æ¤¤¤ë¤«¤ÎȽÄê
325    $sql = "SELECT count(*) FROM dtb_customer_mail WHERE email = ?";
326    $mailResult = $objConn->getOne($sql, array($arrRegist["email"]));
327
328    //--¡¡¥á¥ë¥Þ¥¬²¾ÅÐÏ¿¼Â¹Ô
329    $arrRegistMail["email"] = $arrRegist["email"]; 
330    if ($array["mailmaga_flg"] == 1) {
331        $arrRegistMail["mailmaga_flg"] = 4;
332    } elseif ($array["mailmaga_flg"] == 2) {
333        $arrRegistMail["mailmaga_flg"] = 5;
334    } else {
335        $arrRegistMail["mailmaga_flg"] = 6;
336    }
337    $arrRegistMail["update_date"] = "now()";
338   
339    // Èó²ñ°÷¤Ç¥á¥ë¥Þ¥¬ÅÐÏ¿¤·¤Æ¤¤¤ë¾ì¹ç
340    if ($mailResult == 1) {     
341        $objQuery->update("dtb_customer_mail", $arrRegistMail, "email = '" .addslashes($arrRegistMail["email"]). "'");         
342    } else {                //¡¡¿·µ¬ÅÐÏ¿¤Î¾ì¹ç
343        $arrRegistMail["create_date"] = "now()";
344        $objQuery->insert("dtb_customer_mail", $arrRegistMail);     
345    }
346*/
347    $objConn->query("COMMIT");
348
349    return $uniqid;
350}
351
352//----¡¡¼èÆÀʸ»úÎó¤ÎÊÑ´¹
353function lfConvertParam($array, $arrRegistColumn) {
354    /*
355     *  ʸ»úÎó¤ÎÊÑ´¹
356     *  K :  ¡ÖȾ³Ñ(ŽÊŽÝ޶ޏ)ÊÒ²¾Ì¾¡×¤ò¡ÖÁ´³ÑÊÒ²¾Ì¾¡×¤ËÊÑ´¹
357     *  C :  ¡ÖÁ´³Ñ¤Ò¤é²¾Ì¾¡×¤ò¡ÖÁ´³Ñ¤«¤¿²¾Ì¾¡×¤ËÊÑ´¹
358     *  V :  ÂùÅÀÉÕ¤­¤Îʸ»ú¤ò°ìʸ»ú¤ËÊÑ´¹¡£"K","H"¤È¶¦¤Ë»ÈÍѤ·¤Þ¤¹
359     *  n :  ¡ÖÁ´³Ñ¡×¿ô»ú¤ò¡ÖȾ³Ñ(ŽÊŽÝ޶ޏ)¡×¤ËÊÑ´¹
360     *  a :  Á´³Ñ±Ñ¿ô»ú¤òȾ³Ñ±Ñ¿ô»ú¤ËÊÑ´¹¤¹¤ë
361     */
362    // ¥«¥é¥à̾¤È¥³¥ó¥Ð¡¼¥È¾ðÊó
363    foreach ($arrRegistColumn as $data) {
364        $arrConvList[ $data["column"] ] = $data["convert"];
365    }
366    // ʸ»úÊÑ´¹
367    foreach ($arrConvList as $key => $val) {
368        // POST¤µ¤ì¤Æ¤­¤¿ÃͤΤßÊÑ´¹¤¹¤ë¡£
369        if(strlen(($array[$key])) > 0) {
370            $array[$key] = mb_convert_kana($array[$key] ,$val);
371        }
372    }
373    return $array;
374}
375
376//---- ÆþÎÏ¥¨¥é¡¼¥Á¥§¥Ã¥¯
377function lfErrorCheck1($array) {
378
379    global $objConn;
380    $objErr = new SC_CheckError($array);
381   
382    $objErr->doFunc(array("¤ªÌ¾Á°¡ÊÀ«¡Ë", 'name01', STEXT_LEN), array("EXIST_CHECK", "NO_SPTAB", "SPTAB_CHECK" ,"MAX_LENGTH_CHECK"));
383    $objErr->doFunc(array("¤ªÌ¾Á°¡Ê̾¡Ë", 'name02', STEXT_LEN), array("EXIST_CHECK", "NO_SPTAB", "SPTAB_CHECK" , "MAX_LENGTH_CHECK"));
384    $objErr->doFunc(array("¤ªÌ¾Á°¡Ê¥«¥Ê/À«¡Ë", 'kana01', STEXT_LEN), array("EXIST_CHECK", "NO_SPTAB", "SPTAB_CHECK" ,"MAX_LENGTH_CHECK", "KANA_CHECK"));
385    $objErr->doFunc(array("¤ªÌ¾Á°¡Ê¥«¥Ê/̾¡Ë", 'kana02', STEXT_LEN), array("EXIST_CHECK", "NO_SPTAB", "SPTAB_CHECK" ,"MAX_LENGTH_CHECK", "KANA_CHECK"));
386    $objErr->doFunc(array('¥á¡¼¥ë¥¢¥É¥ì¥¹', "email", MTEXT_LEN) ,array("NO_SPTAB", "EXIST_CHECK", "EMAIL_CHECK", "SPTAB_CHECK" ,"EMAIL_CHAR_CHECK", "MAX_LENGTH_CHECK", "MOBILE_EMAIL_CHECK"));
387
388    //¸½²ñ°÷¤ÎȽÄê ¢ª¡¡¸½²ñ°÷¤â¤·¤¯¤Ï²¾ÅÐÏ¿Ãæ¤Ï¡¢¥á¥¢¥É°ì°Õ¤¬Á°Äó¤Ë¤Ê¤Ã¤Æ¤ë¤Î¤ÇƱ¤¸¥á¥¢¥É¤ÇÅÐÏ¿ÉÔ²Ä
389
390    return $objErr->arrErr;
391}
392
393//---- ÆþÎÏ¥¨¥é¡¼¥Á¥§¥Ã¥¯
394function lfErrorCheck2($array) {
395
396    global $objConn, $objDate;
397    $objErr = new SC_CheckError($array);
398   
399    $objErr->doFunc(array("Í¹ÊØÈÖ¹æ1", "zip01", ZIP01_LEN ) ,array("EXIST_CHECK", "SPTAB_CHECK" ,"NUM_CHECK", "NUM_COUNT_CHECK"));
400    $objErr->doFunc(array("Í¹ÊØÈÖ¹æ2", "zip02", ZIP02_LEN ) ,array("EXIST_CHECK", "SPTAB_CHECK" ,"NUM_CHECK", "NUM_COUNT_CHECK"));
401    $objErr->doFunc(array("Í¹ÊØÈÖ¹æ", "zip01", "zip02"), array("ALL_EXIST_CHECK"));
402
403    $objErr->doFunc(array("À­ÊÌ", "sex") ,array("SELECT_CHECK", "NUM_CHECK"));
404    $objErr->doFunc(array("À¸Ç¯·îÆü (ǯ)", "year", 4), array("EXIST_CHECK", "SPTAB_CHECK", "NUM_CHECK", "NUM_COUNT_CHECK"));
405    if (!isset($objErr->arrErr['year'])) {
406        $objErr->doFunc(array("À¸Ç¯·îÆü (ǯ)", "year", $objDate->getStartYear()), array("MIN_CHECK"));
407        $objErr->doFunc(array("À¸Ç¯·îÆü (ǯ)", "year", $objDate->getEndYear()), array("MAX_CHECK"));
408    }
409    $objErr->doFunc(array("À¸Ç¯·îÆü (·îÆü)", "month", "day"), array("SELECT_CHECK"));
410    if (!isset($objErr->arrErr['year']) && !isset($objErr->arrErr['month']) && !isset($objErr->arrErr['day'])) {
411        $objErr->doFunc(array("À¸Ç¯·îÆü", "year", "month", "day"), array("CHECK_DATE"));
412    }
413   
414    return $objErr->arrErr;
415}
416
417//---- ÆþÎÏ¥¨¥é¡¼¥Á¥§¥Ã¥¯
418function lfErrorCheck3($array) {
419
420    global $objConn;
421    $objErr = new SC_CheckError($array);
422   
423    $objErr->doFunc(array("ÅÔÆ»Éܸ©", 'pref'), array("SELECT_CHECK","NUM_CHECK"));
424    $objErr->doFunc(array("»Ô¶èĮ¼", "addr01", MTEXT_LEN), array("EXIST_CHECK","SPTAB_CHECK" ,"MAX_LENGTH_CHECK"));
425    $objErr->doFunc(array("ÈÖÃÏ", "addr02", MTEXT_LEN), array("EXIST_CHECK","SPTAB_CHECK" ,"MAX_LENGTH_CHECK"));
426    $objErr->doFunc(array("ÅÅÏÃÈÖ¹æ1", 'tel01'), array("EXIST_CHECK","SPTAB_CHECK" ));
427    $objErr->doFunc(array("ÅÅÏÃÈÖ¹æ2", 'tel02'), array("EXIST_CHECK","SPTAB_CHECK" ));
428    $objErr->doFunc(array("ÅÅÏÃÈÖ¹æ3", 'tel03'), array("EXIST_CHECK","SPTAB_CHECK" ));
429    $objErr->doFunc(array("ÅÅÏÃÈÖ¹æ", "tel01", "tel02", "tel03",TEL_ITEM_LEN) ,array("TEL_CHECK"));
430   
431    return $objErr->arrErr;
432}
433
434//³Îǧ¥Ú¡¼¥¸Íѥѥ¹¥ï¡¼¥Éɽ¼¨ÍÑ
435
436function lfPassLen($passlen){
437    $ret = "";
438    for ($i=0;$i<$passlen;true){
439    $ret.="*";
440    $i++;
441    }
442    return $ret;
443}
444
445
446// Í¹ÊØÈֹ椫¤é½»½ê¤Î¼èÆÀ
447function lfGetAddress($zipcode) {
448    global $arrPref;
449
450    $conn = new SC_DBconn(ZIP_DSN);
451
452    // Í¹ÊØÈֹ渡º÷ʸºîÀ®
453    $zipcode = mb_convert_kana($zipcode ,"n");
454    $sqlse = "SELECT state, city, town FROM mtb_zip WHERE zipcode = ?";
455
456    $data_list = $conn->getAll($sqlse, array($zipcode));
457
458    // ¥¤¥ó¥Ç¥Ã¥¯¥¹¤ÈÃͤòȿž¤µ¤»¤ë¡£
459    $arrREV_PREF = array_flip($arrPref);
460
461    /*
462        Áí̳¾Ê¤«¤é¥À¥¦¥ó¥í¡¼¥É¤·¤¿¥Ç¡¼¥¿¤ò¤½¤Î¤Þ¤Þ¥¤¥ó¥Ý¡¼¥È¤¹¤ë¤È
463        °Ê²¼¤Î¤è¤¦¤Êʸ»úÎ󤬯þ¤Ã¤Æ¤¤¤ë¤Î¤Ç   Âкö¤¹¤ë¡£
464        ¡¦¡Ê£±¡¦£±£¹ÃúÌÜ¡Ë
465        ¡¦°Ê²¼¤Ë·ÇºÜ¤¬¤Ê¤¤¾ì¹ç
466    */
467    $town =  $data_list[0]['town'];
468    $town = ereg_replace("¡Ê.*¡Ë$","",$town);
469    $town = ereg_replace("°Ê²¼¤Ë·ÇºÜ¤¬¤Ê¤¤¾ì¹ç","",$town);
470    $data_list[0]['town'] = $town;
471    $data_list[0]['state'] = $arrREV_PREF[$data_list[0]['state']];
472
473    return $data_list;
474}
475
476//-----------------------------------------------------------------------------------------------------------------------------------
477?>
Note: See TracBrowser for help on using the repository browser.