Changeset 20089
- Timestamp:
- 2011/02/04 14:37:24 (11 years ago)
- Location:
- branches/version-2_5-dev/data/class
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/version-2_5-dev/data/class/helper/SC_Helper_Customer.php
r20085 r20089 222 222 */ 223 223 function sfGetUniqSecretKey() { 224 $objQuery = new SC_Query();224 $objQuery =& SC_Query::getSingletonInstance(); 225 225 $count = 1; 226 226 while ($count != 0) { … … 230 230 return $uniqid; 231 231 } 232 233 234 /** 235 * sfGetCustomerId 236 * 237 * @param mixed $uniqid 238 * @param mixed $check_status 239 * @access public 240 * @return void 241 */ 242 function sfGetCustomerId($uniqid, $check_status = false) { 243 $objQuery =& SC_Query::getSingletonInstance(); 244 $where = "secret_key = ?"; 245 246 if ($check_status) { 247 $where .= ' AND status = 1 AND del_flg = 0'; 248 } 249 250 return $objQuery->get("customer_id", "dtb_customer", $where, array($uniqid)); 251 } 252 232 253 } -
branches/version-2_5-dev/data/class/pages/entry/LC_Page_Entry.php
r20088 r20089 149 149 150 150 // 完了ページに移動させる。 151 SC_Response_Ex::sendRedirect('complete.php', array("ci" => $this->lfGetCustomerId($uniqid)));151 SC_Response_Ex::sendRedirect('complete.php', array("ci" => SC_Helper_Customer_Ex::sfGetCustomerId($uniqid))); 152 152 } 153 153 break; … … 267 267 $this->name02 = $arrRet['name02']; 268 268 $this->uniqid = $uniqid; 269 $CONF = SC_Helper_DB_Ex::sfGetBasisData(); 270 $this->CONF = $CONF; 269 271 $objMailText = new SC_SiteView(); 270 272 $objMailText->assignobj($this); 271 273 272 274 $objHelperMail = new SC_Helper_Mail_Ex(); 273 $objCustomer = new SC_Customer();274 $CONF = SC_Helper_DB_Ex::sfGetBasisData();275 $this->CONF = $CONF;276 275 277 276 // 仮会員が有効の場合 … … 283 282 $toCustomerMail = $objMailText->fetch("mail_templates/customer_regist_mail.tpl"); 284 283 // ログイン状態にする 284 $objCustomer = new SC_Customer(); 285 285 $objCustomer->setLogin($arrRet["email"]); 286 286 } … … 367 367 } 368 368 } 369 370 371 /**372 * lfGetCustomerId373 *374 * @param mixed $uniqid375 * @access public376 * @return void377 */378 function lfGetCustomerId($uniqid) {379 $objQuery = new SC_Query();380 return $objQuery->get("customer_id", "dtb_customer", "secret_key = ?", array($uniqid));381 }382 369 } -
branches/version-2_5-dev/data/class/pages/regist/LC_Page_Regist.php
r20044 r20089 36 36 // {{{ properties 37 37 38 /** 設定情報 */39 var $CONF;40 41 38 // }}} 42 39 // {{{ functions … … 68 65 */ 69 66 function action() { 70 $objSiteInfo = $objView->objSiteInfo;71 $objCustomer = new SC_Customer();72 $objDb = new SC_Helper_DB_Ex();73 $this->CONF = $objDb->sfGetBasisData();74 67 75 68 switch ($this->getMode()) { … … 77 70 //-- 本登録完了のためにメールから接続した場合 78 71 //-- 入力チェック 79 $this->arrErr = $this->lfErrorCheck($_GET); 80 if ($this->arrErr) { 81 SC_Utils_Ex::sfDispSiteError(FREE_ERROR_MSG, "", true, $this->arrErr["id"]); 72 $this->arrErr = $this->lfErrorCheck($_GET); 73 if ($this->arrErr) SC_Utils_Ex::sfDispSiteError(FREE_ERROR_MSG, "", true, $this->arrErr["id"]); 82 74 83 } else { 84 $registSecretKey = $this->lfRegistData($_GET); //本会員登録(フラグ変更) 85 $this->lfSendRegistMail($registSecretKey); //本会員登録完了メール送信 75 $registSecretKey = $this->lfRegistData($_GET); //本会員登録(フラグ変更) 76 $this->lfSendRegistMail($registSecretKey); //本会員登録完了メール送信 86 77 87 // ログイン済みの状態にする。 88 $objQuery = new SC_Query(); 89 $arrRet = $objQuery->select("customer_id, email", "dtb_customer", "secret_key = ?", array($registSecretKey)); 90 $objCustomer->setLogin($arrRet[0]['email']); 91 $etc_val['ci'] = $arrRet[0]['customer_id']; 92 SC_Response_Ex::sendRedirect('complete.php', $etc_val); 93 exit; 94 } 78 SC_Response_Ex::sendRedirect('complete.php', array("ci" => SC_Helper_Customer_Ex::sfGetCustomerId($registSecretKey))); 95 79 break; 96 80 //-- それ以外のアクセスは無効とする … … 110 94 } 111 95 112 //---- 登録 96 /** 97 * lfRegistData 98 * 99 * 仮会員を本会員にUpdateする 100 * 101 * @param mixed $array 102 * @access public 103 * @return void 104 */ 113 105 function lfRegistData($array) { 114 106 $objQuery = new SC_Query(); 115 107 116 do { 117 $secret = SC_Utils_Ex::sfGetUniqRandomId("r"); 118 } while( ($result = $objQuery->getOne("SELECT COUNT(*) FROM dtb_customer WHERE secret_key = ?", array($secret)) ) != 0); 119 120 $sql = "SELECT email FROM dtb_customer WHERE secret_key = ? AND status = 1"; 121 $email = $objQuery->getOne($sql, array($array["id"])); 108 $arrRegist["secret_key"] = SC_Helper_Customer_Ex::sfGetUniqSecretKey(); // 本登録ID発行 109 $arrRegist["status"] = 2; 110 $arrRegist["update_date"] = "NOW()"; 122 111 123 112 $objQuery->begin(); 124 $arrRegist["secret_key"] = $secret; // 本登録ID発行 125 $arrRegist["status"] = 2; 126 $arrRegist["update_date"] = "NOW()"; 127 128 $where = "secret_key = ? AND status = 1"; 129 130 $arrRet = $objQuery->select("point", "dtb_customer", $where, array($array["id"])); 131 132 $objQuery->update("dtb_customer", $arrRegist, $where, array($array["id"])); 133 113 $objQuery->update("dtb_customer", $arrRegist, "secret_key = ? AND status = 1", array($array["id"])); 134 114 $objQuery->commit(); 135 115 136 return $ secret; // 本登録IDを返す116 return $arrRegist["secret_key"]; // 本登録IDを返す 137 117 } 138 118 139 119 //---- 入力エラーチェック 140 120 function lfErrorCheck($array) { 141 $objQuery = new SC_Query(); 142 $objErr = new SC_CheckError($array); 121 $objErr = new SC_CheckError($array); 143 122 144 $objErr->doFunc(array("仮登録ID", 'id'), array("EXIST_CHECK")); 145 if (! EregI("^[[:alnum:]]+$",$array["id"] )) { 123 if (preg_match("/^[[:alnum:]]+$/", $array["id"])) { 124 125 if (!is_numeric(SC_Helper_Customer_Ex::sfGetCustomerId($array["id"], true))) { 126 $objErr->arrErr["id"] = "※ 既に会員登録が完了しているか、無効なURLです。<br>"; 127 } 128 129 } else { 146 130 $objErr->arrErr["id"] = "無効なURLです。メールに記載されている本会員登録用URLを再度ご確認ください。"; 147 131 } 148 if (! $objErr->arrErr["id"]) {149 150 $sql = "SELECT customer_id FROM dtb_customer WHERE secret_key = ? AND status = 1 AND del_flg = 0";151 $result = $objQuery->getOne($sql, array($array["id"]));152 153 if (! is_numeric($result)) {154 $objErr->arrErr["id"] = "※ 既に会員登録が完了しているか、無効なURLです。<br>";155 return $objErr->arrErr;156 157 }158 }159 160 132 return $objErr->arrErr; 161 133 } … … 163 135 //---- 正会員登録完了メール送信 164 136 function lfSendRegistMail($registSecretKey) { 165 $objQuery = new SC_Query(); 166 $objHelperMail = new SC_Helper_Mail_Ex(); 137 $objCustomer = new SC_Customer(); 138 $objQuery = new SC_Query(); 139 $objHelperMail = new SC_Helper_Mail_Ex(); 140 $this->CONF = SC_Helper_DB_Ex::sfGetBasisData(); 167 141 168 //-- 姓名を取得169 $ sql = "SELECT email, name01, name02 FROM dtb_customer WHERE secret_key = ?";170 $ result = $objQuery->getAll($sql, array($registSecretKey));171 $ data = $result[0];142 //-- 会員データを取得 143 $result = $objQuery->select("*", "dtb_customer", "secret_key = ?", array($registSecretKey)); 144 $data = $result[0]; 145 $objCustomer->setLogin($data['email']); 172 146 173 147 //-- メール送信 174 $objMailText = new SC_SiteView();148 $objMailText = new SC_SiteView(); 175 149 $objMailText->assign("CONF", $this->CONF); 176 150 $objMailText->assign("name01", $data["name01"]);
Note: See TracChangeset
for help on using the changeset viewer.