source: temp/trunk/html/regist/index.php @ 5296

Revision 5296, 5.5 KB checked in by kakinaka, 20 years ago (diff)

blank

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