source: branches/dev/html/mobile/shopping/index.php @ 12693

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