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

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