Changeset 20073
- Timestamp:
- 2011/02/03 18:24:23 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/version-2_5-dev/data/class/pages/entry/LC_Page_Entry.php
r20067 r20073 49 49 function init() { 50 50 parent::init(); 51 $this->year = ""; 52 $masterData = new SC_DB_MasterData_Ex(); 53 $this->arrPref = $masterData->getMasterData('mtb_pref'); 54 $this->arrJob = $masterData->getMasterData("mtb_job"); 55 $this->arrReminder = $masterData->getMasterData("mtb_reminder"); 51 $masterData = new SC_DB_MasterData_Ex(); 52 $this->arrPref = $masterData->getMasterData('mtb_pref'); 53 $this->arrJob = $masterData->getMasterData("mtb_job"); 54 $this->arrReminder = $masterData->getMasterData("mtb_reminder"); 56 55 57 56 // 生年月日選択肢の取得 58 $objDate = new SC_Date(START_BIRTH_YEAR, date("Y",strtotime("now")));59 $this->arrYear = $objDate->getYear('', 1950, '');60 $this->arrMonth = $objDate->getMonth(true);61 $this->arrDay = $objDate->getDay(true);57 $objDate = new SC_Date(START_BIRTH_YEAR, date("Y",strtotime("now"))); 58 $this->arrYear = $objDate->getYear('', 1950, ''); 59 $this->arrMonth = $objDate->getMonth(true); 60 $this->arrDay = $objDate->getDay(true); 62 61 63 62 $this->httpCacheControl('nocache'); 64 63 65 $this->isMobile = Net_UserAgent_Mobile::isMobile(); 64 $this->isMobile = Net_UserAgent_Mobile::isMobile(); 65 66 // パラメータ管理クラス,パラメータ情報の初期化 67 $this->objFormParam = new SC_FormParam(); 68 $this->lfInitParam(); 66 69 } 67 70 … … 118 121 */ 119 122 function action() { 120 $objDb = new SC_Helper_DB_Ex(); 121 $CONF = $objDb->sfGetBasisData(); 122 $objQuery = new SC_Query(); 123 123 $this->lfPreMode(); 124 $this->arrForm = $this->objFormParam->getHashArray(); 125 126 switch ($this->getMode()) { 127 case 'confirm': 128 //-- 確認 129 $this->arrErr = $this->lfErrorCheck(); 130 // 入力エラーなし 131 if(empty($this->arrErr)) { 132 //パスワード表示 133 $this->passlen = SC_Utils_Ex::lfPassLen(strlen($this->arrForm['password'])); 134 135 $this->tpl_mainpage = 'entry/confirm.tpl'; 136 $this->tpl_title = '会員登録(確認ページ)'; 137 } 138 break; 139 case 'complete': 140 //-- 会員登録と完了画面 141 $this->arrErr = $this->lfErrorCheck(); 142 if(empty($this->arrErr)) { 143 $this->uniqid = $this->lfRegistData(); 144 145 $this->tpl_mainpage = 'entry/complete.tpl'; 146 $this->tpl_title = '会員登録(完了ページ)'; 147 148 $this->lfSendMail(); 149 150 // 完了ページに移動させる。 151 SC_Response_Ex::sendRedirect('complete.php', array("ci" => $this->lfGetCustomerId($this->uniqid))); 152 } 153 break; 154 default: 155 break; 156 } 157 158 $this->transactionid = SC_Helper_Session_Ex::getToken(); 159 } 160 161 /** 162 * デストラクタ. 163 * 164 * @return void 165 */ 166 function destroy() { 167 parent::destroy(); 168 } 169 170 // }}} 171 // {{{ protected functions 172 173 174 /** 175 * lfPreMode 176 * 177 * @access public 178 * @return void 179 */ 180 function lfPreMode() { 124 181 // PC時は規約ページからの遷移でなければエラー画面へ遷移する 125 182 $this->lfCheckReferer(); … … 130 187 } 131 188 132 // パラメータ管理クラス,パラメータ情報の初期化133 $this-> objFormParam = new SC_FormParam();134 $this->lfInitParam(); 189 //CSRF対策 190 $this->lfCheckCSRF(); 191 135 192 $this->objFormParam->setParam($_POST); // POST値の取得 136 137 if ($_SERVER["REQUEST_METHOD"] == "POST") { 138 139 //CSRF対策 140 if (!SC_Helper_Session_Ex::isValidToken()) { 141 SC_Utils_Ex::sfDispSiteError(PAGE_ERROR, "", true); 142 } 143 144 $this->objFormParam->convParam(); 145 $this->objFormParam->toLower('email'); 146 $this->objFormParam->toLower('email02'); 147 $this->arrForm = $this->objFormParam->getHashArray(); 148 149 switch ($this->getMode()) { 150 case 'confirm': 151 //-- 確認 152 $this->arrErr = $this->lfErrorCheck(); 153 154 // 入力エラーなし 155 if(count($this->arrErr) == 0) { 156 157 $this->list_data = $this->objFormParam->getHashArray(); 158 159 //パスワード表示 160 $passlen = strlen($this->arrForm['password']); 161 $this->passlen = SC_Utils_Ex::lfPassLen($passlen); 162 163 $this->tpl_mainpage = 'entry/confirm.tpl'; 164 $this->tpl_title = '会員登録(確認ページ)'; 165 } 166 break; 167 case 'complete': 168 //-- 会員登録と完了画面 169 170 // 会員情報の登録 171 $this->CONF = $CONF; 172 $this->uniqid = $this->lfRegistData(); 173 174 $this->tpl_mainpage = 'entry/complete.tpl'; 175 $this->tpl_title = '会員登録(完了ページ)'; 176 177 $this->lfSendMail(); 178 179 // 完了ページに移動させる。 180 $customer_id = $objQuery->get("customer_id", "dtb_customer", "secret_key = ?", array($this->uniqid)); 181 SC_Response_Ex::sendRedirect('complete.php', array("ci" => $customer_id)); 182 exit; 183 break; 184 default: 185 break; 186 } 187 } 188 $this->transactionid = SC_Helper_Session_Ex::getToken(); 189 } 190 191 /** 192 * デストラクタ. 193 * 194 * @return void 195 */ 196 function destroy() { 197 parent::destroy(); 198 } 199 200 // }}} 201 // {{{ protected functions 202 203 // 会員情報の登録 193 $this->objFormParam->convParam(); 194 $this->objFormParam->toLower('email'); 195 $this->objFormParam->toLower('email02'); 196 } 197 198 199 /** 200 * lfRegistData 201 * 202 * 会員情報の登録 203 * 204 * @access public 205 * @return void 206 */ 204 207 function lfRegistData() { 205 206 208 $objQuery = new SC_Query(); 207 $arrRet = $this->objFormParam->getHashArray(); 208 $sqlval = $this->objFormParam->getDbArray(); 209 //-- 登録実行 210 $objQuery->begin(); 211 SC_Helper_Customer_Ex::sfEditCustomerData($this->lfMakeSqlVal()); 212 $objQuery->commit(); 213 214 return $uniqid; 215 } 216 217 218 /** 219 * lfMakeSqlVal 220 * 221 * 会員登録に必要なsqlを作成する 222 * 223 * @access public 224 * @return void 225 */ 226 function lfMakeSqlVal() { 227 $arrRet = $this->objFormParam->getHashArray(); 228 $sqlval = $this->objFormParam->getDbArray(); 209 229 210 230 // 登録データの作成 211 $sqlval['birth'] = SC_Utils_Ex::sfGetTimestamp($arrRet['year'], $arrRet['month'], $arrRet['day']); 212 213 // 重複しない会員登録キーを発行する。 214 $count = 1; 215 while ($count != 0) { 216 $uniqid = SC_Utils_Ex::sfGetUniqRandomId("r"); 217 $count = $objQuery->count("dtb_customer", "secret_key = ?", array($uniqid)); 218 } 219 220 // 仮会員登録の場合 221 if(CUSTOMER_CONFIRM_MAIL == true) { 222 $sqlval["status"] = "1"; // 仮会員 223 } else { 224 $sqlval["status"] = "2"; // 本会員 225 } 231 $sqlval['birth'] = SC_Utils_Ex::sfGetTimestamp($arrRet['year'], $arrRet['month'], $arrRet['day']); 232 233 // 仮会員 1 本会員 2 234 $sqlval["status"] = (CUSTOMER_CONFIRM_MAIL == true) ? "1" : "2"; 226 235 227 236 /* … … 229 238 本会員登録では利用されないがセットしておく。 230 239 */ 231 $sqlval["secret_key"] = $uniqid; // 会員登録キー 232 $sqlval["point"] = $this->CONF["welcome_point"]; // 入会時ポイント 240 $sqlval["secret_key"] = SC_Helper_Customer_Ex::sfGetUniqSecretKey(); // 会員登録キー 241 242 $CONF = SC_Helper_DB_Ex::sfGetBasisData(); 243 $sqlval["point"] = $CONF["welcome_point"]; // 入会時ポイント 233 244 234 245 if ($this->isMobile === true) { 235 246 // 携帯メールアドレス 236 $sqlval['email_mobile'] = $sqlval['email'];247 $sqlval['email_mobile'] = $sqlval['email']; 237 248 //PHONE_IDを取り出す 238 $sqlval['mobile_phone_id'] = SC_MobileUserAgent::getId(); 239 } 240 241 //-- 登録実行 242 $objQuery->begin(); 243 SC_Helper_Customer_Ex::sfEditCustomerData($sqlval); 244 $objQuery->commit(); 245 246 return $uniqid; 247 } 248 249 $sqlval['mobile_phone_id'] = SC_MobileUserAgent::getId(); 250 } 251 252 return $sqlval; 253 } 254 255 256 /** 257 * lfSendMail 258 * 259 * @access public 260 * @return void 261 */ 249 262 function lfSendMail(){ 250 263 // 完了メール送信 251 $arrRet = $this->objFormParam->getHashArray();252 $this->name01 = $arrRet['name01'];253 $this->name02 = $arrRet['name02'];254 $objMailText = new SC_SiteView();264 $arrRet = $this->objFormParam->getHashArray(); 265 $this->name01 = $arrRet['name01']; 266 $this->name02 = $arrRet['name02']; 267 $objMailText = new SC_SiteView(); 255 268 $objMailText->assignobj($this); 256 269 257 $objHelperMail = new SC_Helper_Mail_Ex(); 258 $objQuery = new SC_Query(); 259 $objCustomer = new SC_Customer(); 260 $CONF = SC_Helper_DB_Ex::sfGetBasisData(); 270 $objHelperMail = new SC_Helper_Mail_Ex(); 271 $objCustomer = new SC_Customer(); 272 $CONF = SC_Helper_DB_Ex::sfGetBasisData(); 261 273 262 274 // 仮会員が有効の場合 … … 289 301 } 290 302 291 292 //---- 入力エラーチェック 303 /** 304 * lfErrorCheck 305 * 306 * 入力エラーチェック 307 * 308 * @param mixed $array 309 * @access public 310 * @return void 311 */ 293 312 function lfErrorCheck($array) { 294 313 … … 322 341 } 323 342 343 /** 344 * lfCheckReferer 345 * 346 * @access public 347 * @return void 348 */ 324 349 function lfCheckReferer(){ 325 350 /** … … 333 358 } 334 359 } 360 361 362 /** 363 * lfCheckCSRF 364 * 365 * @access public 366 * @return void 367 */ 368 function lfCheckCSRF() { 369 if ($_SERVER["REQUEST_METHOD"] == "POST") { 370 if (!SC_Helper_Session_Ex::isValidToken()) { 371 SC_Utils_Ex::sfDispSiteError(PAGE_ERROR, "", true); 372 } 373 } 374 } 375 376 377 /** 378 * lfGetCustomerId 379 * 380 * @param mixed $uniqid 381 * @access public 382 * @return void 383 */ 384 function lfGetCustomerId($uniqid) { 385 $objQuery = new SC_Query(); 386 return $objQuery->get("customer_id", "dtb_customer", "secret_key = ?", array($uniqid)); 387 } 335 388 } 336 ?>
Note: See TracChangeset
for help on using the changeset viewer.