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

Revision 12892, 10.5 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$uniqid = sfCheckNormalAccess($objSiteSess, $objCartSess);
40// ¥æ¥Ë¡¼¥¯ID¤ò°ú¤­·Ñ¤°
41$objPage->tpl_uniqid = $uniqid;
42
43if(!empty($_POST["mode2"])){
44if ($_POST["mode2"] == "deliv") {
45           
46            $objFormParam = new SC_FormParam();
47            // ¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½
48           
49            // POSTÃͤμèÆÀ
50            $objFormParam->setParam($_POST);
51            $arrRet = $objFormParam->getHashArray();
52            $sqlval = $objFormParam->getDbArray();
53           
54            // ÆþÎÏÃͤμèÆÀ
55            $objPage->arrForm = $objFormParam->getFormParamList();
56            $objPage->arrErr = $arrErr;
57           foreach($_POST as $key => $value){
58               $objPage->arrAddr[0][$key] = $value;
59           }
60            lfRegistDataTemp($objPage->arrAddr[0]['uniqid'],$objPage->arrAddr[0]);
61           
62            lfCopyDeliv($objPage->tpl_uniqid, $_POST);
63           
64            $objPage->tpl_mainpage = 'nonmember/nonmember_deliv.tpl';
65            $objPage->tpl_title = '¤ªÆϤ±Àè¾ðÊó';
66            //objPage¤Î¾ðÊó¤òobjView¤Ë³ÊǼ
67            $objView->assignobj($objPage);
68            $objView->display(SITE_FRAME);
69        }
70       
71         if ($_POST["mode2"] == "customer_addr") {
72            //print_r($_POST);
73            if ($_POST['deli'] != "") {
74           
75           header("Location:" . gfAddSessionId("./payment.php"));
76            exit;
77    }else{
78        // ¥¨¥é¡¼¤òÊÖ¤¹
79        $arrErr['deli'] = '¢¨ ¤ªÆϤ±Àè¤òÁªÂò¤·¤Æ¤¯¤À¤µ¤¤¡£';
80            }
81        }
82    }elseif(!empty($_POST["mode"]) && $_POST["mode"]=="deliv_date"){ 
83        $objQuery = new SC_Query();
84       
85        //objPage¤Î¾ðÊó¤òobjView¤Ë³ÊǼ
86       
87        $where = "order_temp_id = ?";
88        $arrRet = $objQuery->select("*", "dtb_order_temp", $where, array($objPage->tpl_uniqid));
89        $objFormParam->setParam($arrRet[0]);
90        $objPage->arrForm = $objFormParam->getFormParamList();       
91       
92             foreach($objPage->arrForm as $key => $value){
93               $objPage->arrAddr[0][str_replace("order_","",$key)] = $value['value'];
94           }
95        $objPage->tpl_mainpage = 'nonmember/nonmember_deliv.tpl';
96        $objPage->tpl_title = '¤ªÆϤ±Àè¾ðÊó';
97        $objView->assignobj($objPage);
98        $objView->display(SITE_FRAME);
99    }
100
101//ÆþÎϤµ¤ì¤¿¾ðÊó¤ò¥Ç¡¼¥¿¥Ù¡¼¥¹dtb_order_temp¤Ë³ÊǼ¤¹¤ë
102function lfRegistDataTemp($uniqid,$array) {
103    global $objFormParam;
104    $arrRet = $objFormParam->getHashArray();
105    $sqlval = $objFormParam->getDbArray();
106       
107    // ÅÐÏ¿¥Ç¡¼¥¿¤ÎºîÀ®
108    $sqlval['order_temp_id'] = $uniqid;
109    $sqlval['order_birth'] = sfGetTimestamp($arrRet['year'], $arrRet['month'], $arrRet['day']);
110    $sqlval['update_date'] = 'Now()';
111    $sqlval['customer_id'] = '0';
112   
113    $sqlval['order_name01'] = $array['name01'];
114    $sqlval['order_name02'] = $array['name02'];
115    $sqlval['order_kana01'] = $array['kana01'];
116    $sqlval['order_kana02'] = $array['kana02'];
117    $sqlval['order_zip01'] = $array['zip01'];
118    $sqlval['order_zip02'] = $array['zip02'];
119    $sqlval['order_pref'] = $array['pref'];
120    $sqlval['order_addr01'] = $array['addr01'];
121    $sqlval['order_addr02'] = $array['addr02'];
122    $sqlval['order_tel01'] = $array['tel01'];
123    $sqlval['order_tel02'] = $array['tel02'];
124    $sqlval['order_tel03'] = $array['tel03'];
125    $sqlval['order_email'] = $array['email'];
126    $sqlval['order_sex'] = $array['sex'];
127         
128    // ´û¸¥Ç¡¼¥¿¤Î¥Á¥§¥Ã¥¯
129    $objQuery = new SC_Query();
130    $where = "order_temp_id = ?";
131    $cnt = $objQuery->count("dtb_order_temp", $where, array($uniqid));
132    // ´û¸¥Ç¡¼¥¿¤¬¤Ê¤¤¾ì¹ç
133    if ($cnt == 0) {
134        $sqlval['create_date'] = 'Now()';
135        $objQuery->insert("dtb_order_temp", $sqlval);
136    } else {
137        $objQuery->update("dtb_order_temp", $sqlval, $where, array($uniqid));
138    }
139}
140
141/* ¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½ */
142function lfInitParam() {
143    global $objFormParam;
144    $objFormParam->addParam("¤ªÌ¾Á°¡ÊÀ«¡Ë", "order_name01", STEXT_LEN, "KVa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
145    $objFormParam->addParam("¤ªÌ¾Á°¡Ê̾¡Ë", "order_name02", STEXT_LEN, "KVa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
146    $objFormParam->addParam("¥Õ¥ê¥¬¥Ê¡Ê¥»¥¤¡Ë", "order_kana01", STEXT_LEN, "KVCa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
147    $objFormParam->addParam("¥Õ¥ê¥¬¥Ê¡Ê¥á¥¤¡Ë", "order_kana02", STEXT_LEN, "KVCa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
148    $objFormParam->addParam("͹ÊØÈÖ¹æ1", "order_zip01", ZIP01_LEN, "n", array("EXIST_CHECK", "NUM_CHECK", "NUM_COUNT_CHECK"));
149    $objFormParam->addParam("͹ÊØÈÖ¹æ2", "order_zip02", ZIP02_LEN, "n", array("EXIST_CHECK", "NUM_CHECK", "NUM_COUNT_CHECK"));
150    $objFormParam->addParam("ÅÔÆ»Éܸ©", "order_pref", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"));
151    $objFormParam->addParam("½»½ê1", "order_addr01", STEXT_LEN, "KVa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
152    $objFormParam->addParam("½»½ê2", "order_addr02", STEXT_LEN, "KVa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
153    $objFormParam->addParam("ÅÅÏÃÈÖ¹æ1", "order_tel01", TEL_ITEM_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK" ,"NUM_CHECK"));
154    $objFormParam->addParam("ÅÅÏÃÈÖ¹æ2", "order_tel02", TEL_ITEM_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK" ,"NUM_CHECK"));
155    $objFormParam->addParam("ÅÅÏÃÈÖ¹æ3", "order_tel03", TEL_ITEM_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK" ,"NUM_CHECK"));
156    $objFormParam->addParam("FAXÈÖ¹æ1", "order_fax01", TEL_ITEM_LEN, "n", array("MAX_LENGTH_CHECK" ,"NUM_CHECK"));
157    $objFormParam->addParam("FAXÈÖ¹æ2", "order_fax02", TEL_ITEM_LEN, "n", array("MAX_LENGTH_CHECK" ,"NUM_CHECK"));
158    $objFormParam->addParam("FAXÈÖ¹æ3", "order_fax03", TEL_ITEM_LEN, "n", array("MAX_LENGTH_CHECK" ,"NUM_CHECK"));
159    $objFormParam->addParam("¥á¡¼¥ë¥¢¥É¥ì¥¹", "order_email", STEXT_LEN, "KVa", array("EXIST_CHECK", "SPTAB_CHECK", "NO_SPTAB", "MAX_LENGTH_CHECK", "EMAIL_CHECK", "EMAIL_CHAR_CHECK"));
160    $objFormParam->addParam("¥á¡¼¥ë¥¢¥É¥ì¥¹¡Ê³Îǧ¡Ë", "order_email_check", STEXT_LEN, "KVa", array("EXIST_CHECK", "SPTAB_CHECK", "NO_SPTAB", "MAX_LENGTH_CHECK", "EMAIL_CHECK", "EMAIL_CHAR_CHECK"), "", false);
161    $objFormParam->addParam("ǯ", "year", INT_LEN, "n", array("MAX_LENGTH_CHECK"), "", false);
162    $objFormParam->addParam("·î", "month", INT_LEN, "n", array("MAX_LENGTH_CHECK"), "", false);
163    $objFormParam->addParam("Æü", "day", INT_LEN, "n", array("MAX_LENGTH_CHECK"), "", false);
164    $objFormParam->addParam("À­ÊÌ", "order_sex", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"));
165    $objFormParam->addParam("¿¦¶È", "order_job", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"));
166    $objFormParam->addParam("Ê̤ΤªÆϤ±Àè", "deliv_check", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"));
167    $objFormParam->addParam("¤ªÌ¾Á°¡ÊÀ«¡Ë", "deliv_name01", STEXT_LEN, "KVa", array("SPTAB_CHECK", "MAX_LENGTH_CHECK"));
168    $objFormParam->addParam("¤ªÌ¾Á°¡Ê̾¡Ë", "deliv_name02", STEXT_LEN, "KVa", array("SPTAB_CHECK", "MAX_LENGTH_CHECK"));
169    $objFormParam->addParam("¥Õ¥ê¥¬¥Ê¡Ê¥»¥¤¡Ë", "deliv_kana01", STEXT_LEN, "KVCa", array("SPTAB_CHECK", "MAX_LENGTH_CHECK"));
170    $objFormParam->addParam("¥Õ¥ê¥¬¥Ê¡Ê¥á¥¤¡Ë", "deliv_kana02", STEXT_LEN, "KVCa", array("SPTAB_CHECK", "MAX_LENGTH_CHECK"));
171    $objFormParam->addParam("͹ÊØÈÖ¹æ1", "deliv_zip01", ZIP01_LEN, "n", array("NUM_CHECK", "NUM_COUNT_CHECK"));
172    $objFormParam->addParam("͹ÊØÈÖ¹æ2", "deliv_zip02", ZIP02_LEN, "n", array("NUM_CHECK", "NUM_COUNT_CHECK"));
173    $objFormParam->addParam("ÅÔÆ»Éܸ©", "deliv_pref", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"));
174    $objFormParam->addParam("½»½ê1", "deliv_addr01", STEXT_LEN, "KVa", array("SPTAB_CHECK", "MAX_LENGTH_CHECK"));
175    $objFormParam->addParam("½»½ê2", "deliv_addr02", STEXT_LEN, "KVa", array("SPTAB_CHECK", "MAX_LENGTH_CHECK"));
176    $objFormParam->addParam("ÅÅÏÃÈÖ¹æ1", "deliv_tel01", TEL_ITEM_LEN, "n", array("MAX_LENGTH_CHECK" ,"NUM_CHECK"));
177    $objFormParam->addParam("ÅÅÏÃÈÖ¹æ2", "deliv_tel02", TEL_ITEM_LEN, "n", array("MAX_LENGTH_CHECK" ,"NUM_CHECK"));
178    $objFormParam->addParam("ÅÅÏÃÈÖ¹æ3", "deliv_tel03", TEL_ITEM_LEN, "n", array("MAX_LENGTH_CHECK" ,"NUM_CHECK"));
179    $objFormParam->addParam("¥á¡¼¥ë¥Þ¥¬¥¸¥ó", "mail_flag", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"), 1);
180}
181
182/* DB¤Ø¥Ç¡¼¥¿¤ÎÅÐÏ¿ */
183
184
185// ¼õÃí°ì»þ¥Æ¡¼¥Ö¥ë¤Î¤ªÆϤ±Àè¤ò¥³¥Ô¡¼¤¹¤ë
186function lfCopyDeliv($uniqid, $arrData) {
187    $objQuery = new SC_Query();
188   
189    // Ê̤ΤªÆϤ±Àè¤ò»ØÄꤷ¤Æ¤¤¤Ê¤¤¾ì¹ç¡¢ÇÛÁ÷Àè¤ËÅÐÏ¿½»½ê¤ò¥³¥Ô¡¼¤¹¤ë¡£
190    if($arrData["deliv_check"] != "1") {
191        $sqlval['deliv_name01'] = $arrData['order_name01'];
192        $sqlval['deliv_name02'] = $arrData['order_name02'];
193        $sqlval['deliv_kana01'] = $arrData['order_kana01'];
194        $sqlval['deliv_kana02'] = $arrData['order_kana02'];
195        $sqlval['deliv_pref'] = $arrData['order_pref'];
196        $sqlval['deliv_zip01'] = $arrData['order_zip01'];
197        $sqlval['deliv_zip02'] = $arrData['order_zip02'];
198        $sqlval['deliv_addr01'] = $arrData['order_addr01'];
199        $sqlval['deliv_addr02'] = $arrData['order_addr02'];
200        $sqlval['deliv_tel01'] = $arrData['order_tel01'];
201        $sqlval['deliv_tel02'] = $arrData['order_tel02'];
202        $sqlval['deliv_tel03'] = $arrData['order_tel03'];
203        $where = "order_temp_id = ?";
204        $objQuery->update("dtb_order_temp", $sqlval, $where, array($uniqid));
205    }
206}
207
208?>
Note: See TracBrowser for help on using the repository browser.