source: branches/dev/html/mobile/nonmember/shopping_index.php @ 12435

Revision 12435, 11.3 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/nonmember.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// ¥æ¡¼¥¶¥æ¥Ë¡¼¥¯ID¤Î¼èÆÀ¤È¹ØÆþ¾õÂÖ¤ÎÀµÅöÀ­¤ò¥Á¥§¥Ã¥¯
47$uniqid = sfCheckNormalAccess($objSiteSess, $objCartSess);
48
49$objPage->tpl_uniqid = $uniqid;
50
51// ¥í¥°¥¤¥ó¥Á¥§¥Ã¥¯
52if($objCustomer->isLoginSuccess()) {
53    // ¤¹¤Ç¤Ë¥í¥°¥¤¥ó¤µ¤ì¤Æ¤¤¤ë¾ì¹ç¤Ï¡¢¤ªÆϤ±ÀèÀßÄê²èÌ̤ËžÁ÷
54    header("Location: " . gfAddSessionId('deliv.php'));
55    exit;
56}
57
58// ·ÈÂÓüËöID¤¬°ìÃפ¹¤ë²ñ°÷¤¬Â¸ºß¤¹¤ë¤«¤É¤¦¤«¤ò¥Á¥§¥Ã¥¯¤¹¤ë¡£
59$objPage->tpl_valid_phone_id = $objCustomer->checkMobilePhoneId();
60
61switch($_POST['mode']) {
62case 'nonmember_confirm':
63    $objPage = lfSetNonMember($objPage);
64    // ¢¨break¤Ê¤·
65case 'confirm':
66    // ÆþÎÏÃͤÎÊÑ´¹
67    $objFormParam->convParam();
68    $objFormParam->toLower('order_mail');
69    $objFormParam->toLower('order_mail_check');
70   
71    $objPage->arrErr = lfCheckError();
72
73    // ÆþÎÏ¥¨¥é¡¼¤Ê¤·
74    if(count($objPage->arrErr) == 0) {
75        // DB¤Ø¤Î¥Ç¡¼¥¿ÅÐÏ¿
76        lfRegistData($uniqid);
77        // Àµ¾ï¤ËÅÐÏ¿¤µ¤ì¤¿¤³¤È¤òµ­Ï¿¤·¤Æ¤ª¤¯
78        $objSiteSess->setRegistFlag();
79        // ¤ª»Ùʧ¤¤ÊýË¡ÁªÂò¥Ú¡¼¥¸¤Ø°ÜÆ°
80        header("Location: " . gfAddSessionId(MOBILE_URL_SHOP_PAYMENT));
81        exit;       
82    }
83   
84    break;
85// Á°¤Î¥Ú¡¼¥¸¤ËÌá¤ë
86case 'return':
87    // ³Îǧ¥Ú¡¼¥¸¤Ø°ÜÆ°
88    header("Location: " . gfAddSessionId(MOBILE_URL_CART_TOP));
89    exit;
90    break;
91case 'nonmember':
92    $objPage = lfSetNonMember($objPage);
93    // ¢¨break¤Ê¤·
94default:
95    if($_GET['from'] == 'nonmember') {
96        $objPage = lfSetNonMember($objPage);
97    }
98    // ¥æ¡¼¥¶¥æ¥Ë¡¼¥¯ID¤Î¼èÆÀ
99    $uniqid = $objSiteSess->getUniqId();
100    $objQuery = new SC_Query();
101    $where = "order_temp_id = ?";
102    $arrRet = $objQuery->select("*", "dtb_order_temp", $where, array($uniqid));
103    // DBÃͤμèÆÀ
104    $objFormParam->setParam($arrRet[0]);
105    $objFormParam->setValue('order_email_check', $arrRet[0]['order_email']);
106    $objFormParam->setDBDate($arrRet[0]['order_birth']);
107    break;
108}
109
110// ¥¯¥Ã¥­¡¼È½Äê
111$objPage->tpl_login_email = $objCookie->getCookie('login_email');
112if($objPage->tpl_login_email != "") {
113    $objPage->tpl_login_memory = "1";
114}
115
116// ÁªÂòÍÑÆüÉդμèÆÀ
117$objDate = new SC_Date(START_BIRTH_YEAR);
118$objPage->arrYear = $objDate->getYear('', 1950);    //¡¡ÆüÉÕ¥×¥ë¥À¥¦¥óÀßÄê
119$objPage->arrMonth = $objDate->getMonth();
120$objPage->arrDay = $objDate->getDay();
121
122if($objPage->year == '') {
123    $objPage->year = '----';
124}
125
126// ÆþÎÏÃͤμèÆÀ
127$objPage->arrForm = $objFormParam->getFormParamList();
128
129if($objPage->arrForm['year']['value'] == ""){
130    $objPage->arrForm['year']['value'] = '----';   
131}
132
133$objView->assignobj($objPage);
134$objView->display(SITE_FRAME);
135//--------------------------------------------------------------------------------------------------------------------------
136/* Èó²ñ°÷ÆþÎÏ¥Ú¡¼¥¸¤Î¥»¥Ã¥È */
137function lfSetNonMember($objPage) {
138    $objPage->tpl_mainpage = 'nonmember/nonmember_input.tpl';
139    $objPage->tpl_css = array();
140    $objPage->tpl_css[] = '/css/layout/login/nonmember.css';
141    return $objPage;
142}
143
144/* ¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½ */
145function lfInitParam() {
146    global $objFormParam;
147    $objFormParam->addParam("¤ªÌ¾Á°¡ÊÀ«¡Ë", "order_name01", STEXT_LEN, "KVa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
148    $objFormParam->addParam("¤ªÌ¾Á°¡Ê̾¡Ë", "order_name02", STEXT_LEN, "KVa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
149    $objFormParam->addParam("¥Õ¥ê¥¬¥Ê¡Ê¥»¥¤¡Ë", "order_kana01", STEXT_LEN, "KVCa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
150    $objFormParam->addParam("¥Õ¥ê¥¬¥Ê¡Ê¥á¥¤¡Ë", "order_kana02", STEXT_LEN, "KVCa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
151    $objFormParam->addParam("͹ÊØÈÖ¹æ1", "order_zip01", ZIP01_LEN, "n", array("EXIST_CHECK", "NUM_CHECK", "NUM_COUNT_CHECK"));
152    $objFormParam->addParam("͹ÊØÈÖ¹æ2", "order_zip02", ZIP02_LEN, "n", array("EXIST_CHECK", "NUM_CHECK", "NUM_COUNT_CHECK"));
153    $objFormParam->addParam("ÅÔÆ»Éܸ©", "order_pref", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"));
154    $objFormParam->addParam("½»½ê1", "order_addr01", STEXT_LEN, "KVa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
155    $objFormParam->addParam("½»½ê2", "order_addr02", STEXT_LEN, "KVa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
156    $objFormParam->addParam("ÅÅÏÃÈÖ¹æ1", "order_tel01", TEL_ITEM_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK" ,"NUM_CHECK"));
157    $objFormParam->addParam("ÅÅÏÃÈÖ¹æ2", "order_tel02", TEL_ITEM_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK" ,"NUM_CHECK"));
158    $objFormParam->addParam("ÅÅÏÃÈÖ¹æ3", "order_tel03", TEL_ITEM_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK" ,"NUM_CHECK"));
159    $objFormParam->addParam("FAXÈÖ¹æ1", "order_fax01", TEL_ITEM_LEN, "n", array("MAX_LENGTH_CHECK" ,"NUM_CHECK"));
160    $objFormParam->addParam("FAXÈÖ¹æ2", "order_fax02", TEL_ITEM_LEN, "n", array("MAX_LENGTH_CHECK" ,"NUM_CHECK"));
161    $objFormParam->addParam("FAXÈÖ¹æ3", "order_fax03", TEL_ITEM_LEN, "n", array("MAX_LENGTH_CHECK" ,"NUM_CHECK"));
162    $objFormParam->addParam("¥á¡¼¥ë¥¢¥É¥ì¥¹", "order_email", STEXT_LEN, "KVa", array("EXIST_CHECK", "SPTAB_CHECK", "NO_SPTAB", "MAX_LENGTH_CHECK", "EMAIL_CHECK", "EMAIL_CHAR_CHECK"));
163    $objFormParam->addParam("¥á¡¼¥ë¥¢¥É¥ì¥¹¡Ê³Îǧ¡Ë", "order_email_check", STEXT_LEN, "KVa", array("EXIST_CHECK", "SPTAB_CHECK", "NO_SPTAB", "MAX_LENGTH_CHECK", "EMAIL_CHECK", "EMAIL_CHAR_CHECK"), "", false);
164    $objFormParam->addParam("ǯ", "year", INT_LEN, "n", array("MAX_LENGTH_CHECK"), "", false);
165    $objFormParam->addParam("·î", "month", INT_LEN, "n", array("MAX_LENGTH_CHECK"), "", false);
166    $objFormParam->addParam("Æü", "day", INT_LEN, "n", array("MAX_LENGTH_CHECK"), "", false);
167    $objFormParam->addParam("À­ÊÌ", "order_sex", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"));
168    $objFormParam->addParam("¿¦¶È", "order_job", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"));
169    $objFormParam->addParam("Ê̤ΤªÆϤ±Àè", "deliv_check", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"));
170    $objFormParam->addParam("¤ªÌ¾Á°¡ÊÀ«¡Ë", "deliv_name01", STEXT_LEN, "KVa", array("SPTAB_CHECK", "MAX_LENGTH_CHECK"));
171    $objFormParam->addParam("¤ªÌ¾Á°¡Ê̾¡Ë", "deliv_name02", STEXT_LEN, "KVa", array("SPTAB_CHECK", "MAX_LENGTH_CHECK"));
172    $objFormParam->addParam("¥Õ¥ê¥¬¥Ê¡Ê¥»¥¤¡Ë", "deliv_kana01", STEXT_LEN, "KVCa", array("SPTAB_CHECK", "MAX_LENGTH_CHECK"));
173    $objFormParam->addParam("¥Õ¥ê¥¬¥Ê¡Ê¥á¥¤¡Ë", "deliv_kana02", STEXT_LEN, "KVCa", array("SPTAB_CHECK", "MAX_LENGTH_CHECK"));
174    $objFormParam->addParam("͹ÊØÈÖ¹æ1", "deliv_zip01", ZIP01_LEN, "n", array("NUM_CHECK", "NUM_COUNT_CHECK"));
175    $objFormParam->addParam("͹ÊØÈÖ¹æ2", "deliv_zip02", ZIP02_LEN, "n", array("NUM_CHECK", "NUM_COUNT_CHECK"));
176    $objFormParam->addParam("ÅÔÆ»Éܸ©", "deliv_pref", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"));
177    $objFormParam->addParam("½»½ê1", "deliv_addr01", STEXT_LEN, "KVa", array("SPTAB_CHECK", "MAX_LENGTH_CHECK"));
178    $objFormParam->addParam("½»½ê2", "deliv_addr02", STEXT_LEN, "KVa", array("SPTAB_CHECK", "MAX_LENGTH_CHECK"));
179    $objFormParam->addParam("ÅÅÏÃÈÖ¹æ1", "deliv_tel01", TEL_ITEM_LEN, "n", array("MAX_LENGTH_CHECK" ,"NUM_CHECK"));
180    $objFormParam->addParam("ÅÅÏÃÈÖ¹æ2", "deliv_tel02", TEL_ITEM_LEN, "n", array("MAX_LENGTH_CHECK" ,"NUM_CHECK"));
181    $objFormParam->addParam("ÅÅÏÃÈÖ¹æ3", "deliv_tel03", TEL_ITEM_LEN, "n", array("MAX_LENGTH_CHECK" ,"NUM_CHECK"));
182    $objFormParam->addParam("¥á¡¼¥ë¥Þ¥¬¥¸¥ó", "mail_flag", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"), 1);
183}
184
185/* DB¤Ø¥Ç¡¼¥¿¤ÎÅÐÏ¿ */
186function lfRegistData($uniqid) {
187    global $objFormParam;
188    $arrRet = $objFormParam->getHashArray();
189    $sqlval = $objFormParam->getDbArray();
190    // ÅÐÏ¿¥Ç¡¼¥¿¤ÎºîÀ®
191    $sqlval['order_temp_id'] = $uniqid;
192    $sqlval['order_birth'] = sfGetTimestamp($arrRet['year'], $arrRet['month'], $arrRet['day']);
193    $sqlval['update_date'] = 'Now()';
194    $sqlval['customer_id'] = '0';
195   
196    // ´û¸¥Ç¡¼¥¿¤Î¥Á¥§¥Ã¥¯
197    $objQuery = new SC_Query();
198    $where = "order_temp_id = ?";
199    $cnt = $objQuery->count("dtb_order_temp", $where, array($uniqid));
200    // ´û¸¥Ç¡¼¥¿¤¬¤Ê¤¤¾ì¹ç
201    if ($cnt == 0) {
202        $sqlval['create_date'] = 'Now()';
203        $objQuery->insert("dtb_order_temp", $sqlval);
204    } else {
205        $objQuery->update("dtb_order_temp", $sqlval, $where, array($uniqid));
206    }
207}
208
209/* ÆþÎÏÆâÍƤΥÁ¥§¥Ã¥¯ */
210function lfCheckError() {
211    global $objFormParam;
212    // ÆþÎϥǡ¼¥¿¤òÅϤ¹¡£
213    $arrRet =  $objFormParam->getHashArray();
214    $objErr = new SC_CheckError($arrRet);
215    $objErr->arrErr = $objFormParam->checkError();
216       
217    // Ê̤ΤªÆϤ±Àè¥Á¥§¥Ã¥¯
218    if($_POST['deliv_check'] == "1") {
219        $objErr->doFunc(array("¤ªÌ¾Á°¡ÊÀ«¡Ë", "deliv_name01"), array("EXIST_CHECK"));
220        $objErr->doFunc(array("¤ªÌ¾Á°¡Ê̾¡Ë", "deliv_name02"), array("EXIST_CHECK"));
221        $objErr->doFunc(array("¥Õ¥ê¥¬¥Ê¡Ê¥»¥¤¡Ë", "deliv_kana01"), array("EXIST_CHECK"));
222        $objErr->doFunc(array("¥Õ¥ê¥¬¥Ê¡Ê¥á¥¤¡Ë", "deliv_kana02"), array("EXIST_CHECK"));
223        $objErr->doFunc(array("͹ÊØÈÖ¹æ1", "deliv_zip01"), array("EXIST_CHECK"));
224        $objErr->doFunc(array("͹ÊØÈÖ¹æ2", "deliv_zip02"), array("EXIST_CHECK"));
225        $objErr->doFunc(array("ÅÔÆ»Éܸ©", "deliv_pref"), array("EXIST_CHECK"));
226        $objErr->doFunc(array("½»½ê1", "deliv_addr01"), array("EXIST_CHECK"));
227        $objErr->doFunc(array("½»½ê2", "deliv_addr02"), array("EXIST_CHECK"));
228        $objErr->doFunc(array("ÅÅÏÃÈÖ¹æ1", "deliv_tel01"), array("EXIST_CHECK"));
229        $objErr->doFunc(array("ÅÅÏÃÈÖ¹æ2", "deliv_tel02"), array("EXIST_CHECK"));
230        $objErr->doFunc(array("ÅÅÏÃÈÖ¹æ3", "deliv_tel03"), array("EXIST_CHECK"));
231    }
232   
233    // Ê£¿ô¹àÌÜ¥Á¥§¥Ã¥¯
234    $objErr->doFunc(array("TEL", "order_tel01", "order_tel02", "order_tel03", TEL_ITEM_LEN), array("TEL_CHECK"));
235    $objErr->doFunc(array("FAX", "order_fax01", "order_fax02", "order_fax03", TEL_ITEM_LEN), array("TEL_CHECK"));
236    $objErr->doFunc(array("͹ÊØÈÖ¹æ", "order_zip01", "order_zip02"), array("ALL_EXIST_CHECK"));
237    $objErr->doFunc(array("TEL", "deliv_tel01", "deliv_tel02", "deliv_tel03", TEL_ITEM_LEN), array("TEL_CHECK"));
238    $objErr->doFunc(array("FAX", "deliv_fax01", "deliv_fax02", "deliv_fax03", TEL_ITEM_LEN), array("TEL_CHECK"));
239    $objErr->doFunc(array("͹ÊØÈÖ¹æ", "deliv_zip01", "deliv_zip02"), array("ALL_EXIST_CHECK"));
240    $objErr->doFunc(array("À¸Ç¯·îÆü", "year", "month", "day"), array("CHECK_DATE"));
241    $objErr->doFunc(array("¥á¡¼¥ë¥¢¥É¥ì¥¹", "¥á¡¼¥ë¥¢¥É¥ì¥¹¡Ê³Îǧ¡Ë", "order_email", "order_email_check"), array("EQUAL_CHECK"));
242   
243    // ¤¹¤Ç¤Ë¥á¥ë¥Þ¥¬¥Æ¡¼¥Ö¥ë¤Ë²ñ°÷¤È¤·¤Æ¥á¡¼¥ë¥¢¥É¥ì¥¹¤¬ÅÐÏ¿¤µ¤ì¤Æ¤¤¤ë¾ì¹ç
244    if(sfCheckCustomerMailMaga($arrRet['order_email'])) {
245        $objErr->arrErr['order_email'] = "¤³¤Î¥á¡¼¥ë¥¢¥É¥ì¥¹¤Ï¤¹¤Ç¤ËÅÐÏ¿¤µ¤ì¤Æ¤¤¤Þ¤¹¡£<br>";
246    }
247       
248    return $objErr->arrErr;
249}
250?>
Note: See TracBrowser for help on using the repository browser.