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

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