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

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