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

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