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

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