| 1 | <?php |
---|
| 2 | /* |
---|
| 3 | * This file is part of EC-CUBE |
---|
| 4 | * |
---|
| 5 | * Copyright(c) 2000-2010 LOCKON CO.,LTD. All Rights Reserved. |
---|
| 6 | * |
---|
| 7 | * http://www.lockon.co.jp/ |
---|
| 8 | * |
---|
| 9 | * This program is free software; you can redistribute it and/or |
---|
| 10 | * modify it under the terms of the GNU General Public License |
---|
| 11 | * as published by the Free Software Foundation; either version 2 |
---|
| 12 | * of the License, or (at your option) any later version. |
---|
| 13 | * |
---|
| 14 | * This program is distributed in the hope that it will be useful, |
---|
| 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 17 | * GNU General Public License for more details. |
---|
| 18 | * |
---|
| 19 | * You should have received a copy of the GNU General Public License |
---|
| 20 | * along with this program; if not, write to the Free Software |
---|
| 21 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
---|
| 22 | */ |
---|
| 23 | |
---|
| 24 | // {{{ requires |
---|
| 25 | require_once(CLASS_REALDIR . "pages/LC_Page.php"); |
---|
| 26 | |
---|
| 27 | /** |
---|
| 28 | * 会員登録のページクラス. |
---|
| 29 | * |
---|
| 30 | * @package Page |
---|
| 31 | * @author LOCKON CO.,LTD. |
---|
| 32 | * @version $Id:LC_Page_Entry.php 15532 2007-08-31 14:39:46Z nanasess $ |
---|
| 33 | */ |
---|
| 34 | class LC_Page_Entry extends LC_Page { |
---|
| 35 | |
---|
| 36 | // }}} |
---|
| 37 | // {{{ functions |
---|
| 38 | |
---|
| 39 | /** |
---|
| 40 | * Page を初期化する. |
---|
| 41 | * |
---|
| 42 | * 以下のプロパティの初期化を行う. |
---|
| 43 | * - tpl_title |
---|
| 44 | * - year |
---|
| 45 | * - arrPref (mtb_pref からマスタデータを取得する) |
---|
| 46 | * - arrJob (mtb_job からマスタデータを取得する) |
---|
| 47 | * - arrReminder (mtb_reminder からマスタデータを取得する) |
---|
| 48 | * - arrYear |
---|
| 49 | * - arrMonth |
---|
| 50 | * - arrDay |
---|
| 51 | * |
---|
| 52 | * また, クライアント・プロキシのキャッシュ制御を "nocache" に設定する. |
---|
| 53 | * |
---|
| 54 | * @return void |
---|
| 55 | */ |
---|
| 56 | function init() { |
---|
| 57 | parent::init(); |
---|
| 58 | $this->tpl_title .= '会員登録(入力ページ)'; |
---|
| 59 | $this->year = ""; |
---|
| 60 | $masterData = new SC_DB_MasterData_Ex(); |
---|
| 61 | $this->arrPref = $masterData->getMasterData('mtb_pref'); |
---|
| 62 | $this->arrJob = $masterData->getMasterData("mtb_job"); |
---|
| 63 | $this->arrReminder = $masterData->getMasterData("mtb_reminder"); |
---|
| 64 | |
---|
| 65 | // 生年月日選択肢の取得 |
---|
| 66 | $objDate = new SC_Date(START_BIRTH_YEAR, date("Y",strtotime("now"))); |
---|
| 67 | $this->arrYear = $objDate->getYear('', 1950, ''); |
---|
| 68 | $this->arrMonth = $objDate->getMonth(true); |
---|
| 69 | $this->arrDay = $objDate->getDay(true); |
---|
| 70 | |
---|
| 71 | $this->httpCacheControl('nocache'); |
---|
| 72 | } |
---|
| 73 | |
---|
| 74 | /** |
---|
| 75 | * Page のプロセス. |
---|
| 76 | * |
---|
| 77 | * @return void |
---|
| 78 | */ |
---|
| 79 | function process() { |
---|
| 80 | $this->action(); |
---|
| 81 | $this->sendResponse(); |
---|
| 82 | } |
---|
| 83 | |
---|
| 84 | /** |
---|
| 85 | * Page のプロセス. |
---|
| 86 | * |
---|
| 87 | * <b>概要</b> |
---|
| 88 | * |
---|
| 89 | * 一般ユーザーが個人情報を入力し, 会員登録を行う. |
---|
| 90 | * 会員登録完了時, ユーザーのメールアドレスと店舗管理者へ会員登録完了 |
---|
| 91 | * の通知メールを送信し, 登録完了画面へリダイレクトを行う. |
---|
| 92 | * |
---|
| 93 | * <b>アクター</b> |
---|
| 94 | * |
---|
| 95 | * - 一般ユーザー |
---|
| 96 | * |
---|
| 97 | * <b>基本フロー</b> |
---|
| 98 | * |
---|
| 99 | * 遷移の際, トランザクショントークンを使用し, 不正な遷移が発生した場合は |
---|
| 100 | * エラーページを表示する. |
---|
| 101 | * |
---|
| 102 | * <ol> |
---|
| 103 | * <li>入力フォーム($_POST['mode'] == '') |
---|
| 104 | * <ul> |
---|
| 105 | * <li>入力チェックがエラーの場合($_POST['mode'] == 'return')</li> |
---|
| 106 | * <li>$_POST が空かつ, $_SERVER['HTTP_REFERER'] に "kiyaku.php" |
---|
| 107 | * の文字列が存在しない場合はエラーページを表示する</li> |
---|
| 108 | * </ul> |
---|
| 109 | * </li> |
---|
| 110 | * <li>入力確認画面($_POST['mode'] == 'confirm')</li> |
---|
| 111 | * <li>登録完了処理($_POST['mode'] == 'complete')</li> |
---|
| 112 | * <li>登録完了画面へリダイレクトを行う</li> |
---|
| 113 | * </ol> |
---|
| 114 | * |
---|
| 115 | * 仮会員登録が有効な場合, 3 の登録完了画面の前に, 仮会員登録メールを送信し, |
---|
| 116 | * ユーザーが本会員登録用 URL をクリックした時点で登録を完了する. |
---|
| 117 | * |
---|
| 118 | * <b>代替フロー</b> |
---|
| 119 | * |
---|
| 120 | * なし |
---|
| 121 | * |
---|
| 122 | * <b>特別な要件事項</b> |
---|
| 123 | * |
---|
| 124 | * - ユーザーが入力した情報は, 空文字, 改行を削除する. |
---|
| 125 | * - メールアドレスは, すべて小文字に変換し, DBに格納する. |
---|
| 126 | * |
---|
| 127 | * <b>事前条件</b> |
---|
| 128 | * |
---|
| 129 | * アクターがシステムに訪問していること. |
---|
| 130 | * |
---|
| 131 | * <b>事後条件</b> |
---|
| 132 | * |
---|
| 133 | * アクターの会員登録が完了していること. |
---|
| 134 | * |
---|
| 135 | * <b>サブユースケース</b> |
---|
| 136 | * |
---|
| 137 | * なし |
---|
| 138 | * |
---|
| 139 | * <b>使用するスーパーグローバル変数</b> |
---|
| 140 | * |
---|
| 141 | * - $_SERVER['PHP_SELF'] |
---|
| 142 | * - $_SERVER['HTTP_REFERER'] |
---|
| 143 | * - $_SERVER["REQUEST_METHOD"] |
---|
| 144 | * - $_POST["name01"] |
---|
| 145 | * - $_POST["name02"] |
---|
| 146 | * - $_POST["kana01"] |
---|
| 147 | * - $_POST["kana02"] |
---|
| 148 | * - $_POST["zip01"] |
---|
| 149 | * - $_POST["zip02"] |
---|
| 150 | * - $_POST["addr01"] |
---|
| 151 | * - $_POST["addr02"] |
---|
| 152 | * - $_POST["tel01"] |
---|
| 153 | * - $_POST["tel02"] |
---|
| 154 | * - $_POST["tel03"] |
---|
| 155 | * - $_POST["fax01"] |
---|
| 156 | * - $_POST["fax02"] |
---|
| 157 | * - $_POST["fax03"] |
---|
| 158 | * - $_POST["email"] |
---|
| 159 | * - $_POST["email02"] |
---|
| 160 | * - $_POST["password"] |
---|
| 161 | * - $_POST["password02"] |
---|
| 162 | * - $_POST["reminder_answer"] |
---|
| 163 | * - $_POST["mode"]('return', 'confirm', 'complate') |
---|
| 164 | * |
---|
| 165 | * @return void |
---|
| 166 | */ |
---|
| 167 | function action() { |
---|
| 168 | $objView = new SC_SiteView(); |
---|
| 169 | $objCustomer = new SC_Customer(); |
---|
| 170 | $objDb = new SC_Helper_DB_Ex(); |
---|
| 171 | $CONF = $objDb->sfGetBasisData(); |
---|
| 172 | |
---|
| 173 | // PC時は規約ページからの遷移でなければエラー画面へ遷移する |
---|
| 174 | $this->lfCheckReferer(); |
---|
| 175 | |
---|
| 176 | //---- 登録用カラム配列 |
---|
| 177 | $arrRegistColumn = array( |
---|
| 178 | array( "column" => "name01", "convert" => "aKV" ), |
---|
| 179 | array( "column" => "name02", "convert" => "aKV" ), |
---|
| 180 | array( "column" => "kana01", "convert" => "CKV" ), |
---|
| 181 | array( "column" => "kana02", "convert" => "CKV" ), |
---|
| 182 | array( "column" => "zip01", "convert" => "n" ), |
---|
| 183 | array( "column" => "zip02", "convert" => "n" ), |
---|
| 184 | array( "column" => "pref", "convert" => "n" ), |
---|
| 185 | array( "column" => "addr01", "convert" => "aKV" ), |
---|
| 186 | array( "column" => "addr02", "convert" => "aKV" ), |
---|
| 187 | array( "column" => "email", "convert" => "a" ), |
---|
| 188 | array( "column" => "email02", "convert" => "a" ), |
---|
| 189 | array( "column" => "email_mobile", "convert" => "a" ), |
---|
| 190 | array( "column" => "email_mobile02", "convert" => "a" ), |
---|
| 191 | array( "column" => "tel01", "convert" => "n" ), |
---|
| 192 | array( "column" => "tel02", "convert" => "n" ), |
---|
| 193 | array( "column" => "tel03", "convert" => "n" ), |
---|
| 194 | array( "column" => "fax01", "convert" => "n" ), |
---|
| 195 | array( "column" => "fax02", "convert" => "n" ), |
---|
| 196 | array( "column" => "fax03", "convert" => "n" ), |
---|
| 197 | array( "column" => "sex", "convert" => "n" ), |
---|
| 198 | array( "column" => "job", "convert" => "n" ), |
---|
| 199 | array( "column" => "birth", "convert" => "n" ), |
---|
| 200 | array( "column" => "year", "convert" => "n" ), |
---|
| 201 | array( "column" => "month", "convert" => "n" ), |
---|
| 202 | array( "column" => "day", "convert" => "n" ), |
---|
| 203 | array( "column" => "reminder", "convert" => "n" ), |
---|
| 204 | array( "column" => "reminder_answer", "convert" => "aKV"), |
---|
| 205 | array( "column" => "password", "convert" => "a" ), |
---|
| 206 | array( "column" => "password02", "convert" => "a" ), |
---|
| 207 | array( "column" => "mailmaga_flg", "convert" => "n" ), |
---|
| 208 | ); |
---|
| 209 | |
---|
| 210 | //---- 登録除外用カラム配列 |
---|
| 211 | $arrRejectRegistColumn = array("year", "month", "day", "email02", "email_mobile02", "password02"); |
---|
| 212 | |
---|
| 213 | if ($_SERVER["REQUEST_METHOD"] == "POST") { |
---|
| 214 | |
---|
| 215 | //CSRF対策 |
---|
| 216 | if (!SC_Helper_Session_Ex::isValidToken()) { |
---|
| 217 | SC_Utils_Ex::sfDispSiteError(PAGE_ERROR, "", true); |
---|
| 218 | } |
---|
| 219 | |
---|
| 220 | // 空白・改行の削除 |
---|
| 221 | foreach ($arrRegistColumn as $item){ |
---|
| 222 | $_POST["${item["column"]}"] = preg_replace('/^[ \r\n]*(.*?)[ \r\n]*$/u', '$1', $_POST["${item["column"]}"]); |
---|
| 223 | } |
---|
| 224 | |
---|
| 225 | //-- POSTデータの引き継ぎ |
---|
| 226 | $this->arrForm = $_POST; |
---|
| 227 | |
---|
| 228 | // SSL用 |
---|
| 229 | $this->arrForm['ssl_url'] = rtrim(HTTPS_URL,"/").$_SERVER['PHP_SELF']; |
---|
| 230 | |
---|
| 231 | // |
---|
| 232 | $this->arrForm['email'] = strtolower($this->arrForm['email']); // emailはすべて小文字で処理 |
---|
| 233 | $this->arrForm['email02'] = strtolower($this->arrForm['email02']); // emailはすべて小文字で処理 |
---|
| 234 | |
---|
| 235 | //-- 入力データの変換 |
---|
| 236 | $this->arrForm = $this->lfConvertParam($this->arrForm, $arrRegistColumn); |
---|
| 237 | // mobile用 |
---|
| 238 | if (!empty($_POST["return"])) { |
---|
| 239 | $_POST["mode"] = "return"; |
---|
| 240 | } |
---|
| 241 | |
---|
| 242 | |
---|
| 243 | //-- 入力エラーチェック |
---|
| 244 | $this->arrErr = $this->lfErrorCheck($this->arrForm); |
---|
| 245 | |
---|
| 246 | if ($this->arrErr || $_POST["mode"] == "return") { // 入力エラーのチェック |
---|
| 247 | foreach($arrRegistColumn as $key) { |
---|
| 248 | $this->$key['column'] = $this->arrForm[$key['column']]; |
---|
| 249 | } |
---|
| 250 | } else { |
---|
| 251 | |
---|
| 252 | //-- 確認 |
---|
| 253 | if ($_POST["mode"] == "confirm") { |
---|
| 254 | foreach($this->arrForm as $key => $val) { |
---|
| 255 | if ($key != "mode" && $key != "subm" && $key != "transactionid") $this->list_data[ $key ] = $val; |
---|
| 256 | } |
---|
| 257 | //パスワード表示 |
---|
| 258 | $passlen = strlen($this->arrForm['password']); |
---|
| 259 | $this->passlen = SC_Utils_Ex::lfPassLen($passlen); |
---|
| 260 | |
---|
| 261 | $this->tpl_mainpage = 'entry/confirm.tpl'; |
---|
| 262 | $this->tpl_title = '会員登録(確認ページ)'; |
---|
| 263 | |
---|
| 264 | } |
---|
| 265 | |
---|
| 266 | //-- 会員登録と完了画面 |
---|
| 267 | if ($_POST["mode"] == "complete") { |
---|
| 268 | // 会員情報の登録 |
---|
| 269 | $this->CONF = $CONF; |
---|
| 270 | $this->uniqid = $this->lfRegistData ($this->arrForm, $arrRegistColumn, $arrRejectRegistColumn, CUSTOMER_CONFIRM_MAIL); |
---|
| 271 | |
---|
| 272 | $this->tpl_mainpage = 'entry/complete.tpl'; |
---|
| 273 | $this->tpl_title = '会員登録(完了ページ)'; |
---|
| 274 | |
---|
| 275 | // 完了メール送信 |
---|
| 276 | $this->name01 = $_POST['name01']; |
---|
| 277 | $this->name02 = $_POST['name02']; |
---|
| 278 | $objMailText = new SC_SiteView(); |
---|
| 279 | $objMailText->assignobj($this); |
---|
| 280 | |
---|
| 281 | $objHelperMail = new SC_Helper_Mail_Ex(); |
---|
| 282 | $objQuery = new SC_Query(); |
---|
| 283 | |
---|
| 284 | // 仮会員が有効の場合 |
---|
| 285 | if(CUSTOMER_CONFIRM_MAIL == true) { |
---|
| 286 | $subject = $objHelperMail->sfMakeSubject('会員登録のご確認'); |
---|
| 287 | $toCustomerMail = $objMailText->fetch("mail_templates/customer_mail.tpl"); |
---|
| 288 | } else { |
---|
| 289 | $subject = $objHelperMail->sfMakeSubject('会員登録のご完了'); |
---|
| 290 | $toCustomerMail = $objMailText->fetch("mail_templates/customer_regist_mail.tpl"); |
---|
| 291 | // ログイン状態にする |
---|
| 292 | $objCustomer->setLogin($_POST["email"]); |
---|
| 293 | } |
---|
| 294 | |
---|
| 295 | $objMail = new SC_SendMail(); |
---|
| 296 | $objMail->setItem( |
---|
| 297 | '' // 宛先 |
---|
| 298 | , $subject // サブジェクト |
---|
| 299 | , $toCustomerMail // 本文 |
---|
| 300 | , $CONF["email03"] // 配送元アドレス |
---|
| 301 | , $CONF["shop_name"] // 配送元 名前 |
---|
| 302 | , $CONF["email03"] // reply_to |
---|
| 303 | , $CONF["email04"] // return_path |
---|
| 304 | , $CONF["email04"] // Errors_to |
---|
| 305 | , $CONF["email01"] // Bcc |
---|
| 306 | ); |
---|
| 307 | // 宛先の設定 |
---|
| 308 | $name = $_POST["name01"] . $_POST["name02"] ." 様"; |
---|
| 309 | $objMail->setTo($_POST["email"], $name); |
---|
| 310 | $objMail->sendMail(); |
---|
| 311 | |
---|
| 312 | // 完了ページに移動させる。 |
---|
| 313 | $customer_id = $objQuery->get("customer_id", "dtb_customer", "secret_key = ?", array($this->uniqid)); |
---|
| 314 | $this->objDisplay->redirect($this->getLocation("./complete.php", array("ci" => $customer_id))); |
---|
| 315 | exit; |
---|
| 316 | |
---|
| 317 | } |
---|
| 318 | } |
---|
| 319 | } |
---|
| 320 | $this->transactionid = SC_Helper_Session_Ex::getToken(); |
---|
| 321 | } |
---|
| 322 | |
---|
| 323 | /** |
---|
| 324 | * デストラクタ. |
---|
| 325 | * |
---|
| 326 | * @return void |
---|
| 327 | */ |
---|
| 328 | function destroy() { |
---|
| 329 | parent::destroy(); |
---|
| 330 | } |
---|
| 331 | |
---|
| 332 | // }}} |
---|
| 333 | // {{{ protected functions |
---|
| 334 | |
---|
| 335 | // 会員情報の登録 |
---|
| 336 | function lfRegistData ($array, $arrRegistColumn, $arrRejectRegistColumn, $confirm_flg, $isMobile = false, $email_mobile = "") { |
---|
| 337 | $objQuery = new SC_Query(); |
---|
| 338 | |
---|
| 339 | // 登録データの生成 |
---|
| 340 | foreach ($arrRegistColumn as $data) { |
---|
| 341 | if (strlen($array[ $data["column"] ]) > 0 && ! in_array($data["column"], $arrRejectRegistColumn)) { |
---|
| 342 | $arrRegist[ $data["column"] ] = $array[ $data["column"] ]; |
---|
| 343 | } |
---|
| 344 | } |
---|
| 345 | |
---|
| 346 | // 誕生日が入力されている場合 |
---|
| 347 | if (strlen($array["year"]) > 0 ) { |
---|
| 348 | $arrRegist["birth"] = $array["year"] ."/". $array["month"] ."/". $array["day"] ." 00:00:00"; |
---|
| 349 | } |
---|
| 350 | |
---|
| 351 | // パスワードの暗号化 |
---|
| 352 | $arrRegist["password"] = sha1($arrRegist["password"] . ":" . AUTH_MAGIC); |
---|
| 353 | |
---|
| 354 | // 仮会員登録の場合 |
---|
| 355 | if($confirm_flg == true) { |
---|
| 356 | // 重複しない会員登録キーを発行する。 |
---|
| 357 | $count = 1; |
---|
| 358 | while ($count != 0) { |
---|
| 359 | $uniqid = SC_Utils_Ex::sfGetUniqRandomId("t"); |
---|
| 360 | $count = $objQuery->count("dtb_customer", "secret_key = ?", array($uniqid)); |
---|
| 361 | } |
---|
| 362 | switch($array["mailmaga_flg"]) { |
---|
| 363 | case 1: |
---|
| 364 | $arrRegist["mailmaga_flg"] = 4; |
---|
| 365 | break; |
---|
| 366 | case 2: |
---|
| 367 | $arrRegist["mailmaga_flg"] = 5; |
---|
| 368 | break; |
---|
| 369 | default: |
---|
| 370 | $arrRegist["mailmaga_flg"] = 6; |
---|
| 371 | break; |
---|
| 372 | } |
---|
| 373 | |
---|
| 374 | $arrRegist["status"] = "1"; // 仮会員 |
---|
| 375 | } else { |
---|
| 376 | // 重複しない会員登録キーを発行する。 |
---|
| 377 | $count = 1; |
---|
| 378 | while ($count != 0) { |
---|
| 379 | $uniqid = SC_Utils_Ex::sfGetUniqRandomId("r"); |
---|
| 380 | $count = $objQuery->count("dtb_customer", "secret_key = ?", array($uniqid)); |
---|
| 381 | } |
---|
| 382 | $arrRegist["status"] = "2"; // 本会員 |
---|
| 383 | } |
---|
| 384 | |
---|
| 385 | /* |
---|
| 386 | secret_keyは、テーブルで重複許可されていない場合があるので、 |
---|
| 387 | 本会員登録では利用されないがセットしておく。 |
---|
| 388 | */ |
---|
| 389 | $arrRegist["secret_key"] = $uniqid; // 会員登録キー |
---|
| 390 | $arrRegist["create_date"] = "now()"; // 作成日 |
---|
| 391 | $arrRegist["update_date"] = "now()"; // 更新日 |
---|
| 392 | $arrRegist["first_buy_date"] = ""; // 最初の購入日 |
---|
| 393 | $arrRegist["point"] = $this->CONF["welcome_point"]; // 入会時ポイント |
---|
| 394 | |
---|
| 395 | if ($isMobile) { |
---|
| 396 | // 携帯メールアドレス |
---|
| 397 | $arrRegist['email_mobile'] = $arrRegist['email']; |
---|
| 398 | //PHONE_IDを取り出す |
---|
| 399 | $phoneId = SC_MobileUserAgent::getId(); |
---|
| 400 | $arrRegist['mobile_phone_id'] = $phoneId; |
---|
| 401 | } |
---|
| 402 | |
---|
| 403 | //-- 仮登録実行 |
---|
| 404 | $objQuery->begin(); |
---|
| 405 | |
---|
| 406 | $arrRegist['customer_id'] = $objQuery->nextVal('dtb_customer_customer_id'); |
---|
| 407 | $objQuery->insert("dtb_customer", $arrRegist); |
---|
| 408 | |
---|
| 409 | $objQuery->commit(); |
---|
| 410 | |
---|
| 411 | return $uniqid; |
---|
| 412 | } |
---|
| 413 | |
---|
| 414 | //---- 取得文字列の変換 |
---|
| 415 | function lfConvertParam($array, $arrRegistColumn) { |
---|
| 416 | /* |
---|
| 417 | * 文字列の変換 |
---|
| 418 | * K : 「半角(ハンカク)片仮名」を「全角片仮名」に変換 |
---|
| 419 | * C : 「全角ひら仮名」を「全角かた仮名」に変換 |
---|
| 420 | * V : 濁点付きの文字を一文字に変換。"K","H"と共に使用します |
---|
| 421 | * n : 「全角」数字を「半角(ハンカク)」に変換 |
---|
| 422 | * a : 全角英数字を半角英数字に変換する |
---|
| 423 | */ |
---|
| 424 | // カラム名とコンバート情報 |
---|
| 425 | foreach ($arrRegistColumn as $data) { |
---|
| 426 | $arrConvList[ $data["column"] ] = $data["convert"]; |
---|
| 427 | } |
---|
| 428 | // 文字変換 |
---|
| 429 | foreach ($arrConvList as $key => $val) { |
---|
| 430 | // POSTされてきた値のみ変換する。 |
---|
| 431 | if(isset($array[$key]) && strlen($array[$key]) > 0) { |
---|
| 432 | $array[$key] = mb_convert_kana($array[$key] ,$val); |
---|
| 433 | } |
---|
| 434 | } |
---|
| 435 | return $array; |
---|
| 436 | } |
---|
| 437 | |
---|
| 438 | //---- 入力エラーチェック |
---|
| 439 | function lfErrorCheck($array) { |
---|
| 440 | |
---|
| 441 | $objErr = new SC_CheckError($array); |
---|
| 442 | |
---|
| 443 | $objErr->doFunc(array("お名前(姓)", 'name01', STEXT_LEN), array("EXIST_CHECK", "NO_SPTAB", "SPTAB_CHECK" ,"MAX_LENGTH_CHECK")); |
---|
| 444 | $objErr->doFunc(array("お名前(名)", 'name02', STEXT_LEN), array("EXIST_CHECK", "NO_SPTAB", "SPTAB_CHECK" , "MAX_LENGTH_CHECK")); |
---|
| 445 | $objErr->doFunc(array("お名前(フリガナ・姓)", 'kana01', STEXT_LEN), array("EXIST_CHECK", "NO_SPTAB", "SPTAB_CHECK" ,"MAX_LENGTH_CHECK", "KANA_CHECK")); |
---|
| 446 | $objErr->doFunc(array("お名前(フリガナ・名)", 'kana02', STEXT_LEN), array("EXIST_CHECK", "NO_SPTAB", "SPTAB_CHECK" ,"MAX_LENGTH_CHECK", "KANA_CHECK")); |
---|
| 447 | $objErr->doFunc(array("パスワード", 'password', PASSWORD_LEN1, PASSWORD_LEN2), array("EXIST_CHECK", "SPTAB_CHECK" ,"ALNUM_CHECK", "NUM_RANGE_CHECK")); |
---|
| 448 | $objErr->doFunc(array("パスワード確認用の質問", "reminder") ,array("SELECT_CHECK", "NUM_CHECK")); |
---|
| 449 | $objErr->doFunc(array("パスワード確認用の質問の答え", "reminder_answer", STEXT_LEN) ,array("EXIST_CHECK","SPTAB_CHECK" , "MAX_LENGTH_CHECK")); |
---|
| 450 | $objErr->doFunc(array("郵便番号1", "zip01", ZIP01_LEN ) ,array("EXIST_CHECK", "SPTAB_CHECK" ,"NUM_CHECK", "NUM_COUNT_CHECK")); |
---|
| 451 | $objErr->doFunc(array("郵便番号2", "zip02", ZIP02_LEN ) ,array("EXIST_CHECK", "SPTAB_CHECK" ,"NUM_CHECK", "NUM_COUNT_CHECK")); |
---|
| 452 | $objErr->doFunc(array("郵便番号", "zip01", "zip02"), array("ALL_EXIST_CHECK")); |
---|
| 453 | $objErr->doFunc(array("都道府県", 'pref'), array("SELECT_CHECK","NUM_CHECK")); |
---|
| 454 | $objErr->doFunc(array("住所1", "addr01", MTEXT_LEN), array("EXIST_CHECK","SPTAB_CHECK" ,"MAX_LENGTH_CHECK")); |
---|
| 455 | $objErr->doFunc(array("住所2", "addr02", MTEXT_LEN), array("EXIST_CHECK","SPTAB_CHECK" ,"MAX_LENGTH_CHECK")); |
---|
| 456 | $objErr->doFunc(array("お電話番号1", 'tel01'), array("EXIST_CHECK","SPTAB_CHECK" )); |
---|
| 457 | $objErr->doFunc(array("お電話番号2", 'tel02'), array("EXIST_CHECK","SPTAB_CHECK" )); |
---|
| 458 | $objErr->doFunc(array("お電話番号3", 'tel03'), array("EXIST_CHECK","SPTAB_CHECK" )); |
---|
| 459 | $objErr->doFunc(array("お電話番号", "tel01", "tel02", "tel03") ,array("TEL_CHECK")); |
---|
| 460 | $objErr->doFunc(array("性別", "sex") ,array("SELECT_CHECK", "NUM_CHECK")); |
---|
| 461 | $objErr->doFunc(array("生年月日", "year", "month", "day"), array("CHECK_BIRTHDAY")); |
---|
| 462 | |
---|
| 463 | if (Net_UserAgent_Mobile::isMobile() === false){ |
---|
| 464 | $objErr->doFunc(array('メールアドレス', "email", MTEXT_LEN) ,array("NO_SPTAB", "EXIST_CHECK", "EMAIL_CHECK", "SPTAB_CHECK" ,"EMAIL_CHAR_CHECK", "MAX_LENGTH_CHECK")); |
---|
| 465 | $objErr->doFunc(array("FAX番号1", 'fax01'), array("SPTAB_CHECK")); |
---|
| 466 | $objErr->doFunc(array("FAX番号2", 'fax02'), array("SPTAB_CHECK")); |
---|
| 467 | $objErr->doFunc(array("FAX番号3", 'fax03'), array("SPTAB_CHECK")); |
---|
| 468 | $objErr->doFunc(array("FAX番号", "fax01", "fax02", "fax03") ,array("TEL_CHECK")); |
---|
| 469 | $objErr->doFunc(array("メールマガジン", "mailmaga_flg") ,array("SELECT_CHECK", "NUM_CHECK")); |
---|
| 470 | $objErr->doFunc(array("メールマガジン", 'mailmaga_flg'), array("SELECT_CHECK")); |
---|
| 471 | $objErr->doFunc(array("パスワード(確認)", 'password02', PASSWORD_LEN1, PASSWORD_LEN2), array("EXIST_CHECK", "SPTAB_CHECK" ,"ALNUM_CHECK", "NUM_RANGE_CHECK")); |
---|
| 472 | $objErr->doFunc(array('パスワード', 'パスワード(確認)', "password", "password02") ,array("EQUAL_CHECK")); |
---|
| 473 | $objErr->doFunc(array('メールアドレス(確認)', "email02", MTEXT_LEN) ,array("NO_SPTAB", "EXIST_CHECK", "EMAIL_CHECK","SPTAB_CHECK" , "EMAIL_CHAR_CHECK", "MAX_LENGTH_CHECK")); |
---|
| 474 | $objErr->doFunc(array('メールアドレス', 'メールアドレス(確認)', "email", "email02") ,array("EQUAL_CHECK")); |
---|
| 475 | } |
---|
| 476 | |
---|
| 477 | // 現会員の判定 → 現会員もしくは仮登録中は、メアド一意が前提になってるので同じメアドで登録不可 |
---|
| 478 | if (strlen($array["email"]) > 0) { |
---|
| 479 | $array["email"] = strtolower($array["email"]); |
---|
| 480 | $objQuery = new SC_Query(); |
---|
| 481 | $arrRet = $objQuery->select("email, update_date, del_flg", "dtb_customer","email = ? OR email_mobile = ? ORDER BY del_flg", array($array["email"], $array["email"])); |
---|
| 482 | |
---|
| 483 | if(count($arrRet) > 0) { |
---|
| 484 | if($arrRet[0]['del_flg'] != '1') { |
---|
| 485 | // 会員である場合 |
---|
| 486 | if (!isset($objErr->arrErr['email'])) $objErr->arrErr['email'] = ""; |
---|
| 487 | $objErr->arrErr["email"] .= "※ すでに会員登録で使用されているメールアドレスです。<br />"; |
---|
| 488 | } else { |
---|
| 489 | // 退会した会員である場合 |
---|
| 490 | $leave_time = SC_Utils_Ex::sfDBDatetoTime($arrRet[0]['update_date']); |
---|
| 491 | $now_time = time(); |
---|
| 492 | $pass_time = $now_time - $leave_time; |
---|
| 493 | // 退会から何時間-経過しているか判定する。 |
---|
| 494 | $limit_time = ENTRY_LIMIT_HOUR * 3600; |
---|
| 495 | if($pass_time < $limit_time) { |
---|
| 496 | if (!isset($objErr->arrErr['email'])) $objErr->arrErr['email'] = ""; |
---|
| 497 | $objErr->arrErr["email"] .= "※ 退会から一定期間の間は、同じメールアドレスを使用することはできません。<br />"; |
---|
| 498 | } |
---|
| 499 | } |
---|
| 500 | } |
---|
| 501 | } |
---|
| 502 | return $objErr->arrErr; |
---|
| 503 | } |
---|
| 504 | |
---|
| 505 | //確認ページ用パスワード表示用 |
---|
| 506 | |
---|
| 507 | function lfPassLen($passlen){ |
---|
| 508 | $ret = ""; |
---|
| 509 | for ($i=0;$i<$passlen;true){ |
---|
| 510 | $ret.="*"; |
---|
| 511 | $i++; |
---|
| 512 | } |
---|
| 513 | return $ret; |
---|
| 514 | } |
---|
| 515 | |
---|
| 516 | function lfCheckReferer(){ |
---|
| 517 | /** |
---|
| 518 | * 規約ページからの遷移でなければエラー画面へ遷移する |
---|
| 519 | */ |
---|
| 520 | if (Net_UserAgent_Mobile::isMobile() === FALSE |
---|
| 521 | && empty($_POST) |
---|
| 522 | && !preg_match('/kiyaku.php/', basename($_SERVER['HTTP_REFERER'])) |
---|
| 523 | ) { |
---|
| 524 | SC_Utils_Ex::sfDispSiteError(PAGE_ERROR, "", true); |
---|
| 525 | } |
---|
| 526 | } |
---|
| 527 | |
---|
| 528 | } |
---|
| 529 | ?> |
---|