source: branches/beta/html/mobile/regist/index.php @ 16972

Revision 16972, 4.7 KB checked in by satou, 14 years ago (diff)

#160 会員登録時付与ポイントが反映されない不具合を改修

  • Property svn:eol-style set to native
Line 
1<?php
2/*
3 * Copyright(c) 2000-2007 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 = '/css/layout/regist/index.css';    // ¥á¥¤¥óCSS¥Ñ¥¹
19    }
20}
21
22$objConn = new SC_DBConn();
23$objPage = new LC_Page();
24$objView = new SC_MobileView();
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        //Ëܲñ°÷ÅÐÏ¿¡Ê¥Õ¥é¥°Êѹ¹¡Ë
42        $registSecretKey = lfRegistData($_GET);
43        //Ëܲñ°÷ÅÐÏ¿´°Î»¥á¡¼¥ëÁ÷¿®
44        lfSendRegistMail($registSecretKey);
45        // ²ñ°÷ÅÐÏ¿¥Ý¥¤¥ó¥ÈÉÕÍ¿
46        sfSetWelcomePoint($registSecretKey, $CONF);
47        // ¥í¥°¥¤¥óºÑ¤ß¤Î¾õÂ֤ˤ¹¤ë¡£
48        $objQuery = new SC_Query();
49        $email = $objQuery->get("dtb_customer", "email", "secret_key = ?", array($registSecretKey));
50        $objCustomer->setLogin($email);
51        header("Location: " . gfAddSessionId("./complete.php"));
52        exit;
53    }
54
55//--¡¡¤½¤ì°Ê³°¤Î¥¢¥¯¥»¥¹¤Ï̵¸ú¤È¤¹¤ë
56} else {
57    $objPage->arrErr["id"] = "̵¸ú¤Ê¥¢¥¯¥»¥¹¤Ç¤¹¡£";
58    $objPage->tpl_mainpage = 'regist/error.tpl';
59    $objPage->tpl_css = "/css/layout/regist/error.css";
60    $objPage->tpl_title = '¥¨¥é¡¼';
61
62}
63
64//----¡¡¥Ú¡¼¥¸É½¼¨
65$objView->assignobj($objPage);
66$objView->display(SITE_FRAME);
67
68//---- ÅÐÏ¿
69function lfRegistData($array) {
70    global $objConn;
71    global $arrInfo;
72   
73    do {
74        $secret = sfGetUniqRandomId("r");
75    } while( ($result = $objConn->getOne("SELECT COUNT(*) FROM dtb_customer WHERE secret_key = ?", array($secret)) ) != 0);
76
77    $sql = "SELECT email FROM dtb_customer WHERE secret_key = ? AND status = 1";
78    $email = $objConn->getOne($sql, array($array["id"]));
79
80    $objConn->query("BEGIN");
81    $arrRegist["secret_key"] = $secret; //¡¡ËÜÅÐÏ¿IDȯ¹Ô
82    $arrRegist["status"] = 2;
83    $arrRegist["update_date"] = "NOW()";
84   
85    $objQuery = new SC_Query();
86    $where = "secret_key = ? AND status = 1";
87    $objQuery->update("dtb_customer", $arrRegist, $where, array($array["id"]));
88
89    $sql = "SELECT mailmaga_flg FROM dtb_customer WHERE email = ?";
90    $result = $objConn->getOne($sql, array($email));
91   
92    switch($result) {
93    // ²¾HTML
94    case '4':
95        $arrRegistMail["mailmaga_flg"] = 1;
96        break;
97    // ²¾TEXT
98    case '5':
99        $arrRegistMail["mailmaga_flg"] = 2;
100        break;
101    // ²¾¤Ê¤·
102    case '6':
103        $arrRegistMail["mailmaga_flg"] = 3;
104        break;
105    default:
106        $arrRegistMail["mailmaga_flg"] = $result;
107        break;
108    }
109
110    $objQuery->update("dtb_customer", $arrRegistMail, "email = '" .addslashes($email). "' AND del_flg = 0");
111    $objConn->query("COMMIT");
112       
113    return $secret;     // ËÜÅÐÏ¿ID¤òÊÖ¤¹
114}
115
116//---- ÆþÎÏ¥¨¥é¡¼¥Á¥§¥Ã¥¯
117function lfErrorCheck($array) {
118
119    global $objConn;
120    $objErr = new SC_CheckError($array);
121
122    $objErr->doFunc(array("²¾ÅÐÏ¿ID", 'id'), array("EXIST_CHECK"));
123    if (! EregI("^[[:alnum:]]+$",$array["id"] )) {
124        $objErr->arrErr["id"] = "̵¸ú¤ÊURL¤Ç¤¹¡£¥á¡¼¥ë¤Ëµ­ºÜ¤µ¤ì¤Æ¤¤¤ëËܲñ°÷ÅÐÏ¿ÍÑURL¤òºÆÅÙ¤´³Îǧ¤¯¤À¤µ¤¤¡£";
125    }
126    if (! $objErr->arrErr["id"]) {
127
128        $sql = "SELECT customer_id FROM dtb_customer WHERE secret_key = ? AND status = 1 AND del_flg = 0";
129        $result = $objConn->getOne($sql, array($array["id"]));
130
131        if (! is_numeric($result)) {
132            $objErr->arrErr["id"] .= "¢¨ ´û¤Ë²ñ°÷ÅÐÏ¿¤¬´°Î»¤·¤Æ¤¤¤ë¤«¡¢Ìµ¸ú¤ÊURL¤Ç¤¹¡£<br>";
133            return $objErr->arrErr;
134
135        }
136    }
137
138    return $objErr->arrErr;
139}
140
141//---- Àµ²ñ°÷ÅÐÏ¿´°Î»¥á¡¼¥ëÁ÷¿®
142function lfSendRegistMail($registSecretKey) {
143    global $objConn;
144    global $CONF;
145
146    //-- À«Ì¾¤ò¼èÆÀ
147    $sql = "SELECT email, name01, name02 FROM dtb_customer WHERE secret_key = ?";
148    $result = $objConn->getAll($sql, array($registSecretKey));
149    $data = $result[0];
150   
151    //--¡¡¥á¡¼¥ëÁ÷¿®
152    $objMailText = new SC_MobileView();
153    $objMailText->assign("CONF", $CONF);
154    $objMailText->assign("name01", $data["name01"]);
155    $objMailText->assign("name02", $data["name02"]);
156    $toCustomerMail = $objMailText->fetch("mail_templates/customer_regist_mail.tpl");
157    $subject = sfMakeSubject('Ëܲñ°÷ÅÐÏ¿¤¬´°Î»¤·¤Þ¤·¤¿¡£');
158    $objMail = new GC_SendMail();
159
160    $objMail->setItem(
161                          ''                                //¡¡°¸Àè
162                        , $subject//"¡Ú" .$CONF["shop_name"]. "¡Û".ENTRY_CUSTOMER_REGIST_SUBJECT        //¡¡¥µ¥Ö¥¸¥§¥¯¥È
163                        , $toCustomerMail                   //¡¡ËÜʸ
164                        , $CONF["email03"]                  //¡¡ÇÛÁ÷¸µ¥¢¥É¥ì¥¹
165                        , $CONF["shop_name"]                //¡¡ÇÛÁ÷¸µ¡¡Ì¾Á°
166                        , $CONF["email03"]                  //¡¡reply_to
167                        , $CONF["email04"]                  //¡¡return_path
168                        , $CONF["email04"]                  //  Errors_to
169                    );
170    // °¸Àè¤ÎÀßÄê
171    $name = $data["name01"] . $data["name02"] ." ÍÍ";
172    $objMail->setTo($data["email"], $name);
173    $objMail->sendMail();
174}
175
176?>
Note: See TracBrowser for help on using the repository browser.