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

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