source: branches/dev/html/mobile/nonmember/deliv.php @ 14831

Revision 14831, 10.7 KB checked in by nakanishi, 15 years ago (diff)
Line 
1<?php
2
3require_once("../require.php");
4
5class LC_Page {
6    var $arrSession;
7    var $tpl_mode;
8    var $tpl_login_email;
9    function LC_Page() {
10        $this->tpl_mainpage = 'nonmember/index.tpl';
11        global $arrPref;
12        $this->arrPref = $arrPref;
13        global $arrSex;
14        $this->arrSex = $arrSex;
15        global $arrJob;
16        $this->arrJob = $arrJob;
17        $this->tpl_onload = 'fnCheckInputDeliv();';
18       
19        /*
20         session_start»þ¤Îno-cache¥Ø¥Ã¥À¡¼¤òÍÞÀ©¤¹¤ë¤³¤È¤Ç
21         ¡ÖÌá¤ë¡×¥Ü¥¿¥ó»ÈÍÑ»þ¤ÎÍ­¸ú´ü¸ÂÀÚ¤ìɽ¼¨¤òÍÞÀ©¤¹¤ë¡£
22         private-no-expire:¥¯¥é¥¤¥¢¥ó¥È¤Î¥­¥ã¥Ã¥·¥å¤òµö²Ä¤¹¤ë¡£
23        */
24        session_cache_limiter('private-no-expire');             
25    }
26}
27
28$conn = new SC_DBConn();
29$objPage = new LC_Page();
30$objView = new SC_MobileView();
31$objSiteSess = new SC_SiteSession();
32$objCartSess = new SC_CartSession();
33$objCustomer = new SC_Customer();
34$objCookie = new SC_Cookie();
35$objFormParam = new SC_FormParam();         // ¥Õ¥©¡¼¥àÍÑ
36lfInitParam();                              // ¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½
37$objFormParam->setParam($_POST);            // POSTÃͤμèÆÀ
38
39// ¥æ¡¼¥¶¥æ¥Ë¡¼¥¯ID¤Î¼èÆÀ¤È¹ØÆþ¾õÂÖ¤ÎÀµÅöÀ­¤ò¥Á¥§¥Ã¥¯
40$uniqid = sfCheckNormalAccess($objSiteSess, $objCartSess);
41
42// ¥æ¥Ë¡¼¥¯ID¤ò°ú¤­·Ñ¤°
43$objPage->tpl_uniqid = $uniqid;
44
45if(!empty($_POST["mode2"]) ){
46    if ($_POST["mode2"] == "deliv") {
47           
48            $objFormParam = new SC_FormParam();
49            // ¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½
50           
51            // POSTÃͤμèÆÀ
52            $objFormParam->setParam($_POST);
53            $arrRet = $objFormParam->getHashArray();
54            $sqlval = $objFormParam->getDbArray();
55           
56            // ÆþÎÏÃͤμèÆÀ
57            $objPage->arrForm = $objFormParam->getFormParamList();
58            $objPage->arrErr = $arrErr;
59           
60           foreach($_POST as $key => $value){
61               $objPage->arrAddr[0][$key] = $value;
62           }
63           
64            //¥Ç¡¼¥¿¥Ù¡¼¥¹¤Î°ì»þÊݸÍѥơ¼¥Ö¥ëdtb_order_temp¤Ë¥Ç¡¼¥¿¤ò³ÊǼ¤¹¤ë
65            lfRegistDataTemp($objPage->arrAddr[0]['uniqid'],$objPage->arrAddr[0]);
66           
67            lfCopyDeliv($objPage->tpl_uniqid, $_POST);
68           
69            $objPage->tpl_mainpage = 'nonmember/nonmember_deliv.tpl';
70            $objPage->tpl_title = '¤ªÆϤ±Àè¾ðÊó';
71            //objPage¤Î¾ðÊó¤òobjView¤Ë³ÊǼ
72            $objView->assignobj($objPage);
73            $objView->display(SITE_FRAME);
74        }
75       
76        if ($_POST["mode2"] == "customer_addr") {
77            //print_r($_POST);
78            if ($_POST['deli'] != "") {
79                header("Location:" . gfAddSessionId("./payment1.php"));
80            exit;
81            }else{
82                // ¥¨¥é¡¼¤òÊÖ¤¹
83                $arrErr['deli'] = '¢¨ ¤ªÆϤ±Àè¤òÁªÂò¤·¤Æ¤¯¤À¤µ¤¤¡£';
84            }
85        }
86//Ìá¤ë¥Ü¥¿¥óÍѽèÍý       
87}elseif(!empty($_POST["mode"]) && $_POST["mode"]=="deliv_date"){ 
88    //uniqid¤«¤é¥Ç¡¼¥¿¥Ù¡¼¥¹¤Î¥Ç¡¼¥¿¤òÆɤ߹þ¤ßɽ¼¨¤¹¤ë
89    $objQuery = new SC_Query();
90    $where = "order_temp_id = ?";
91    $arrRet = $objQuery->select("*", "dtb_order_temp", $where, array($objPage->tpl_uniqid));
92    $objFormParam->setParam($arrRet[0]);
93    $objPage->arrForm = $objFormParam->getFormParamList();       
94   
95         foreach($objPage->arrForm as $key => $value){
96           $objPage->arrAddr[0][str_replace("order_","",$key)] = $value['value'];
97       }
98    $objPage->tpl_mainpage = 'nonmember/nonmember_deliv.tpl';
99    $objPage->tpl_title = '¤ªÆϤ±Àè¾ðÊó';
100    $objView->assignobj($objPage);
101    $objView->display(SITE_FRAME);
102}
103
104/**
105 *ÆþÎϤµ¤ì¤¿¾ðÊó¤ò¥Ç¡¼¥¿¥Ù¡¼¥¹dtb_order_temp¤Ë³ÊǼ¤¹¤ë
106 *
107 * @param string $uniqid unique id
108 * @param array $array
109 *
110*/
111function lfRegistDataTemp($uniqid,$array) {
112    global $objFormParam;
113    $arrRet = $objFormParam->getHashArray();
114    $sqlval = $objFormParam->getDbArray();
115       
116    // ÅÐÏ¿¥Ç¡¼¥¿¤ÎºîÀ®
117    $sqlval['order_temp_id'] = $uniqid;
118    $sqlval['order_birth'] = sfGetTimestamp($arrRet['year'], $arrRet['month'], $arrRet['day']);
119    $sqlval['update_date'] = 'Now()';
120    $sqlval['customer_id'] = '0';
121   
122    $sqlval['order_name01'] = $array['name01'];
123    $sqlval['order_name02'] = $array['name02'];
124    $sqlval['order_kana01'] = $array['kana01'];
125    $sqlval['order_kana02'] = $array['kana02'];
126    $sqlval['order_zip01'] = $array['zip01'];
127    $sqlval['order_zip02'] = $array['zip02'];
128    $sqlval['order_pref'] = $array['pref'];
129    $sqlval['order_addr01'] = $array['addr01'];
130    $sqlval['order_addr02'] = $array['addr02'];
131    $sqlval['order_tel01'] = $array['tel01'];
132    $sqlval['order_tel02'] = $array['tel02'];
133    $sqlval['order_tel03'] = $array['tel03'];
134    $sqlval['order_email'] = $array['email'];
135    $sqlval['order_sex'] = $array['sex'];
136         
137    // ´û¸¥Ç¡¼¥¿¤Î¥Á¥§¥Ã¥¯
138    $objQuery = new SC_Query();
139    $where = "order_temp_id = ?";
140    $cnt = $objQuery->count("dtb_order_temp", $where, array($uniqid));
141    // ´û¸¥Ç¡¼¥¿¤¬¤Ê¤¤¾ì¹ç
142    if ($cnt == 0) {
143        $sqlval['create_date'] = 'Now()';
144        $objQuery->insert("dtb_order_temp", $sqlval);
145    } else {
146        $objQuery->update("dtb_order_temp", $sqlval, $where, array($uniqid));
147    }
148}
149
150/* ¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½ */
151function lfInitParam() {
152    global $objFormParam;
153    $objFormParam->addParam("¤ªÌ¾Á°¡ÊÀ«¡Ë", "order_name01", STEXT_LEN, "KVa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
154    $objFormParam->addParam("¤ªÌ¾Á°¡Ê̾¡Ë", "order_name02", STEXT_LEN, "KVa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
155    $objFormParam->addParam("¥Õ¥ê¥¬¥Ê¡Ê¥»¥¤¡Ë", "order_kana01", STEXT_LEN, "KVCa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
156    $objFormParam->addParam("¥Õ¥ê¥¬¥Ê¡Ê¥á¥¤¡Ë", "order_kana02", STEXT_LEN, "KVCa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
157    $objFormParam->addParam("͹ÊØÈÖ¹æ1", "order_zip01", ZIP01_LEN, "n", array("EXIST_CHECK", "NUM_CHECK", "NUM_COUNT_CHECK"));
158    $objFormParam->addParam("͹ÊØÈÖ¹æ2", "order_zip02", ZIP02_LEN, "n", array("EXIST_CHECK", "NUM_CHECK", "NUM_COUNT_CHECK"));
159    $objFormParam->addParam("ÅÔÆ»Éܸ©", "order_pref", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"));
160    $objFormParam->addParam("½»½ê1", "order_addr01", STEXT_LEN, "KVa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
161    $objFormParam->addParam("½»½ê2", "order_addr02", STEXT_LEN, "KVa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
162    $objFormParam->addParam("ÅÅÏÃÈÖ¹æ1", "order_tel01", TEL_ITEM_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK" ,"NUM_CHECK"));
163    $objFormParam->addParam("ÅÅÏÃÈÖ¹æ2", "order_tel02", TEL_ITEM_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK" ,"NUM_CHECK"));
164    $objFormParam->addParam("ÅÅÏÃÈÖ¹æ3", "order_tel03", TEL_ITEM_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK" ,"NUM_CHECK"));
165    $objFormParam->addParam("FAXÈÖ¹æ1", "order_fax01", TEL_ITEM_LEN, "n", array("MAX_LENGTH_CHECK" ,"NUM_CHECK"));
166    $objFormParam->addParam("FAXÈÖ¹æ2", "order_fax02", TEL_ITEM_LEN, "n", array("MAX_LENGTH_CHECK" ,"NUM_CHECK"));
167    $objFormParam->addParam("FAXÈÖ¹æ3", "order_fax03", TEL_ITEM_LEN, "n", array("MAX_LENGTH_CHECK" ,"NUM_CHECK"));
168    $objFormParam->addParam("¥á¡¼¥ë¥¢¥É¥ì¥¹", "order_email", STEXT_LEN, "KVa", array("EXIST_CHECK", "SPTAB_CHECK", "NO_SPTAB", "MAX_LENGTH_CHECK", "EMAIL_CHECK", "EMAIL_CHAR_CHECK"));
169    $objFormParam->addParam("¥á¡¼¥ë¥¢¥É¥ì¥¹¡Ê³Îǧ¡Ë", "order_email_check", STEXT_LEN, "KVa", array("EXIST_CHECK", "SPTAB_CHECK", "NO_SPTAB", "MAX_LENGTH_CHECK", "EMAIL_CHECK", "EMAIL_CHAR_CHECK"), "", false);
170    $objFormParam->addParam("ǯ", "year", INT_LEN, "n", array("MAX_LENGTH_CHECK"), "", false);
171    $objFormParam->addParam("·î", "month", INT_LEN, "n", array("MAX_LENGTH_CHECK"), "", false);
172    $objFormParam->addParam("Æü", "day", INT_LEN, "n", array("MAX_LENGTH_CHECK"), "", false);
173    $objFormParam->addParam("À­ÊÌ", "order_sex", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"));
174    $objFormParam->addParam("¿¦¶È", "order_job", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"));
175    $objFormParam->addParam("Ê̤ΤªÆϤ±Àè", "deliv_check", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"));
176    $objFormParam->addParam("¤ªÌ¾Á°¡ÊÀ«¡Ë", "deliv_name01", STEXT_LEN, "KVa", array("SPTAB_CHECK", "MAX_LENGTH_CHECK"));
177    $objFormParam->addParam("¤ªÌ¾Á°¡Ê̾¡Ë", "deliv_name02", STEXT_LEN, "KVa", array("SPTAB_CHECK", "MAX_LENGTH_CHECK"));
178    $objFormParam->addParam("¥Õ¥ê¥¬¥Ê¡Ê¥»¥¤¡Ë", "deliv_kana01", STEXT_LEN, "KVCa", array("SPTAB_CHECK", "MAX_LENGTH_CHECK"));
179    $objFormParam->addParam("¥Õ¥ê¥¬¥Ê¡Ê¥á¥¤¡Ë", "deliv_kana02", STEXT_LEN, "KVCa", array("SPTAB_CHECK", "MAX_LENGTH_CHECK"));
180    $objFormParam->addParam("͹ÊØÈÖ¹æ1", "deliv_zip01", ZIP01_LEN, "n", array("NUM_CHECK", "NUM_COUNT_CHECK"));
181    $objFormParam->addParam("͹ÊØÈÖ¹æ2", "deliv_zip02", ZIP02_LEN, "n", array("NUM_CHECK", "NUM_COUNT_CHECK"));
182    $objFormParam->addParam("ÅÔÆ»Éܸ©", "deliv_pref", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"));
183    $objFormParam->addParam("½»½ê1", "deliv_addr01", STEXT_LEN, "KVa", array("SPTAB_CHECK", "MAX_LENGTH_CHECK"));
184    $objFormParam->addParam("½»½ê2", "deliv_addr02", STEXT_LEN, "KVa", array("SPTAB_CHECK", "MAX_LENGTH_CHECK"));
185    $objFormParam->addParam("ÅÅÏÃÈÖ¹æ1", "deliv_tel01", TEL_ITEM_LEN, "n", array("MAX_LENGTH_CHECK" ,"NUM_CHECK"));
186    $objFormParam->addParam("ÅÅÏÃÈÖ¹æ2", "deliv_tel02", TEL_ITEM_LEN, "n", array("MAX_LENGTH_CHECK" ,"NUM_CHECK"));
187    $objFormParam->addParam("ÅÅÏÃÈÖ¹æ3", "deliv_tel03", TEL_ITEM_LEN, "n", array("MAX_LENGTH_CHECK" ,"NUM_CHECK"));
188    $objFormParam->addParam("¥á¡¼¥ë¥Þ¥¬¥¸¥ó", "mail_flag", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"), 1);
189}
190
191/* DB¤Ø¥Ç¡¼¥¿¤ÎÅÐÏ¿ */
192
193
194// ¼õÃí°ì»þ¥Æ¡¼¥Ö¥ë¤Î¤ªÆϤ±Àè¤ò¥³¥Ô¡¼¤¹¤ë
195function lfCopyDeliv($uniqid, $arrData) {
196    $objQuery = new SC_Query();
197   
198    // Ê̤ΤªÆϤ±Àè¤ò»ØÄꤷ¤Æ¤¤¤Ê¤¤¾ì¹ç¡¢ÇÛÁ÷Àè¤ËÅÐÏ¿½»½ê¤ò¥³¥Ô¡¼¤¹¤ë¡£
199    if($arrData["deliv_check"] != "1") {
200        $sqlval['deliv_name01'] = $arrData['order_name01'];
201        $sqlval['deliv_name02'] = $arrData['order_name02'];
202        $sqlval['deliv_kana01'] = $arrData['order_kana01'];
203        $sqlval['deliv_kana02'] = $arrData['order_kana02'];
204        $sqlval['deliv_pref'] = $arrData['order_pref'];
205        $sqlval['deliv_zip01'] = $arrData['order_zip01'];
206        $sqlval['deliv_zip02'] = $arrData['order_zip02'];
207        $sqlval['deliv_addr01'] = $arrData['order_addr01'];
208        $sqlval['deliv_addr02'] = $arrData['order_addr02'];
209        $sqlval['deliv_tel01'] = $arrData['order_tel01'];
210        $sqlval['deliv_tel02'] = $arrData['order_tel02'];
211        $sqlval['deliv_tel03'] = $arrData['order_tel03'];
212        $where = "order_temp_id = ?";
213        $objQuery->update("dtb_order_temp", $sqlval, $where, array($uniqid));
214    }
215}
216
217?>
Note: See TracBrowser for help on using the repository browser.