source: branches/mobile/html/regist/index.php @ 10399

Revision 10399, 5.6 KB checked in by uehara, 16 years ago (diff)
  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1<?php
2/*
3 * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
4 *
5 * http://www.lockon.co.jp/
6 */
7
8require_once("../require.php");
9
10//---- ¥Ú¡¼¥¸É½¼¨¥¯¥é¥¹
11class LC_Page {
12   
13    var $arrSession;
14    var $tpl_mainpage;
15    var $arrPref;
16
17    function LC_Page() {
18        $this->tpl_css = URL_DIR.'css/layout/regist/index.css'; // ¥á¥¤¥óCSS¥Ñ¥¹
19    }
20}
21
22$objConn = new SC_DBConn();
23$objPage = new LC_Page();
24$objView = new SC_SiteView();
25$objSiteInfo = $objView->objSiteInfo;
26$objCustomer = new SC_Customer();
27$CONF = sf_getBasisData();
28$arrInfo = $objSiteInfo->data;
29
30//--¡¡ËÜÅÐÏ¿´°Î»¤Î¤¿¤á¤Ë¥á¡¼¥ë¤«¤éÀܳ¤·¤¿¾ì¹ç
31if ($_GET["mode"] == "regist") {
32   
33    //-- ÆþÎÏ¥Á¥§¥Ã¥¯
34    $objPage->arrErr = lfErrorCheck($_GET);
35    if ($objPage->arrErr) {
36        $objPage->tpl_mainpage = 'regist/error.tpl';
37        $objPage->tpl_css = "/css/layout/regist/error.css";
38        $objPage->tpl_title = '¥¨¥é¡¼';
39
40    } else {
41        //$objPage->tpl_mainpage = 'regist/complete.tpl';
42        //$objPage->tpl_title = ' ²ñ°÷ÅÐÏ¿(´°Î»¥Ú¡¼¥¸)';
43        $registSecretKey = lfRegistData($_GET);         //Ëܲñ°÷ÅÐÏ¿¡Ê¥Õ¥é¥°Êѹ¹¡Ë
44        lfSendRegistMail($registSecretKey);             //Ëܲñ°÷ÅÐÏ¿´°Î»¥á¡¼¥ëÁ÷¿®
45
46        // ¥í¥°¥¤¥óºÑ¤ß¤Î¾õÂ֤ˤ¹¤ë¡£
47        $objQuery = new SC_Query();
48        $email = $objQuery->get("dtb_customer", "email", "secret_key = ?", array($registSecretKey));
49        $objCustomer->setLogin($email);
50        header("Location: ./complete.php");
51        exit;
52    }
53
54//--¡¡¤½¤ì°Ê³°¤Î¥¢¥¯¥»¥¹¤Ï̵¸ú¤È¤¹¤ë
55} else {
56    $objPage->arrErr["id"] = "̵¸ú¤Ê¥¢¥¯¥»¥¹¤Ç¤¹¡£";
57    $objPage->tpl_mainpage = 'regist/error.tpl';
58    $objPage->tpl_css = "/css/layout/regist/error.css";
59    $objPage->tpl_title = '¥¨¥é¡¼';
60
61}
62
63//----¡¡¥Ú¡¼¥¸É½¼¨
64$objView->assignobj($objPage);
65$objView->display(SITE_FRAME);
66
67//---- ÅÐÏ¿
68function lfRegistData($array) {
69    global $objConn;
70    global $arrInfo;
71   
72    do {
73        $secret = sfGetUniqRandomId("r");
74    } while( ($result = $objConn->getOne("SELECT COUNT(*) FROM dtb_customer WHERE secret_key = ?", array($secret)) ) != 0);
75
76    $sql = "SELECT email FROM dtb_customer WHERE secret_key = ? AND status = 1";
77    $email = $objConn->getOne($sql, array($array["id"]));
78
79    $objConn->query("BEGIN");
80    $arrRegist["secret_key"] = $secret; //¡¡ËÜÅÐÏ¿IDȯ¹Ô
81    $arrRegist["status"] = 2;
82    $arrRegist["update_date"] = "NOW()";
83   
84    $objQuery = new SC_Query();
85    $where = "secret_key = ? AND status = 1";
86   
87    $arrRet = $objQuery->select("point", "dtb_customer", $where, array($array["id"]));
88    // ²ñ°÷ÅÐÏ¿»þ¤Î²Ã»»¥Ý¥¤¥ó¥È(¹ØÆþ»þ²ñ°÷ÅÐÏ¿¤Î¾ì¹ç¤Ï¡¢¥Ý¥¤¥ó¥È²Ã»»¡Ë
89    $arrRegist['point'] = $arrRet[0]['point'] + addslashes($arrInfo['welcome_point']);
90   
91    $objQuery->update("dtb_customer", $arrRegist, $where, array($array["id"]));
92
93    /* ¹ØÆþ»þ¤Î¼«Æ°²ñ°÷ÅÐÏ¿¤Ï¹Ô¤ï¤Ê¤¤¤¿¤áDEL
94    // ¹ØÆþ»þÅÐÏ¿¤Î¾ì¹ç¡¢¤½¤Î²ó¤Î¹ØÆþ¤ò²ñ°÷¹ØÆþ¤È¤ß¤Ê¤¹¡£
95    // ²ñ°÷¾ðÊó¤ÎÆɤ߹þ¤ß
96    $where1 = "secret_key = ? AND status = 2";
97    $customer = $objQuery->select("*", "dtb_customer", $where1, array($secret));
98    // ½é²ó¹ØÆþ¾ðÊó¤ÎÆɤ߹þ¤ß
99    $order_temp_id = $objQuery->get("dtb_order_temp", "order_temp_id");
100    // ¹ØÆþ¾ðÊó¤Î¹¹¿·
101    if ($order_temp_id != null) {
102        $arrCustomer['customer_id'] = $customer[0]['customer_id'];
103        $where3 = "order_temp_id = ?";
104        $objQuery->update("dtb_order_temp", $arrCustomer, $where3, array($order_temp_id));
105        $objQuery->update("dtb_order", $arrCustomer, $where3, array($order_temp_id));
106    }
107    */
108
109    $sql = "SELECT mail_flag FROM dtb_customer_mail WHERE email = ?";
110    $result = $objConn->getOne($sql, array($email));
111   
112    switch($result) {
113    // ²¾HTML
114    case '4':
115        $arrRegistMail["mail_flag"] = 1;
116        break;
117    // ²¾TEXT
118    case '5':
119        $arrRegistMail["mail_flag"] = 2;
120        break;
121    // ²¾¤Ê¤·
122    case '6':
123        $arrRegistMail["mail_flag"] = 3;
124        break;
125    default:
126        $arrRegistMail["mail_flag"] = $result;
127        break;
128    }
129
130    $objConn->autoExecute("dtb_customer_mail", $arrRegistMail, "email = '" .addslashes($email). "'");
131    $objConn->query("COMMIT");
132       
133    return $secret;     // ËÜÅÐÏ¿ID¤òÊÖ¤¹
134}
135
136//---- ÆþÎÏ¥¨¥é¡¼¥Á¥§¥Ã¥¯
137function lfErrorCheck($array) {
138
139    global $objConn;
140    $objErr = new SC_CheckError($array);
141
142    $objErr->doFunc(array("²¾ÅÐÏ¿ID", 'id'), array("EXIST_CHECK"));
143    if (! EregI("^[[:alnum:]]+$",$array["id"] )) {
144        $objErr->arrErr["id"] = "̵¸ú¤ÊURL¤Ç¤¹¡£¥á¡¼¥ë¤Ëµ­ºÜ¤µ¤ì¤Æ¤¤¤ëËܲñ°÷ÅÐÏ¿ÍÑURL¤òºÆÅÙ¤´³Îǧ¤¯¤À¤µ¤¤¡£";
145    }
146    if (! $objErr->arrErr["id"]) {
147
148        $sql = "SELECT customer_id FROM dtb_customer WHERE secret_key = ? AND status = 1 AND del_flg = 0";
149        $result = $objConn->getOne($sql, array($array["id"]));
150
151        if (! is_numeric($result)) {
152            $objErr->arrErr["id"] .= "¢¨ ´û¤Ë²ñ°÷ÅÐÏ¿¤¬´°Î»¤·¤Æ¤¤¤ë¤«¡¢Ìµ¸ú¤ÊURL¤Ç¤¹¡£<br>";
153            return $objErr->arrErr;
154
155        }
156    }
157
158    return $objErr->arrErr;
159}
160
161//---- Àµ²ñ°÷ÅÐÏ¿´°Î»¥á¡¼¥ëÁ÷¿®
162function lfSendRegistMail($registSecretKey) {
163    global $objConn;
164    global $CONF;
165
166    //-- À«Ì¾¤ò¼èÆÀ
167    $sql = "SELECT email, name01, name02 FROM dtb_customer WHERE secret_key = ?";
168    $result = $objConn->getAll($sql, array($registSecretKey));
169    $data = $result[0];
170   
171    //--¡¡¥á¡¼¥ëÁ÷¿®
172    $objMailText = new SC_SiteView();
173    $objMailText->assign("CONF", $CONF);
174    $objMailText->assign("name01", $data["name01"]);
175    $objMailText->assign("name02", $data["name02"]);
176    $toCustomerMail = $objMailText->fetch("mail_templates/customer_regist_mail.tpl");
177    $subject = sfMakeSubject('Ëܲñ°÷ÅÐÏ¿¤¬´°Î»¤·¤Þ¤·¤¿¡£');
178    $objMail = new GC_SendMail();
179
180    $objMail->setItem(
181                          ''                                //¡¡°¸Àè
182                        , $subject//"¡Ú" .$CONF["shop_name"]. "¡Û".ENTRY_CUSTOMER_REGIST_SUBJECT        //¡¡¥µ¥Ö¥¸¥§¥¯¥È
183                        , $toCustomerMail                   //¡¡ËÜʸ
184                        , $CONF["email03"]                  //¡¡ÇÛÁ÷¸µ¥¢¥É¥ì¥¹
185                        , $CONF["shop_name"]                //¡¡ÇÛÁ÷¸µ¡¡Ì¾Á°
186                        , $CONF["email03"]                  //¡¡reply_to
187                        , $CONF["email04"]                  //¡¡return_path
188                        , $CONF["email04"]                  //  Errors_to
189                    );
190    // °¸Àè¤ÎÀßÄê
191    $name = $data["name01"] . $data["name02"] ." ÍÍ";
192    $objMail->setTo($data["email"], $name);
193    $objMail->sendMail();
194}
195
196?>
Note: See TracBrowser for help on using the repository browser.