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

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