source: branches/dev/html/mobile/nonmember/index.php @ 12752

Revision 12752, 27.3 KB checked in by nakanishi, 15 years ago (diff)
Line 
1<?php
2/**
3 *
4 * Copyright(c) 2000-2007 LOCKON CO.,LTD. All Rights Reserved.
5 *
6 * http://www.lockon.co.jp/
7 *
8 */
9
10require_once("../require.php");
11
12class LC_Page {
13    var $arrSession;
14    var $tpl_mode;
15    var $tpl_login_email;
16    function LC_Page() {
17        $this->tpl_mainpage = 'nonmember/index.tpl';
18        global $arrPref;
19        $this->arrPref = $arrPref;
20        global $arrSex;
21        $this->arrSex = $arrSex;
22        global $arrJob;
23        $this->arrJob = $arrJob;
24        $this->tpl_onload = 'fnCheckInputDeliv();';
25       
26        /*
27         session_start»þ¤Îno-cache¥Ø¥Ã¥À¡¼¤òÍÞÀ©¤¹¤ë¤³¤È¤Ç
28         ¡ÖÌá¤ë¡×¥Ü¥¿¥ó»ÈÍÑ»þ¤ÎÍ­¸ú´ü¸ÂÀÚ¤ìɽ¼¨¤òÍÞÀ©¤¹¤ë¡£
29         private-no-expire:¥¯¥é¥¤¥¢¥ó¥È¤Î¥­¥ã¥Ã¥·¥å¤òµö²Ä¤¹¤ë¡£
30        */
31        session_cache_limiter('private-no-expire');             
32    }
33}
34
35$conn = new SC_DBConn();
36$objPage = new LC_Page();
37$objView = new SC_MobileView();
38$objSiteSess = new SC_SiteSession();
39$objCartSess = new SC_CartSession();
40$objCustomer = new SC_Customer();
41$objCookie = new SC_Cookie();
42$objFormParam = new SC_FormParam();         // ¥Õ¥©¡¼¥àÍÑ
43lfInitParam();                              // ¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½
44$objFormParam->setParam($_POST);            // POSTÃͤμèÆÀ
45
46
47//-------------------------------------¢§NONMEMBER----------------------------------------------
48//---- ¥Ú¡¼¥¸½é´üÀßÄê
49
50$CONF = sf_getBasisData();                  // ŹÊÞ´ðËܾðÊó
51$objView = new SC_MobileView();
52$objDate = new SC_Date(START_BIRTH_YEAR, date("Y",strtotime("now")));
53$objPage->arrPref = $arrPref;
54$objPage->arrJob = $arrJob;
55$objPage->arrReminder = $arrReminder;
56$objPage->arrYear = $objDate->getYear('', 1950);    //¡¡ÆüÉÕ¥×¥ë¥À¥¦¥óÀßÄê
57$objPage->arrMonth = $objDate->getMonth();
58$objPage->arrDay = $objDate->getDay();
59
60//SSLURLȽÄê
61if (SSLURL_CHECK == 1){
62    $ssl_url= sfRmDupSlash(MOBILE_SSL_URL.$_SERVER['REQUEST_URI']);
63    if (!ereg("^https://", $non_ssl_url)){
64        sfDispSiteError(URL_ERROR, "", false, "", true);
65    }
66}
67
68// ¥ì¥¤¥¢¥¦¥È¥Ç¥¶¥¤¥ó¤ò¼èÆÀ
69$objPage = sfGetPageLayout($objPage, false, DEF_LAYOUT);
70
71// ¥æ¡¼¥¶¥æ¥Ë¡¼¥¯ID¤Î¼èÆÀ¤È¹ØÆþ¾õÂÖ¤ÎÀµÅöÀ­¤ò¥Á¥§¥Ã¥¯
72$uniqid = sfCheckNormalAccess($objSiteSess, $objCartSess);
73
74$objPage->tpl_uniqid = $uniqid;
75
76switch($_POST['mode']) {
77case 'nonmember_confirm':
78    $objPage = lfSetNonMember($objPage);
79    // ¢¨break¤Ê¤·
80case 'confirm':
81    // ÆþÎÏÃͤÎÊÑ´¹
82    $objFormParam->convParam();
83    $objFormParam->toLower('order_mail');
84    $objFormParam->toLower('order_mail_check');
85   
86    $objPage->arrErr = lfCheckError();
87
88    // ÆþÎÏ¥¨¥é¡¼¤Ê¤·
89    if(count($objPage->arrErr) == 0) {
90        // DB¤Ø¤Î¥Ç¡¼¥¿ÅÐÏ¿
91        lfRegistData($uniqid);
92        // Àµ¾ï¤ËÅÐÏ¿¤µ¤ì¤¿¤³¤È¤òµ­Ï¿¤·¤Æ¤ª¤¯
93        $objSiteSess->setRegistFlag();
94        // ¤ª»Ùʧ¤¤ÊýË¡ÁªÂò¥Ú¡¼¥¸¤Ø°ÜÆ°
95        header("Location: " . gfAddSessionId(MOBILE_URL_SHOP_PAYMENT));
96        exit;       
97    }
98   
99    break;
100// Á°¤Î¥Ú¡¼¥¸¤ËÌá¤ë
101case 'return':
102    // ³Îǧ¥Ú¡¼¥¸¤Ø°ÜÆ°
103    header("Location: " . gfAddSessionId(MOBILE_URL_CART_TOP));
104    exit;
105    break;
106case 'nonmember':
107    $objPage = lfSetNonMember($objPage);
108    // ¢¨break¤Ê¤·
109default:
110    if($_GET['from'] == 'nonmember') {
111        $objPage = lfSetNonMember($objPage);
112    }
113    // ¥æ¡¼¥¶¥æ¥Ë¡¼¥¯ID¤Î¼èÆÀ
114    $uniqid = $objSiteSess->getUniqId();
115    $objQuery = new SC_Query();
116    $where = "order_temp_id = ?";
117    $arrRet = $objQuery->select("*", "dtb_order_temp", $where, array($uniqid));
118    // DBÃͤμèÆÀ
119    $objFormParam->setParam($arrRet[0]);
120    $objFormParam->setValue('order_email_check', $arrRet[0]['order_email']);
121    $objFormParam->setDBDate($arrRet[0]['order_birth']);
122    break;
123}
124
125// ¥¯¥Ã¥­¡¼È½Äê
126$objPage->tpl_login_email = $objCookie->getCookie('login_email');
127if($objPage->tpl_login_email != "") {
128    $objPage->tpl_login_memory = "1";
129}
130
131// ÁªÂòÍÑÆüÉդμèÆÀ
132$objDate = new SC_Date(START_BIRTH_YEAR);
133$objPage->arrYear = $objDate->getYear('', 1950);    //¡¡ÆüÉÕ¥×¥ë¥À¥¦¥óÀßÄê
134$objPage->arrMonth = $objDate->getMonth();
135$objPage->arrDay = $objDate->getDay();
136
137
138
139// ÆþÎÏÃͤμèÆÀ
140$objPage->arrForm = $objFormParam->getFormParamList();
141
142$objView->assignobj($objPage);
143$objView->display(SITE_FRAME);
144
145//--------------------------------------------------------------------------------------------------------------------------
146/* Èó²ñ°÷ÆþÎÏ¥Ú¡¼¥¸¤Î¥»¥Ã¥È */
147function lfSetNonMember($objPage) {
148   
149    $arrRegistColumn = array(
150                             array(  "column" => "name01", "convert" => "aKV" ),
151                             array(  "column" => "name02", "convert" => "aKV" ),
152                             array(  "column" => "kana01", "convert" => "CKV" ),
153                             array(  "column" => "kana02", "convert" => "CKV" ),
154                             array(  "column" => "zip01", "convert" => "n" ),
155                             array(  "column" => "zip02", "convert" => "n" ),
156                             array(  "column" => "pref", "convert" => "n" ),
157                             array(  "column" => "addr01", "convert" => "aKV" ),
158                             array(  "column" => "addr02", "convert" => "aKV" ),
159                             array(  "column" => "email", "convert" => "a" ),
160                             array(  "column" => "email2", "convert" => "a" ),
161                             array(  "column" => "email_mobile", "convert" => "a" ),
162                             array(  "column" => "email_mobile2", "convert" => "a" ),
163                             array(  "column" => "tel01", "convert" => "n" ),
164                             array(  "column" => "tel02", "convert" => "n" ),
165                             array(  "column" => "tel03", "convert" => "n" ),
166                             array(  "column" => "fax01", "convert" => "n" ),
167                             array(  "column" => "fax02", "convert" => "n" ),
168                             array(  "column" => "fax03", "convert" => "n" ),
169                             array(  "column" => "sex", "convert" => "n" ),
170                             array(  "column" => "job", "convert" => "n" ),
171                             array(  "column" => "birth", "convert" => "n" ),
172                             array(  "column" => "reminder", "convert" => "n" ),
173                             array(  "column" => "reminder_answer", "convert" => "aKV"),
174                             array(  "column" => "password", "convert" => "a" ),
175                             array(  "column" => "password02", "convert" => "a" ),
176                             array(  "column" => "mailmaga_flg", "convert" => "n" ),
177                         );
178
179//---- ÅÐÏ¿½ü³°ÍÑ¥«¥é¥àÇÛÎó
180//$arrRejectRegistColumn = array("year", "month", "day", "email02", "email_mobile02","password","password02","reminder","reminder_answer");
181$arrRejectRegistColumn = array("year", "month", "day", "email02", "email_mobile02", "password02");
182       
183    $objPage->tpl_mainpage = 'nonmember/nonmember_set1.tpl';
184    $objPage->tpl_css = array();
185    $objPage->tpl_css[] = '/css/layout/login/nonmember.css';
186   
187    //-- POST¥Ç¡¼¥¿¤Î°ú¤­·Ñ¤®
188    $objPage->arrForm = $_POST;
189   
190    if($objPage->arrForm['year'] == '----') {
191        $objPage->arrForm['year'] = '';
192    }
193   
194    //$objPage->arrForm['email'] = strtolower($objPage->arrForm['email']);        // email¤Ï¤¹¤Ù¤Æ¾®Ê¸»ú¤Ç½èÍý
195   
196    //-- ÆþÎϥǡ¼¥¿¤ÎÊÑ´¹
197    $objPage->arrForm = lfConvertParam($objPage->arrForm, $arrRegistColumn);
198
199    // Ìá¤ë¥Ü¥¿¥óÍѽèÍý
200    //return¤ÎÃæ¤Ë¸µ¤Î¥Ú¡¼¥¸¤Î̾Á°¤¬Æþ¤Ã¤Æ¤¤¤ë
201    if (!empty($_POST["return"])) {
202        switch ($_POST["mode2"]) {
203        case "deliv_date": 
204       
205            break;
206        case "deliv":
207            $_POST["mode2"] = "set3";
208            break;
209        case "set3":
210            $_POST["mode2"] = "set2";
211            break;
212        default:
213            $_POST["mode2"] = "set1";
214            break;
215        }
216    }   
217
218    //--¡¡ÆþÎÏ¥¨¥é¡¼¥Á¥§¥Ã¥¯
219    if (!empty($_POST["mode2"])) {
220            if ($_POST["mode2"] == "set2") {
221            $objPage->arrErr = lfErrorCheck1($objPage->arrForm);
222            $objPage->tpl_mainpage = 'nonmember/nonmember_set1.tpl';
223            $objPage->tpl_title = '¤ªµÒÍ;ðÊóÆþÎÏ(1/3)';
224        } elseif ($_POST["mode2"] == "set3") {
225           
226            $objPage->arrErr = lfErrorCheck2($objPage->arrForm);
227            $objPage->tpl_mainpage = 'nonmember/nonmember_set2.tpl';
228            $objPage->tpl_title = '¤ªµÒÍ;ðÊóÆþÎÏ(2/3)';
229        } elseif ($_POST["mode2"] == "deliv"){
230            $objPage->arrErr = lfErrorCheck3($objPage->arrForm);
231            $objPage->tpl_mainpage = 'nonmember/nonmember_set3.tpl';
232            $objPage->tpl_title = '¤ªµÒÍ;ðÊóÆþÎÏ(3/3)';
233        }
234   
235    //¥Õ¥©¡¼¥à¤ÎÃͤò$objPage¤Î¥­¡¼¤È¤·¤ÆÂåÆþ¤·¤Æ¤¤¤¯
236   foreach($objPage->arrForm as $key => $val) {
237        $objPage->$key = $val;
238        }
239    }
240
241        // ÆþÎÏ¥¨¥é¡¼¤Î¥Á¥§¥Ã¥¯
242    if ($objPage->arrErr || !empty($_POST["return"])) {     
243
244        //-- ¥Ç¡¼¥¿¤ÎÀßÄê
245        if ($_POST["mode2"] == "set2") {
246            $checkVal = array("email", "name01", "name02", "kana01", "kana02");
247        } elseif ($_POST["mode2"] == "set3") {
248            $checkVal = array("sex", "year", "month", "day", "zip01", "zip02");
249        } else {
250            $checkVal = array("pref", "addr01", "addr02", "tel01", "tel02", "tel03", "mail_flag");
251        }
252
253        foreach($objPage->arrForm as $key => $val) {
254            if ($key != "mode2" && $key != "submit" && $key != "return" && $key != session_name() && !in_array($key, $checkVal))
255                $objPage->list_data[ $key ] = $val;
256        }
257
258    } else {
259
260        //--¡¡¥Æ¥ó¥×¥ì¡¼¥ÈÀßÄê
261        if ($_POST["mode2"] == "set2") {
262           
263            $objPage->tpl_mainpage = 'nonmember/nonmember_set2.tpl';
264            $objPage->tpl_title = '¤ªµÒÍ;ðÊóÆþÎÏ(2/3)';
265        } elseif ($_POST["mode2"] == "set3") {
266            $objPage->tpl_mainpage = 'nonmember/nonmember_set3.tpl';
267            $objPage->tpl_title = '¤ªµÒÍ;ðÊóÆþÎÏ(3/3)';
268
269            if (@$objPage->arrForm['pref'] == "" && @$objPage->arrForm['addr01'] == "" && @$objPage->arrForm['addr02'] == "") {
270                $address = lfGetAddress($_REQUEST['zip01'].$_REQUEST['zip02']);
271                $objPage->pref = @$address[0]['state'];
272                $objPage->addr01 = @$address[0]['city'] . @$address[0]['town'];
273            }
274        }
275
276        //-- ¥Ç¡¼¥¿ÀßÄê
277        unset($objPage->list_data);
278        if ($_POST["mode2"] == "set2") {
279            $checkVal = array("sex", "year", "month", "day", "zip01", "zip02");
280        } elseif ($_POST["mode2"] == "set3") {
281            $checkVal = array("pref", "addr01", "addr02", "tel01", "tel02", "tel03", "mail_flag");
282        } else {
283            $checkVal = array();
284        }
285
286        //$objPage->arrForm¥Õ¥©¡¼¥à¤ÎÃͤòlist¤Ë³ÊǼ
287        foreach($objPage->arrForm as $key => $val) {
288            if ($key != "mode2" && $key != "submit" && $key != "confirm" && $key != "return" && $key != session_name() && !in_array($key, $checkVal)) {
289                $objPage->list_data[ $key ] = $val;
290            }
291        }
292
293        if ($_POST["mode2"] == "deliv") {
294           
295            $objFormParam = new SC_FormParam();
296            // ¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½
297           
298            // POSTÃͤμèÆÀ
299            $objFormParam->setParam($_POST);
300            $arrRet = $objFormParam->getHashArray();
301            $sqlval = $objFormParam->getDbArray();
302           
303            // ÆþÎÏÃͤμèÆÀ
304            $objPage->arrForm = $objFormParam->getFormParamList();
305            $objPage->arrErr = $arrErr;
306           
307           foreach($_POST as $key => $value){
308               $objPage->arrAddr[0][$key] = $value;
309           }
310//           $objPage->arrAddr[0]['zip01'] = $_POST['zip01'];
311//           $objPage->arrAddr[0]['zip02'] = $_POST['zip02'];
312//           $objPage->arrAddr[0]['pref'] = $_POST['pref'];
313//           $objPage->arrAddr[0]['addr01'] = $_POST['addr01'];
314//           $objPage->arrAddr[0]['addr02'] = $_POST['addr02'];
315           
316//            $cnt = 1;
317//            foreach($objOtherAddr as $val) {
318//                $objPage->arrAddr[$cnt] = $val;
319//                $cnt++;
320//            }
321            lfRegistDataTemp($objPage->tpl_uniqid,$objPage->arrAddr[0]);
322            lfCopyDeliv($objPage->tpl_uniqid, $_POST);
323           
324            $objPage->tpl_mainpage = 'nonmember/nonmember_deliv.tpl';
325            $objPage->tpl_title = '¤ªÆϤ±Àè¾ðÊó';
326        }
327       
328         if ($_POST["mode2"] == "customer_addr") {
329            //print_r($_POST);
330            if ($_POST['deli'] != "") {
331           
332           header("Location:" . gfAddSessionId("./payment.php"));
333            exit;
334    }else{
335        // ¥¨¥é¡¼¤òÊÖ¤¹
336        $arrErr['deli'] = '¢¨ ¤ªÆϤ±Àè¤òÁªÂò¤·¤Æ¤¯¤À¤µ¤¤¡£';
337    }
338    break;
339        }
340    }
341
342    return $objPage;
343}
344
345
346function lfRegistData($uniqid) {
347    global $objFormParam;
348    $arrRet = $objFormParam->getHashArray();
349    $sqlval = $objFormParam->getDbArray();
350   
351    // ÅÐÏ¿¥Ç¡¼¥¿¤ÎºîÀ®
352    $sqlval['order_temp_id'] = $uniqid;
353    $sqlval['order_birth'] = sfGetTimestamp($arrRet['year'], $arrRet['month'], $arrRet['day']);
354    $sqlval['update_date'] = 'Now()';
355    $sqlval['customer_id'] = '0';
356    $sqlval['order_name01'] = $objPage->arrAddr[0]['name01'];
357         
358    // ´û¸¥Ç¡¼¥¿¤Î¥Á¥§¥Ã¥¯
359    $objQuery = new SC_Query();
360    $where = "order_temp_id = ?";
361    $cnt = $objQuery->count("dtb_order_temp", $where, array($uniqid));
362    // ´û¸¥Ç¡¼¥¿¤¬¤Ê¤¤¾ì¹ç
363    if ($cnt == 0) {
364        $sqlval['create_date'] = 'Now()';
365        $objQuery->insert("dtb_order_temp", $sqlval);
366    } else {
367        $objQuery->update("dtb_order_temp", $sqlval, $where, array($uniqid));
368    }
369}
370
371function lfRegistDataTemp($uniqid,$array) {
372    global $objFormParam;
373    $arrRet = $objFormParam->getHashArray();
374    $sqlval = $objFormParam->getDbArray();
375       
376    // ÅÐÏ¿¥Ç¡¼¥¿¤ÎºîÀ®
377    $sqlval['order_temp_id'] = $uniqid;
378    $sqlval['order_birth'] = sfGetTimestamp($arrRet['year'], $arrRet['month'], $arrRet['day']);
379    $sqlval['update_date'] = 'Now()';
380    $sqlval['customer_id'] = '0';
381   
382    $sqlval['order_name01'] = $array['name01'];
383    $sqlval['order_name02'] = $array['name02'];
384    $sqlval['order_kana01'] = $array['kana01'];
385    $sqlval['order_kana02'] = $array['kana02'];
386    $sqlval['order_zip01'] = $array['zip01'];
387    $sqlval['order_zip02'] = $array['zip02'];
388    $sqlval['order_pref'] = $array['pref'];
389    $sqlval['order_addr01'] = $array['addr01'];
390    $sqlval['order_addr02'] = $array['addr02'];
391    $sqlval['order_tel01'] = $array['tel01'];
392    $sqlval['order_tel02'] = $array['tel02'];
393    $sqlval['order_tel03'] = $array['tel03'];
394    $sqlval['order_email'] = $array['email'];
395         
396    // ´û¸¥Ç¡¼¥¿¤Î¥Á¥§¥Ã¥¯
397    $objQuery = new SC_Query();
398    $where = "order_temp_id = ?";
399    $cnt = $objQuery->count("dtb_order_temp", $where, array($uniqid));
400    // ´û¸¥Ç¡¼¥¿¤¬¤Ê¤¤¾ì¹ç
401    if ($cnt == 0) {
402        $sqlval['create_date'] = 'Now()';
403        $objQuery->insert("dtb_order_temp", $sqlval);
404    } else {
405        $objQuery->update("dtb_order_temp", $sqlval, $where, array($uniqid));
406    }
407}
408
409/* ¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½ */
410function lfInitParam() {
411    global $objFormParam;
412    $objFormParam->addParam("¤ªÌ¾Á°¡ÊÀ«¡Ë", "order_name01", STEXT_LEN, "KVa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
413    $objFormParam->addParam("¤ªÌ¾Á°¡Ê̾¡Ë", "order_name02", STEXT_LEN, "KVa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
414    $objFormParam->addParam("¥Õ¥ê¥¬¥Ê¡Ê¥»¥¤¡Ë", "order_kana01", STEXT_LEN, "KVCa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
415    $objFormParam->addParam("¥Õ¥ê¥¬¥Ê¡Ê¥á¥¤¡Ë", "order_kana02", STEXT_LEN, "KVCa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
416    $objFormParam->addParam("͹ÊØÈÖ¹æ1", "order_zip01", ZIP01_LEN, "n", array("EXIST_CHECK", "NUM_CHECK", "NUM_COUNT_CHECK"));
417    $objFormParam->addParam("͹ÊØÈÖ¹æ2", "order_zip02", ZIP02_LEN, "n", array("EXIST_CHECK", "NUM_CHECK", "NUM_COUNT_CHECK"));
418    $objFormParam->addParam("ÅÔÆ»Éܸ©", "order_pref", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"));
419    $objFormParam->addParam("½»½ê1", "order_addr01", STEXT_LEN, "KVa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
420    $objFormParam->addParam("½»½ê2", "order_addr02", STEXT_LEN, "KVa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
421    $objFormParam->addParam("ÅÅÏÃÈÖ¹æ1", "order_tel01", TEL_ITEM_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK" ,"NUM_CHECK"));
422    $objFormParam->addParam("ÅÅÏÃÈÖ¹æ2", "order_tel02", TEL_ITEM_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK" ,"NUM_CHECK"));
423    $objFormParam->addParam("ÅÅÏÃÈÖ¹æ3", "order_tel03", TEL_ITEM_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK" ,"NUM_CHECK"));
424    $objFormParam->addParam("FAXÈÖ¹æ1", "order_fax01", TEL_ITEM_LEN, "n", array("MAX_LENGTH_CHECK" ,"NUM_CHECK"));
425    $objFormParam->addParam("FAXÈÖ¹æ2", "order_fax02", TEL_ITEM_LEN, "n", array("MAX_LENGTH_CHECK" ,"NUM_CHECK"));
426    $objFormParam->addParam("FAXÈÖ¹æ3", "order_fax03", TEL_ITEM_LEN, "n", array("MAX_LENGTH_CHECK" ,"NUM_CHECK"));
427    $objFormParam->addParam("¥á¡¼¥ë¥¢¥É¥ì¥¹", "order_email", STEXT_LEN, "KVa", array("EXIST_CHECK", "SPTAB_CHECK", "NO_SPTAB", "MAX_LENGTH_CHECK", "EMAIL_CHECK", "EMAIL_CHAR_CHECK"));
428    $objFormParam->addParam("¥á¡¼¥ë¥¢¥É¥ì¥¹¡Ê³Îǧ¡Ë", "order_email_check", STEXT_LEN, "KVa", array("EXIST_CHECK", "SPTAB_CHECK", "NO_SPTAB", "MAX_LENGTH_CHECK", "EMAIL_CHECK", "EMAIL_CHAR_CHECK"), "", false);
429    $objFormParam->addParam("ǯ", "year", INT_LEN, "n", array("MAX_LENGTH_CHECK"), "", false);
430    $objFormParam->addParam("·î", "month", INT_LEN, "n", array("MAX_LENGTH_CHECK"), "", false);
431    $objFormParam->addParam("Æü", "day", INT_LEN, "n", array("MAX_LENGTH_CHECK"), "", false);
432    $objFormParam->addParam("À­ÊÌ", "order_sex", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"));
433    $objFormParam->addParam("¿¦¶È", "order_job", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"));
434    $objFormParam->addParam("Ê̤ΤªÆϤ±Àè", "deliv_check", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"));
435    $objFormParam->addParam("¤ªÌ¾Á°¡ÊÀ«¡Ë", "deliv_name01", STEXT_LEN, "KVa", array("SPTAB_CHECK", "MAX_LENGTH_CHECK"));
436    $objFormParam->addParam("¤ªÌ¾Á°¡Ê̾¡Ë", "deliv_name02", STEXT_LEN, "KVa", array("SPTAB_CHECK", "MAX_LENGTH_CHECK"));
437    $objFormParam->addParam("¥Õ¥ê¥¬¥Ê¡Ê¥»¥¤¡Ë", "deliv_kana01", STEXT_LEN, "KVCa", array("SPTAB_CHECK", "MAX_LENGTH_CHECK"));
438    $objFormParam->addParam("¥Õ¥ê¥¬¥Ê¡Ê¥á¥¤¡Ë", "deliv_kana02", STEXT_LEN, "KVCa", array("SPTAB_CHECK", "MAX_LENGTH_CHECK"));
439    $objFormParam->addParam("͹ÊØÈÖ¹æ1", "deliv_zip01", ZIP01_LEN, "n", array("NUM_CHECK", "NUM_COUNT_CHECK"));
440    $objFormParam->addParam("͹ÊØÈÖ¹æ2", "deliv_zip02", ZIP02_LEN, "n", array("NUM_CHECK", "NUM_COUNT_CHECK"));
441    $objFormParam->addParam("ÅÔÆ»Éܸ©", "deliv_pref", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"));
442    $objFormParam->addParam("½»½ê1", "deliv_addr01", STEXT_LEN, "KVa", array("SPTAB_CHECK", "MAX_LENGTH_CHECK"));
443    $objFormParam->addParam("½»½ê2", "deliv_addr02", STEXT_LEN, "KVa", array("SPTAB_CHECK", "MAX_LENGTH_CHECK"));
444    $objFormParam->addParam("ÅÅÏÃÈÖ¹æ1", "deliv_tel01", TEL_ITEM_LEN, "n", array("MAX_LENGTH_CHECK" ,"NUM_CHECK"));
445    $objFormParam->addParam("ÅÅÏÃÈÖ¹æ2", "deliv_tel02", TEL_ITEM_LEN, "n", array("MAX_LENGTH_CHECK" ,"NUM_CHECK"));
446    $objFormParam->addParam("ÅÅÏÃÈÖ¹æ3", "deliv_tel03", TEL_ITEM_LEN, "n", array("MAX_LENGTH_CHECK" ,"NUM_CHECK"));
447    $objFormParam->addParam("¥á¡¼¥ë¥Þ¥¬¥¸¥ó", "mail_flag", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"), 1);
448}
449
450/* DB¤Ø¥Ç¡¼¥¿¤ÎÅÐÏ¿ */
451
452
453/* ÆþÎÏÆâÍƤΥÁ¥§¥Ã¥¯ */
454function lfCheckError() {
455    global $objFormParam;
456    // ÆþÎϥǡ¼¥¿¤òÅϤ¹¡£
457    $arrRet =  $objFormParam->getHashArray();
458    $objErr = new SC_CheckError($arrRet);
459    $objErr->arrErr = $objFormParam->checkError();
460       
461    // Ê̤ΤªÆϤ±Àè¥Á¥§¥Ã¥¯
462    if($_POST['deliv_check'] == "1") {
463        $objErr->doFunc(array("¤ªÌ¾Á°¡ÊÀ«¡Ë", "deliv_name01"), array("EXIST_CHECK"));
464        $objErr->doFunc(array("¤ªÌ¾Á°¡Ê̾¡Ë", "deliv_name02"), array("EXIST_CHECK"));
465        $objErr->doFunc(array("¥Õ¥ê¥¬¥Ê¡Ê¥»¥¤¡Ë", "deliv_kana01"), array("EXIST_CHECK"));
466        $objErr->doFunc(array("¥Õ¥ê¥¬¥Ê¡Ê¥á¥¤¡Ë", "deliv_kana02"), array("EXIST_CHECK"));
467        $objErr->doFunc(array("͹ÊØÈÖ¹æ1", "deliv_zip01"), array("EXIST_CHECK"));
468        $objErr->doFunc(array("͹ÊØÈÖ¹æ2", "deliv_zip02"), array("EXIST_CHECK"));
469        $objErr->doFunc(array("ÅÔÆ»Éܸ©", "deliv_pref"), array("EXIST_CHECK"));
470        $objErr->doFunc(array("½»½ê1", "deliv_addr01"), array("EXIST_CHECK"));
471        $objErr->doFunc(array("½»½ê2", "deliv_addr02"), array("EXIST_CHECK"));
472        $objErr->doFunc(array("ÅÅÏÃÈÖ¹æ1", "deliv_tel01"), array("EXIST_CHECK"));
473        $objErr->doFunc(array("ÅÅÏÃÈÖ¹æ2", "deliv_tel02"), array("EXIST_CHECK"));
474        $objErr->doFunc(array("ÅÅÏÃÈÖ¹æ3", "deliv_tel03"), array("EXIST_CHECK"));
475    }
476   
477    // Ê£¿ô¹àÌÜ¥Á¥§¥Ã¥¯
478    $objErr->doFunc(array("TEL", "order_tel01", "order_tel02", "order_tel03", TEL_ITEM_LEN), array("TEL_CHECK"));
479    $objErr->doFunc(array("FAX", "order_fax01", "order_fax02", "order_fax03", TEL_ITEM_LEN), array("TEL_CHECK"));
480    $objErr->doFunc(array("͹ÊØÈÖ¹æ", "order_zip01", "order_zip02"), array("ALL_EXIST_CHECK"));
481    $objErr->doFunc(array("TEL", "deliv_tel01", "deliv_tel02", "deliv_tel03", TEL_ITEM_LEN), array("TEL_CHECK"));
482    $objErr->doFunc(array("FAX", "deliv_fax01", "deliv_fax02", "deliv_fax03", TEL_ITEM_LEN), array("TEL_CHECK"));
483    $objErr->doFunc(array("͹ÊØÈÖ¹æ", "deliv_zip01", "deliv_zip02"), array("ALL_EXIST_CHECK"));
484    $objErr->doFunc(array("À¸Ç¯·îÆü", "year", "month", "day"), array("CHECK_DATE"));
485    $objErr->doFunc(array("¥á¡¼¥ë¥¢¥É¥ì¥¹", "¥á¡¼¥ë¥¢¥É¥ì¥¹¡Ê³Îǧ¡Ë", "order_email", "order_email_check"), array("EQUAL_CHECK"));
486   
487    // ¤¹¤Ç¤Ë¥á¥ë¥Þ¥¬¥Æ¡¼¥Ö¥ë¤Ë²ñ°÷¤È¤·¤Æ¥á¡¼¥ë¥¢¥É¥ì¥¹¤¬ÅÐÏ¿¤µ¤ì¤Æ¤¤¤ë¾ì¹ç
488    if(sfCheckCustomerMailMaga($arrRet['order_email'])) {
489        $objErr->arrErr['order_email'] = "¤³¤Î¥á¡¼¥ë¥¢¥É¥ì¥¹¤Ï¤¹¤Ç¤ËÅÐÏ¿¤µ¤ì¤Æ¤¤¤Þ¤¹¡£<br>";
490    }
491       
492    return $objErr->arrErr;
493}
494
495// ¼õÃí°ì»þ¥Æ¡¼¥Ö¥ë¤Î¤ªÆϤ±Àè¤ò¥³¥Ô¡¼¤¹¤ë
496function lfCopyDeliv($uniqid, $arrData) {
497    $objQuery = new SC_Query();
498   
499    // Ê̤ΤªÆϤ±Àè¤ò»ØÄꤷ¤Æ¤¤¤Ê¤¤¾ì¹ç¡¢ÇÛÁ÷Àè¤ËÅÐÏ¿½»½ê¤ò¥³¥Ô¡¼¤¹¤ë¡£
500    if($arrData["deliv_check"] != "1") {
501        $sqlval['deliv_name01'] = $arrData['order_name01'];
502        $sqlval['deliv_name02'] = $arrData['order_name02'];
503        $sqlval['deliv_kana01'] = $arrData['order_kana01'];
504        $sqlval['deliv_kana02'] = $arrData['order_kana02'];
505        $sqlval['deliv_pref'] = $arrData['order_pref'];
506        $sqlval['deliv_zip01'] = $arrData['order_zip01'];
507        $sqlval['deliv_zip02'] = $arrData['order_zip02'];
508        $sqlval['deliv_addr01'] = $arrData['order_addr01'];
509        $sqlval['deliv_addr02'] = $arrData['order_addr02'];
510        $sqlval['deliv_tel01'] = $arrData['order_tel01'];
511        $sqlval['deliv_tel02'] = $arrData['order_tel02'];
512        $sqlval['deliv_tel03'] = $arrData['order_tel03'];
513        $where = "order_temp_id = ?";
514        $objQuery->update("dtb_order_temp", $sqlval, $where, array($uniqid));
515    }
516}
517
518//-----------------------------NONMEMBER´Ø¿ô·²¢§------------------------------------------------------------------
519//----¡¡¼èÆÀʸ»úÎó¤ÎÊÑ´¹
520function lfConvertParam($array, $arrRegistColumn) {
521    /*
522     *  ʸ»úÎó¤ÎÊÑ´¹
523     *  K :  ¡ÖȾ³Ñ(ŽÊŽÝŽ¶Ž¸)ÊÒ²¾Ì¾¡×¤ò¡ÖÁ´³ÑÊÒ²¾Ì¾¡×¤ËÊÑ´¹
524     *  C :  ¡ÖÁ´³Ñ¤Ò¤é²¾Ì¾¡×¤ò¡ÖÁ´³Ñ¤«¤¿²¾Ì¾¡×¤ËÊÑ´¹
525     *  V :  ÂùÅÀÉÕ¤­¤Îʸ»ú¤ò°ìʸ»ú¤ËÊÑ´¹¡£"K","H"¤È¶¦¤Ë»ÈÍѤ·¤Þ¤¹
526     *  n :  ¡ÖÁ´³Ñ¡×¿ô»ú¤ò¡ÖȾ³Ñ(ŽÊŽÝŽ¶Ž¸)¡×¤ËÊÑ´¹
527     *  a :  Á´³Ñ±Ñ¿ô»ú¤òȾ³Ñ±Ñ¿ô»ú¤ËÊÑ´¹¤¹¤ë
528     */
529    // ¥«¥é¥à̾¤È¥³¥ó¥Ð¡¼¥È¾ðÊó
530    foreach ($arrRegistColumn as $data) {
531        $arrConvList[ $data["column"] ] = $data["convert"];
532    }
533    // ʸ»úÊÑ´¹
534    foreach ($arrConvList as $key => $val) {
535        // POST¤µ¤ì¤Æ¤­¤¿ÃͤΤßÊÑ´¹¤¹¤ë¡£
536        if(strlen(($array[$key])) > 0) {
537            $array[$key] = mb_convert_kana($array[$key] ,$val);
538        }
539    }
540    return $array;
541}
542
543//---- ÆþÎÏ¥¨¥é¡¼¥Á¥§¥Ã¥¯
544function lfErrorCheck1($array) {
545
546    global $objConn;
547    $objErr = new SC_CheckError($array);
548   
549    $objErr->doFunc(array("¤ªÌ¾Á°¡ÊÀ«¡Ë", 'name01', STEXT_LEN), array("EXIST_CHECK", "NO_SPTAB", "SPTAB_CHECK" ,"MAX_LENGTH_CHECK"));
550    $objErr->doFunc(array("¤ªÌ¾Á°¡Ê̾¡Ë", 'name02', STEXT_LEN), array("EXIST_CHECK", "NO_SPTAB", "SPTAB_CHECK" , "MAX_LENGTH_CHECK"));
551    $objErr->doFunc(array("¤ªÌ¾Á°¡Ê¥«¥Ê/À«¡Ë", 'kana01', STEXT_LEN), array("EXIST_CHECK", "NO_SPTAB", "SPTAB_CHECK" ,"MAX_LENGTH_CHECK", "KANA_CHECK"));
552    $objErr->doFunc(array("¤ªÌ¾Á°¡Ê¥«¥Ê/̾¡Ë", 'kana02', STEXT_LEN), array("EXIST_CHECK", "NO_SPTAB", "SPTAB_CHECK" ,"MAX_LENGTH_CHECK", "KANA_CHECK"));
553    $objErr->doFunc(array('¥á¡¼¥ë¥¢¥É¥ì¥¹', "email", MTEXT_LEN) ,array("NO_SPTAB", "EXIST_CHECK", "EMAIL_CHECK", "SPTAB_CHECK" ,"EMAIL_CHAR_CHECK", "MAX_LENGTH_CHECK", "MOBILE_EMAIL_CHECK"));
554
555    return $objErr->arrErr;
556}
557
558//---- ÆþÎÏ¥¨¥é¡¼¥Á¥§¥Ã¥¯
559function lfErrorCheck2($array) {
560
561    global $objConn, $objDate;
562    $objErr = new SC_CheckError($array);
563   
564    $objErr->doFunc(array("͹ÊØÈÖ¹æ1", "zip01", ZIP01_LEN ) ,array("EXIST_CHECK", "SPTAB_CHECK" ,"NUM_CHECK", "NUM_COUNT_CHECK"));
565    $objErr->doFunc(array("͹ÊØÈÖ¹æ2", "zip02", ZIP02_LEN ) ,array("EXIST_CHECK", "SPTAB_CHECK" ,"NUM_CHECK", "NUM_COUNT_CHECK"));
566    $objErr->doFunc(array("͹ÊØÈÖ¹æ", "zip01", "zip02"), array("ALL_EXIST_CHECK"));
567
568    $objErr->doFunc(array("À­ÊÌ", "sex") ,array("SELECT_CHECK", "NUM_CHECK"));
569    $objErr->doFunc(array("À¸Ç¯·îÆü (ǯ)", "year", 4), array("EXIST_CHECK", "SPTAB_CHECK", "NUM_CHECK", "NUM_COUNT_CHECK"));
570    if (!isset($objErr->arrErr['year'])) {
571        $objErr->doFunc(array("À¸Ç¯·îÆü (ǯ)", "year", $objDate->getStartYear()), array("MIN_CHECK"));
572        $objErr->doFunc(array("À¸Ç¯·îÆü (ǯ)", "year", $objDate->getEndYear()), array("MAX_CHECK"));
573    }
574    $objErr->doFunc(array("À¸Ç¯·îÆü (·îÆü)", "month", "day"), array("SELECT_CHECK"));
575    if (!isset($objErr->arrErr['year']) && !isset($objErr->arrErr['month']) && !isset($objErr->arrErr['day'])) {
576        $objErr->doFunc(array("À¸Ç¯·îÆü", "year", "month", "day"), array("CHECK_DATE"));
577    }
578   
579    return $objErr->arrErr;
580}
581
582
583//---- ÆþÎÏ¥¨¥é¡¼¥Á¥§¥Ã¥¯
584function lfErrorCheck3($array) {
585
586    global $objConn;
587    $objErr = new SC_CheckError($array);
588   
589    $objErr->doFunc(array("ÅÔÆ»Éܸ©", 'pref'), array("SELECT_CHECK","NUM_CHECK"));
590    $objErr->doFunc(array("»Ô¶èĮ¼", "addr01", MTEXT_LEN), array("EXIST_CHECK","SPTAB_CHECK" ,"MAX_LENGTH_CHECK"));
591    $objErr->doFunc(array("ÈÖÃÏ", "addr02", MTEXT_LEN), array("EXIST_CHECK","SPTAB_CHECK" ,"MAX_LENGTH_CHECK"));
592    $objErr->doFunc(array("ÅÅÏÃÈÖ¹æ1", 'tel01'), array("EXIST_CHECK","SPTAB_CHECK" ));
593    $objErr->doFunc(array("ÅÅÏÃÈÖ¹æ2", 'tel02'), array("EXIST_CHECK","SPTAB_CHECK" ));
594    $objErr->doFunc(array("ÅÅÏÃÈÖ¹æ3", 'tel03'), array("EXIST_CHECK","SPTAB_CHECK" ));
595    $objErr->doFunc(array("ÅÅÏÃÈÖ¹æ", "tel01", "tel02", "tel03",TEL_ITEM_LEN) ,array("TEL_CHECK"));
596   
597    return $objErr->arrErr;
598}
599
600// ͹ÊØÈֹ椫¤é½»½ê¤Î¼èÆÀ
601function lfGetAddress($zipcode) {
602    global $arrPref;
603
604    $conn = new SC_DBconn(ZIP_DSN);
605
606    // ͹ÊØÈֹ渡º÷ʸºîÀ®
607    $zipcode = mb_convert_kana($zipcode ,"n");
608    $sqlse = "SELECT state, city, town FROM mtb_zip WHERE zipcode = ?";
609
610    $data_list = $conn->getAll($sqlse, array($zipcode));
611
612    // ¥¤¥ó¥Ç¥Ã¥¯¥¹¤ÈÃͤòȿž¤µ¤»¤ë¡£
613    $arrREV_PREF = array_flip($arrPref);
614
615    /*
616        Áí̳¾Ê¤«¤é¥À¥¦¥ó¥í¡¼¥É¤·¤¿¥Ç¡¼¥¿¤ò¤½¤Î¤Þ¤Þ¥¤¥ó¥Ý¡¼¥È¤¹¤ë¤È
617        °Ê²¼¤Î¤è¤¦¤Êʸ»úÎó¤¬Æþ¤Ã¤Æ¤¤¤ë¤Î¤Ç   Âкö¤¹¤ë¡£
618        ¡¦¡Ê£±¡¦£±£¹ÃúÌÜ¡Ë
619        ¡¦°Ê²¼¤Ë·ÇºÜ¤¬¤Ê¤¤¾ì¹ç
620    */
621    $town =  $data_list[0]['town'];
622    $town = ereg_replace("¡Ê.*¡Ë$","",$town);
623    $town = ereg_replace("°Ê²¼¤Ë·ÇºÜ¤¬¤Ê¤¤¾ì¹ç","",$town);
624    $data_list[0]['town'] = $town;
625    $data_list[0]['state'] = $arrREV_PREF[$data_list[0]['state']];
626
627    return $data_list;
628}
629//NONMEMBER_´Ø¿ô·²---------------------------------------------------------------------------------------
630?>
Note: See TracBrowser for help on using the repository browser.