source: branches/version-2_4-dev/data/class/pages/entry/LC_Page_Entry.php @ 18699

Revision 18699, 44.8 KB checked in by nanasess, 14 years ago (diff)

Copyright の更新(#601)

  • Property svn:eol-style set to LF
  • Property svn:keywords set to Id Revision Date
  • Property svn:mime-type set to text/x-httpd-php; charset=UTF-8
Line 
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
25require_once(CLASS_PATH . "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 */
34class LC_Page_Entry extends LC_Page {
35
36    // }}}
37    // {{{ functions
38
39    /**
40     * Page を初期化する.
41     *
42     * @return void
43     */
44    function init() {
45        parent::init();
46        $this->tpl_mainpage = 'entry/index.tpl';
47        $this->tpl_title .= '会員登録(入力ページ)';
48        $this->year = "";
49        $masterData = new SC_DB_MasterData_Ex();
50        $this->arrPref = $masterData->getMasterData("mtb_pref",
51                                array("pref_id", "pref_name", "rank"));
52        $this->arrJob = $masterData->getMasterData("mtb_job");
53        $this->arrReminder = $masterData->getMasterData("mtb_reminder");
54        $this->objDate = new SC_Date(START_BIRTH_YEAR, date("Y",strtotime("now")));
55        $this->arrYear = $this->objDate->getYear('', 1950); // 日付プルダウン設定
56        $this->arrMonth = $this->objDate->getMonth();
57        $this->arrDay = $this->objDate->getDay();
58    }
59
60    /**
61     * Page のプロセス.
62     *
63     * @return void
64     */
65    function process() {
66        global $objCampaignSess;
67
68        $objConn = new SC_DbConn();
69        $objView = new SC_SiteView();
70        $objCustomer = new SC_Customer();
71        $objCampaignSess = new SC_CampaignSession();
72        $objDb = new SC_Helper_DB_Ex();
73        $CONF = $objDb->sf_getBasisData();
74        $objDate = new SC_Date(START_BIRTH_YEAR, date("Y",strtotime("now")));
75
76        $ssl_url  = rtrim(SSL_URL,"/");
77        $ssl_url .= $_SERVER['PHP_SELF'];
78
79
80        // 規約ページからの遷移でなければエラー画面へ遷移する
81        if (empty($_POST) && !preg_match('/kiyaku.php/', basename($_SERVER['HTTP_REFERER']))) {
82            SC_Utils_Ex::sfDispSiteError(PAGE_ERROR, "", true);
83        }
84
85        // レイアウトデザインを取得
86        $layout = new SC_Helper_PageLayout_Ex();
87        $layout->sfGetPageLayout($this, false, DEF_LAYOUT);
88
89        //---- 登録用カラム配列
90        $arrRegistColumn = array(
91                                     array(  "column" => "name01", "convert" => "aKV" ),
92                                     array(  "column" => "name02", "convert" => "aKV" ),
93                                     array(  "column" => "kana01", "convert" => "CKV" ),
94                                     array(  "column" => "kana02", "convert" => "CKV" ),
95                                     array(  "column" => "zip01", "convert" => "n" ),
96                                     array(  "column" => "zip02", "convert" => "n" ),
97                                     array(  "column" => "pref", "convert" => "n" ),
98                                     array(  "column" => "addr01", "convert" => "aKV" ),
99                                     array(  "column" => "addr02", "convert" => "aKV" ),
100                                     array(  "column" => "email", "convert" => "a" ),
101                                     array(  "column" => "email02", "convert" => "a" ),
102                                     array(  "column" => "email_mobile", "convert" => "a" ),
103                                     array(  "column" => "email_mobile02", "convert" => "a" ),
104                                     array(  "column" => "tel01", "convert" => "n" ),
105                                     array(  "column" => "tel02", "convert" => "n" ),
106                                     array(  "column" => "tel03", "convert" => "n" ),
107                                     array(  "column" => "fax01", "convert" => "n" ),
108                                     array(  "column" => "fax02", "convert" => "n" ),
109                                     array(  "column" => "fax03", "convert" => "n" ),
110                                     array(  "column" => "sex", "convert" => "n" ),
111                                     array(  "column" => "job", "convert" => "n" ),
112                                     array(  "column" => "birth", "convert" => "n" ),
113                                     array(  "column" => "year", "convert" => "n" ),
114                                     array(  "column" => "month", "convert" => "n" ),
115                                     array(  "column" => "day", "convert" => "n" ),
116                                     array(  "column" => "reminder", "convert" => "n" ),
117                                     array(  "column" => "reminder_answer", "convert" => "aKV"),
118                                     array(  "column" => "password", "convert" => "a" ),
119                                     array(  "column" => "password02", "convert" => "a" ),
120                                     array(  "column" => "mailmaga_flg", "convert" => "n" ),
121                                 );
122
123        //---- 登録除外用カラム配列
124        $arrRejectRegistColumn = array("year", "month", "day", "email02", "email_mobile02", "password02");
125
126        if ($_SERVER["REQUEST_METHOD"] == "POST") {
127
128            if (!$this->isValidToken()) {
129                SC_Utils_Ex::sfDispSiteError(PAGE_ERROR, "", true);
130            }
131
132            //空白・改行の削除
133            $_POST["name01"] = preg_replace('/^[  \r\n]*(.*?)[  \r\n]*$/u', '$1', $_POST["name01"]);
134            $_POST["name02"] = preg_replace('/^[  \r\n]*(.*?)[  \r\n]*$/u', '$1', $_POST["name02"]);
135            $_POST["kana01"] = preg_replace('/^[  \r\n]*(.*?)[  \r\n]*$/u', '$1', $_POST["kana01"]);
136            $_POST["kana02"] = preg_replace('/^[  \r\n]*(.*?)[  \r\n]*$/u', '$1', $_POST["kana02"]);
137            $_POST["zip01"] = preg_replace('/^[  \r\n]*(.*?)[  \r\n]*$/u', '$1', $_POST["zip01"]);
138            $_POST["zip02"] = preg_replace('/^[  \r\n]*(.*?)[  \r\n]*$/u', '$1', $_POST["zip02"]);
139            $_POST["addr01"] = preg_replace('/^[  \r\n]*(.*?)[  \r\n]*$/u', '$1', $_POST["addr01"]);
140            $_POST["addr02"] = preg_replace('/^[  \r\n]*(.*?)[  \r\n]*$/u', '$1', $_POST["addr02"]);
141            $_POST["tel01"] = preg_replace('/^[  \r\n]*(.*?)[  \r\n]*$/u', '$1', $_POST["tel01"]);
142            $_POST["tel02"] = preg_replace('/^[  \r\n]*(.*?)[  \r\n]*$/u', '$1', $_POST["tel02"]);
143            $_POST["tel03"] = preg_replace('/^[  \r\n]*(.*?)[  \r\n]*$/u', '$1', $_POST["tel03"]);
144            $_POST["fax01"] = preg_replace('/^[  \r\n]*(.*?)[  \r\n]*$/u', '$1', $_POST["fax01"]);
145            $_POST["fax02"] = preg_replace('/^[  \r\n]*(.*?)[  \r\n]*$/u', '$1', $_POST["fax02"]);
146            $_POST["fax03"] = preg_replace('/^[  \r\n]*(.*?)[  \r\n]*$/u', '$1', $_POST["fax03"]);
147            $_POST["email"] = preg_replace('/^[  \r\n]*(.*?)[  \r\n]*$/u', '$1', $_POST["email"]);
148            $_POST["email02"] = preg_replace('/^[  \r\n]*(.*?)[  \r\n]*$/u', '$1', $_POST["email02"]);
149            $_POST["password"] = preg_replace('/^[  \r\n]*(.*?)[  \r\n]*$/u', '$1', $_POST["password"]);
150            $_POST["password02"] = preg_replace('/^[  \r\n]*(.*?)[  \r\n]*$/u', '$1', $_POST["password02"]);
151            $_POST["reminder_answer"] = preg_replace('/^[  \r\n]*(.*?)[  \r\n]*$/u', '$1', $_POST["reminder_answer"]);
152
153            //-- POSTデータの引き継ぎ
154            $this->arrForm = $_POST;
155
156            //SSL用
157            $this->arrForm[ssl_url] = $ssl_url;
158
159            if($this->arrForm['year'] == '----') {
160                $this->arrForm['year'] = '';
161            }
162
163            $this->arrForm['email'] = strtolower($this->arrForm['email']);      // emailはすべて小文字で処理
164            $this->arrForm['email02'] = strtolower($this->arrForm['email02']);  // emailはすべて小文字で処理
165
166            //-- 入力データの変換
167            $this->arrForm = $this->lfConvertParam($this->arrForm, $arrRegistColumn);
168
169            //-- 入力エラーチェック
170            $this->arrErr = $this->lfErrorCheck($this->arrForm);
171
172            if ($this->arrErr || $_POST["mode"] == "return") {      // 入力エラーのチェック
173                foreach($arrRegistColumn as $key) {
174                    $this->$key['column'] = $this->arrForm[$key['column']];
175                }
176
177            } else {
178
179                //-- 確認
180                if ($_POST["mode"] == "confirm") {
181                    foreach($this->arrForm as $key => $val) {
182                        if ($key != "mode" && $key != "subm") $this->list_data[ $key ] = $val;
183                    }
184                    //パスワード表示
185                    $passlen = strlen($this->arrForm['password']);
186                    $this->passlen = SC_Utils_Ex::lfPassLen($passlen);
187
188                    $this->tpl_css = '/css/layout/entry/confirm.css';
189                    $this->tpl_mainpage = 'entry/confirm.tpl';
190                    $this->tpl_title = '会員登録(確認ページ)';
191
192                }
193
194                //-- 会員登録と完了画面
195                if ($_POST["mode"] == "complete") {
196                    // キャンペーンからの遷移の時用の値
197                    if($objCampaignSess->getIsCampaign()) {
198                        $this->etc_value = "&cp=".$objCampaignSess->getCampaignId();
199                    }
200
201                    // 会員情報の登録
202                    $this->CONF = $CONF;
203                    $this->uniqid = $this->lfRegistData ($this->arrForm, $arrRegistColumn, $arrRejectRegistColumn, CUSTOMER_CONFIRM_MAIL);
204
205                    $this->tpl_css = '/css/layout/entry/complete.css';
206                    $this->tpl_mainpage = 'entry/complete.tpl';
207                    $this->tpl_title = '会員登録(完了ページ)';
208
209                    // 完了メール送信
210                    $this->name01 = $_POST['name01'];
211                    $this->name02 = $_POST['name02'];
212                    $objMailText = new SC_SiteView();
213                    $objMailText->assignobj($this);
214
215                    $mailHelper = new SC_Helper_Mail_Ex();
216                    $objQuery = new SC_Query();
217                    // 仮会員が有効の場合
218                    if(CUSTOMER_CONFIRM_MAIL == true) {
219                        $subject = $mailHelper->sfMakesubject($objQuery, $objMailText, $this, '会員登録のご確認');
220                        $toCustomerMail = $objMailText->fetch("mail_templates/customer_mail.tpl");
221                    } else {
222                        $subject = $mailHelper->sfMakesubject($objQuery, $objMailText, $this, '会員登録のご完了');
223                        $toCustomerMail = $objMailText->fetch("mail_templates/customer_regist_mail.tpl");
224                        // ログイン状態にする
225                        $objCustomer->setLogin($_POST["email"]);
226                    }
227
228                    $objMail = new SC_SendMail();
229                    $objMail->setItem(
230                                        ''                                  // 宛先
231                                        , $subject                          // サブジェクト
232                                        , $toCustomerMail                   // 本文
233                                        , $CONF["email03"]                  // 配送元アドレス
234                                        , $CONF["shop_name"]                // 配送元 名前
235                                        , $CONF["email03"]                  // reply_to
236                                        , $CONF["email04"]                  // return_path
237                                        , $CONF["email04"]                  //  Errors_to
238                                    );
239                    // 宛先の設定
240                    $name = $_POST["name01"] . $_POST["name02"] ." 様";
241                    $objMail->setTo($_POST["email"], $name);
242                    $objMail->sendMail();
243
244                    // 完了ページに移動させる。
245                    $customer_id = $objQuery->get("dtb_customer", "customer_id", "secret_key = ?", array($this->uniqid));
246                    $this->sendRedirect($this->getLocation("./complete.php", array("ci" => $customer_id)));
247                    exit;
248                }
249            }
250        }
251
252        if($this->year == '') {
253            $this->year = '----';
254        }
255
256        $this->transactionid = $this->getToken();
257
258        //---- ページ表示
259        $objView->assignobj($this);
260        // フレームを選択(キャンペーンページから遷移なら変更)
261        $objCampaignSess->pageView($objView);
262    }
263
264    /**
265     * モバイルページを初期化する.
266     *
267     * @return void
268     */
269    function mobileInit() {
270        $this->init();
271        $this->tpl_mainpage = 'entry/index.tpl';        // メインテンプレート
272        $this->tpl_title .= '会員登録(1/3)';            // ページタイトル
273    }
274
275    /**
276     * Page のプロセス(モバイル).
277     *
278     * @return void
279     */
280    function mobileProcess() {
281        //---- ページ初期設定
282        $objDb = new SC_Helper_DB_Ex();
283        $objMobile = new SC_Helper_Mobile_Ex();
284        $CONF = $objDb->sf_getBasisData();                  // 店舗基本情報
285        $objConn = new SC_DbConn();
286        $objView = new SC_MobileView();
287        $objCustomer = new SC_Customer();
288        $objDate = new SC_Date(START_BIRTH_YEAR, date("Y",strtotime("now")));
289
290        // 空メール
291        if (isset($_SESSION['mobile']['kara_mail_from'])) {
292            $_POST['email'] = $_SESSION['mobile']['kara_mail_from'];
293            $this->tpl_kara_mail_from = $_POST['email'];
294        } elseif (MOBILE_USE_KARA_MAIL) {
295            $token = $objMobile->gfPrepareKaraMail('entry/index.php');
296            if ($token !== false) {
297                $this->tpl_mainpage = 'entry/mail.tpl';
298                $this->tpl_title = '会員登録(空メール)';
299                $this->tpl_kara_mail_to = MOBILE_KARA_MAIL_ADDRESS_USER . MOBILE_KARA_MAIL_ADDRESS_DELIMITER . 'entry_' . $token . '@' . MOBILE_KARA_MAIL_ADDRESS_DOMAIN;
300                $this->tpl_from_address = $CONF['email03'];
301            }
302        }
303
304        // レイアウトデザインを取得
305        $objLayout = new SC_Helper_PageLayout_Ex();
306        $objLayout->sfGetPageLayout($this, false, DEF_LAYOUT);
307
308        //---- 登録用カラム配列
309        $arrRegistColumn = array(
310                                 array(  "column" => "name01", "convert" => "aKV" ),
311                                 array(  "column" => "name02", "convert" => "aKV" ),
312                                 array(  "column" => "kana01", "convert" => "CKV" ),
313                                 array(  "column" => "kana02", "convert" => "CKV" ),
314                                 array(  "column" => "zip01", "convert" => "n" ),
315                                 array(  "column" => "zip02", "convert" => "n" ),
316                                 array(  "column" => "pref", "convert" => "n" ),
317                                 array(  "column" => "addr01", "convert" => "aKV" ),
318                                 array(  "column" => "addr02", "convert" => "aKV" ),
319                                 array(  "column" => "email", "convert" => "a" ),
320                                 array(  "column" => "email02", "convert" => "a" ),
321                                 array(  "column" => "email_mobile", "convert" => "a" ),
322                                 array(  "column" => "email_mobile02", "convert" => "a" ),
323                                 array(  "column" => "tel01", "convert" => "n" ),
324                                 array(  "column" => "tel02", "convert" => "n" ),
325                                 array(  "column" => "tel03", "convert" => "n" ),
326                                 array(  "column" => "fax01", "convert" => "n" ),
327                                 array(  "column" => "fax02", "convert" => "n" ),
328                                 array(  "column" => "fax03", "convert" => "n" ),
329                                 array(  "column" => "sex", "convert" => "n" ),
330                                 array(  "column" => "job", "convert" => "n" ),
331                                 array(  "column" => "birth", "convert" => "n" ),
332                                 array(  "column" => "year", "convert" => "n" ),
333                                 array(  "column" => "month", "convert" => "n" ),
334                                 array(  "column" => "day", "convert" => "n" ),
335                                 array(  "column" => "reminder", "convert" => "n" ),
336                                 array(  "column" => "reminder_answer", "convert" => "aKV"),
337                                 array(  "column" => "password", "convert" => "a" ),
338                                 array(  "column" => "password02", "convert" => "a" ),
339                                 array(  "column" => "mailmaga_flg", "convert" => "n" ),
340                                 );
341
342        //---- 登録除外用カラム配列
343        $arrRejectRegistColumn = array("year", "month", "day", "email02", "email_mobile02", "password02");
344
345        if ($_SERVER["REQUEST_METHOD"] == "POST") {
346
347            //-- POSTデータの引き継ぎ
348            $this->arrForm = $_POST;
349
350            if(isset($this->arrForm['year'])
351               && $this->arrForm['year'] == '----') {
352                $this->arrForm['year'] = '';
353            }
354
355            $this->arrForm['email'] = strtolower($this->arrForm['email']);      // emailはすべて小文字で処理
356
357            //-- 入力データの変換
358            $this->arrForm = $this->lfConvertParam($this->arrForm, $arrRegistColumn);
359
360            // 戻るボタン用処理
361            if (!empty($_POST["return"])) {
362                switch ($_POST["mode"]) {
363                case "complete":
364                    $_POST["mode"] = "set3";
365                    break;
366                case "confirm":
367                    $_POST["mode"] = "set2";
368                    break;
369                default:
370                    $_POST["mode"] = "set1";
371                    break;
372                }
373            }
374
375            //-- 入力エラーチェック
376            if ($_POST["mode"] == "set1") {
377                $this->arrErr = $this->lfErrorCheck1($this->arrForm);
378                $this->tpl_mainpage = 'entry/index.tpl';
379                $this->tpl_title = '会員登録(1/3)';
380            } elseif ($_POST["mode"] == "set2") {
381                $this->arrErr = $this->lfErrorCheck2($this->arrForm);
382                $this->tpl_mainpage = 'entry/set1.tpl';
383                $this->tpl_title = '会員登録(2/3)';
384            } else {
385                $this->arrErr = $this->lfErrorCheck3($this->arrForm);
386                $this->tpl_mainpage = 'entry/set2.tpl';
387                $this->tpl_title = '会員登録(3/3)';
388            }
389
390            foreach($arrRegistColumn as $key) {
391                $this->$key['column'] = $this->arrForm[$key['column']];
392            }
393
394            if ($this->arrErr || !empty($_POST["return"])) {        // 入力エラーのチェック
395
396                //-- データの設定
397                if ($_POST["mode"] == "set1") {
398                    $checkVal = array("email", "password", "reminder", "reminder_answer", "name01", "name02", "kana01", "kana02");
399                } elseif ($_POST["mode"] == "set2") {
400                    $checkVal = array("sex", "year", "month", "day", "zip01", "zip02");
401                } else {
402                    $checkVal = array("pref", "addr01", "addr02", "tel01", "tel02", "tel03", "mailmaga_flg");
403                }
404
405                foreach($this->arrForm as $key => $val) {
406                    if ($key != "mode" && $key != "submit" && $key != "return" && $key != session_name() && !in_array($key, $checkVal))
407                        $this->list_data[ $key ] = $val;
408                }
409
410
411
412            } else {
413
414                //-- テンプレート設定
415                if ($_POST["mode"] == "set1") {
416                    $this->tpl_mainpage = 'entry/set1.tpl';
417                    $this->tpl_title = '会員登録(2/3)';
418                } elseif ($_POST["mode"] == "set2") {
419                    $this->tpl_mainpage = 'entry/set2.tpl';
420                    $this->tpl_title = '会員登録(3/3)';
421
422                    if (@$this->arrForm['pref'] == "" && @$this->arrForm['addr01'] == "" && @$this->arrForm['addr02'] == "") {
423                        $address = $this->lfGetAddress($_REQUEST['zip01'].$_REQUEST['zip02']);
424                        $this->pref = @$address[0]['state'];
425                        $this->addr01 = @$address[0]['city'] . @$address[0]['town'];
426                    }
427                } elseif ($_POST["mode"] == "confirm") {
428                    //パスワード表示
429                    $passlen = strlen($this->arrForm['password']);
430                    $this->passlen = $this->lfPassLen($passlen);
431
432                    //メール受け取り
433                    if (!isset($this->arrForm['mailmaga_flg'])) $this->arrForm['mailmaga_flg']  = "";
434                    if (strtolower($this->arrForm['mailmaga_flg']) == "on") {
435                        $this->arrForm['mailmaga_flg']  = "2";
436                    } else {
437                        $this->arrForm['mailmaga_flg']  = "3";
438                    }
439
440                    $this->tpl_mainpage = 'entry/confirm.tpl';
441                    $this->tpl_title = '会員登録(確認ページ)';
442
443                }
444
445                //-- データ設定
446                unset($this->list_data);
447                if ($_POST["mode"] == "set1") {
448                    $checkVal = array("sex", "year", "month", "day", "zip01", "zip02");
449                } elseif ($_POST["mode"] == "set2") {
450                    $checkVal = array("pref", "addr01", "addr02", "tel01", "tel02", "tel03", "mailmaga_flg");
451                } else {
452                    $checkVal = array();
453                }
454
455                foreach($this->arrForm as $key => $val) {
456                    if ($key != "mode" && $key != "submit" && $key != "confirm" && $key != "return" && $key != session_name() && !in_array($key, $checkVal)) {
457                        $this->list_data[ $key ] = $val;
458                    }
459                }
460
461
462                //-- 仮登録と完了画面
463                if ($_POST["mode"] == "complete") {
464
465                    // 確認画面で再度エラーチェックを行う。(画面1)
466                    $arrErr = $this->lfErrorCheck1($this->arrForm);
467                    if(count($arrErr) > 0){
468                        $this->tpl_mainpage = 'entry/index.tpl';
469                        $this->tpl_title = '会員登録(1/3)';
470                        $this->arrErr = $arrErr;
471                        //---- ページ表示
472                        $objView->assignobj($this);
473                        $objView->display(SITE_FRAME);
474                        exit();
475                    }
476
477                    // 確認画面で再度エラーチェックを行う。(画面2)
478                    $arrErr = $this->lfErrorCheck2($this->arrForm);
479                    if(count($arrErr) > 0){
480                        $this->tpl_mainpage = 'entry/set1.tpl';
481                        $this->tpl_title = '会員登録(2/3)';
482                        $this->arrErr = $arrErr;
483                        //---- ページ表示
484                        $objView->assignobj($this);
485                        $objView->display(SITE_FRAME);
486                        exit();
487                    }
488
489                    // 確認画面で再度エラーチェックを行う。(画面3)
490                    $arrErr = $this->lfErrorCheck3($this->arrForm);
491                    if(count($arrErr) > 0){
492                        $this->tpl_mainpage = 'entry/set2.tpl';
493                        $this->tpl_title = '会員登録(3/3)';
494                        $this->arrErr = $arrErr;
495                        //---- ページ表示
496                        $objView->assignobj($this);
497                        $objView->display(SITE_FRAME);
498                        exit();
499                    }
500
501                    $this->CONF = $CONF;
502                    $this->uniqid = $this->lfRegistData ($this->arrForm, $arrRegistColumn, $arrRejectRegistColumn, CUSTOMER_CONFIRM_MAIL, true, $this->arrForm["email"]);
503
504                    // 空メールを受信済みの場合はすぐに本登録完了にする。
505                    if (isset($_SESSION['mobile']['kara_mail_from'])) {
506                        $param = array("mode" => "regist",
507                                       "id" => $this->uniqid,
508                                       session_name() => session_id());
509                        $this->sendRedirect($this->getLocation(MOBILE_URL_DIR . "regist/index.php", $param));
510                        exit;
511                    }
512
513                    $this->tpl_mainpage = 'entry/complete.tpl';
514                    $this->tpl_title = '会員登録(完了ページ)';
515
516                    $objMobile->sfMobileSetExtSessionId('id', $this->uniqid, 'regist/index.php');
517
518                    // 仮登録完了メール送信
519                    $this->to_name01 = $_POST['name01'];
520                    $this->to_name02 = $_POST['name02'];
521                    $objMailText = new SC_MobileView();
522                    $objMailText->assignobj($this);
523                    $objHelperMail = new SC_Helper_Mail_Ex();
524                    $objQuery = new SC_Query();
525
526                    // 仮会員が有効の場合
527                    if(CUSTOMER_CONFIRM_MAIL == true) {
528                        // Moba8パラメーターを保持する場合はカラム追加
529                        if (isset($_SESSION['a8'])) $this->etc_value = "&a8=". $_SESSION['a8'];
530                        $subject = $objHelperMail->sfMakeSubject($objQuery, $objMailText, $this, '会員登録のご確認');
531                        $toCustomerMail = $objMailText->fetch("mail_templates/customer_mail.tpl");
532                    } else {
533                        $subject = $objHelperMail->sfMakesubject($objQuery, $objMailText, $this, '会員登録のご完了');
534                        $toCustomerMail = $objMailText->fetch("mail_templates/customer_regist_mail.tpl");
535                        // ログイン状態にする
536                        $objCustomer->setLogin($_POST["email"]);
537                    }
538
539                    $objMail = new SC_SendMail();
540                    $objMail->setItem(
541                                      ''                                    // 宛先
542                                      , $subject                            // サブジェクト
543                                      , $toCustomerMail                 // 本文
544                                      , $CONF["email03"]                    // 配送元アドレス
545                                      , $CONF["shop_name"]              // 配送元 名前
546                                      , $CONF["email03"]                    // reply_to
547                                      , $CONF["email04"]                    // return_path
548                                      , $CONF["email04"]                    //  Errors_to
549                                      , $CONF["email01"]                    //  Bcc
550                                      );
551                    // 宛先の設定
552                    $name = $_POST["name01"] . $_POST["name02"] ." 様";
553                    $objMail->setTo($_POST["email"], $name);
554                    $objMail->sendMail();
555
556                    // 完了ページに移動させる。
557                    $this->sendRedirect($this->getLocation("./complete.php"), true);
558                    exit;
559                }
560            }
561        }
562
563        //---- ページ表示
564        $objView->assignobj($this);
565        $objView->display(SITE_FRAME);
566    }
567
568    /**
569     * デストラクタ.
570     *
571     * @return void
572     */
573    function destroy() {
574        parent::destroy();
575    }
576
577    // }}}
578    // {{{ protected functions
579
580    // 会員情報の登録
581    function lfRegistData ($array, $arrRegistColumn, $arrRejectRegistColumn, $confirm_flg, $isMobile = false, $email_mobile = "") {
582        $objConn = new SC_DbConn();
583
584        // 登録データの生成
585        foreach ($arrRegistColumn as $data) {
586            if (strlen($array[ $data["column"] ]) > 0 && ! in_array($data["column"], $arrRejectRegistColumn)) {
587                $arrRegist[ $data["column"] ] = $array[ $data["column"] ];
588            }
589        }
590
591        // 誕生日が入力されている場合
592        if (strlen($array["year"]) > 0 ) {
593            $arrRegist["birth"] = $array["year"] ."/". $array["month"] ."/". $array["day"] ." 00:00:00";
594        }
595
596        // パスワードの暗号化
597        $arrRegist["password"] = sha1($arrRegist["password"] . ":" . AUTH_MAGIC);
598
599        // 仮会員登録の場合
600        if($confirm_flg == true) {
601            // 重複しない会員登録キーを発行する。
602            $count = 1;
603            while ($count != 0) {
604                $uniqid = SC_Utils_Ex::sfGetUniqRandomId("t");
605                $count = $objConn->getOne("SELECT COUNT(*) FROM dtb_customer WHERE secret_key = ?", array($uniqid));
606            }
607            switch($array["mailmaga_flg"]) {
608                case 1:
609                    $arrRegist["mailmaga_flg"] = 4;
610                    break;
611                case 2:
612                    $arrRegist["mailmaga_flg"] = 5;
613                    break;
614                default:
615                    $arrRegist["mailmaga_flg"] = 6;
616                    break;
617            }
618
619            $arrRegist["status"] = "1";             // 仮会員
620        } else {
621            // 重複しない会員登録キーを発行する。
622            $count = 1;
623            while ($count != 0) {
624                $uniqid = SC_Utils_Ex::sfGetUniqRandomId("r");
625                $count = $objConn->getOne("SELECT COUNT(*) FROM dtb_customer WHERE secret_key = ?", array($uniqid));
626            }
627            $arrRegist["status"] = "2";             // 本会員
628        }
629
630        /*
631          secret_keyは、テーブルで重複許可されていない場合があるので、
632          本会員登録では利用されないがセットしておく。
633        */
634        $arrRegist["secret_key"] = $uniqid;     // 会員登録キー
635        $arrRegist["create_date"] = "now()";    // 作成日
636        $arrRegist["update_date"] = "now()";    // 更新日
637        $arrRegist["first_buy_date"] = "";      // 最初の購入日
638        $arrRegist["point"] = $this->CONF["welcome_point"]; // 入会時ポイント
639
640        if ($isMobile) {
641            // 携帯メールアドレス
642            $arrRegist['email_mobile'] = $arrRegist['email'];
643            //PHONE_IDを取り出す
644            $phoneId = SC_MobileUserAgent::getId();
645            $arrRegist['mobile_phone_id'] =  $phoneId;
646        }
647
648        //-- 仮登録実行
649        $objConn->query("BEGIN");
650
651        $objQuery = new SC_Query();
652        $objQuery->insert("dtb_customer", $arrRegist);
653
654
655    /* メルマガ会員機能は現在停止中 2007/03/07
656
657
658        //-- 非会員でメルマガ登録しているかの判定
659        $sql = "SELECT count(*) FROM dtb_customer_mail WHERE email = ?";
660        $mailResult = $objConn->getOne($sql, array($arrRegist["email"]));
661
662        //-- メルマガ仮登録実行
663        $arrRegistMail["email"] = $arrRegist["email"];
664        if ($array["mailmaga_flg"] == 1) {
665            $arrRegistMail["mailmaga_flg"] = 4;
666        } elseif ($array["mailmaga_flg"] == 2) {
667            $arrRegistMail["mailmaga_flg"] = 5;
668        } else {
669            $arrRegistMail["mailmaga_flg"] = 6;
670        }
671        $arrRegistMail["update_date"] = "now()";
672
673        // 非会員でメルマガ登録している場合
674        if ($mailResult == 1) {
675            $objQuery->update("dtb_customer_mail", $arrRegistMail, "email = '" .addslashes($arrRegistMail["email"]). "'");
676        } else {                // 新規登録の場合
677            $arrRegistMail["create_date"] = "now()";
678            $objQuery->insert("dtb_customer_mail", $arrRegistMail);
679        }
680    */
681        $objConn->query("COMMIT");
682
683        return $uniqid;
684    }
685
686    //---- 取得文字列の変換
687    function lfConvertParam($array, $arrRegistColumn) {
688        /*
689         *  文字列の変換
690         *  K :  「半角(ハンカク)片仮名」を「全角片仮名」に変換
691         *  C :  「全角ひら仮名」を「全角かた仮名」に変換
692         *  V :  濁点付きの文字を一文字に変換。"K","H"と共に使用します
693         *  n :  「全角」数字を「半角(ハンカク)」に変換
694         *  a :  全角英数字を半角英数字に変換する
695         */
696        // カラム名とコンバート情報
697        foreach ($arrRegistColumn as $data) {
698            $arrConvList[ $data["column"] ] = $data["convert"];
699        }
700        // 文字変換
701        foreach ($arrConvList as $key => $val) {
702            // POSTされてきた値のみ変換する。
703            if(isset($array[$key]) && strlen($array[$key]) > 0) {
704                $array[$key] = mb_convert_kana($array[$key] ,$val);
705            }
706        }
707        return $array;
708    }
709
710    //---- 入力エラーチェック
711    function lfErrorCheck($array) {
712
713        $objErr = new SC_CheckError($array);
714
715        $objErr->doFunc(array("お名前(姓)", 'name01', STEXT_LEN), array("EXIST_CHECK", "NO_SPTAB", "SPTAB_CHECK" ,"MAX_LENGTH_CHECK"));
716        $objErr->doFunc(array("お名前(名)", 'name02', STEXT_LEN), array("EXIST_CHECK", "NO_SPTAB", "SPTAB_CHECK" , "MAX_LENGTH_CHECK"));
717        $objErr->doFunc(array("フリガナ(セイ)", 'kana01', STEXT_LEN), array("EXIST_CHECK", "NO_SPTAB", "SPTAB_CHECK" ,"MAX_LENGTH_CHECK", "KANA_CHECK"));
718        $objErr->doFunc(array("フリガナ(メイ)", 'kana02', STEXT_LEN), array("EXIST_CHECK", "NO_SPTAB", "SPTAB_CHECK" ,"MAX_LENGTH_CHECK", "KANA_CHECK"));
719        $objErr->doFunc(array("郵便番号1", "zip01", ZIP01_LEN ) ,array("EXIST_CHECK", "SPTAB_CHECK" ,"NUM_CHECK", "NUM_COUNT_CHECK"));
720        $objErr->doFunc(array("郵便番号2", "zip02", ZIP02_LEN ) ,array("EXIST_CHECK", "SPTAB_CHECK" ,"NUM_CHECK", "NUM_COUNT_CHECK"));
721        $objErr->doFunc(array("郵便番号", "zip01", "zip02"), array("ALL_EXIST_CHECK"));
722        $objErr->doFunc(array("都道府県", 'pref'), array("SELECT_CHECK","NUM_CHECK"));
723        $objErr->doFunc(array("ご住所1", "addr01", MTEXT_LEN), array("EXIST_CHECK","SPTAB_CHECK" ,"MAX_LENGTH_CHECK"));
724        $objErr->doFunc(array("ご住所2", "addr02", MTEXT_LEN), array("EXIST_CHECK","SPTAB_CHECK" ,"MAX_LENGTH_CHECK"));
725        $objErr->doFunc(array('メールアドレス', "email", MTEXT_LEN) ,array("NO_SPTAB", "EXIST_CHECK", "EMAIL_CHECK", "SPTAB_CHECK" ,"EMAIL_CHAR_CHECK", "MAX_LENGTH_CHECK"));
726        $objErr->doFunc(array('メールアドレス(確認)', "email02", MTEXT_LEN) ,array("NO_SPTAB", "EXIST_CHECK", "EMAIL_CHECK","SPTAB_CHECK" , "EMAIL_CHAR_CHECK", "MAX_LENGTH_CHECK"));
727        $objErr->doFunc(array('メールアドレス', 'メールアドレス(確認)', "email", "email02") ,array("EQUAL_CHECK"));
728
729        //現会員の判定 → 現会員もしくは仮登録中は、メアド一意が前提になってるので同じメアドで登録不可
730        if (strlen($array["email"]) > 0) {
731            $array["email"] = strtolower($array["email"]);
732            $objQuery = new SC_Query();
733            $arrRet = $objQuery->select("email, update_date, del_flg", "dtb_customer","email = ? ORDER BY del_flg", array($array["email"]));
734
735            if(count($arrRet) > 0) {
736                if($arrRet[0]['del_flg'] != '1') {
737                    // 会員である場合
738                    if (!isset($objErr->arrErr['email'])) $objErr->arrErr['email'] = "";
739                    $objErr->arrErr["email"] .= "※ すでに会員登録で使用されているメールアドレスです。<br />";
740                } else {
741                    // 退会した会員である場合
742                    $leave_time = SC_Utils_Ex::sfDBDatetoTime($arrRet[0]['update_date']);
743                    $now_time = time();
744                    $pass_time = $now_time - $leave_time;
745                    // 退会から何時間-経過しているか判定する。
746                    $limit_time = ENTRY_LIMIT_HOUR * 3600;
747                    if($pass_time < $limit_time) {
748                        if (!isset($objErr->arrErr['email'])) $objErr->arrErr['email'] = "";
749                        $objErr->arrErr["email"] .= "※ 退会から一定期間の間は、同じメールアドレスを使用することはできません。<br />";
750                    }
751                }
752            }
753        }
754
755        $objErr->doFunc(array("お電話番号1", 'tel01'), array("EXIST_CHECK","SPTAB_CHECK" ));
756        $objErr->doFunc(array("お電話番号2", 'tel02'), array("EXIST_CHECK","SPTAB_CHECK" ));
757        $objErr->doFunc(array("お電話番号3", 'tel03'), array("EXIST_CHECK","SPTAB_CHECK" ));
758        $objErr->doFunc(array("お電話番号", "tel01", "tel02", "tel03",TEL_ITEM_LEN) ,array("TEL_CHECK"));
759        $objErr->doFunc(array("FAX番号1", 'fax01'), array("SPTAB_CHECK"));
760        $objErr->doFunc(array("FAX番号2", 'fax02'), array("SPTAB_CHECK"));
761        $objErr->doFunc(array("FAX番号3", 'fax03'), array("SPTAB_CHECK"));
762        $objErr->doFunc(array("FAX番号", "fax01", "fax02", "fax03", TEL_ITEM_LEN) ,array("TEL_CHECK"));
763        $objErr->doFunc(array("ご性別", "sex") ,array("SELECT_CHECK", "NUM_CHECK"));
764        $objErr->doFunc(array("パスワード", 'password', PASSWORD_LEN1, PASSWORD_LEN2), array("EXIST_CHECK", "SPTAB_CHECK" ,"ALNUM_CHECK", "NUM_RANGE_CHECK"));
765        $objErr->doFunc(array("パスワード(確認)", 'password02', PASSWORD_LEN1, PASSWORD_LEN2), array("EXIST_CHECK", "SPTAB_CHECK" ,"ALNUM_CHECK", "NUM_RANGE_CHECK"));
766        $objErr->doFunc(array('パスワード', 'パスワード(確認)', "password", "password02") ,array("EQUAL_CHECK"));
767        $objErr->doFunc(array("パスワードを忘れたときのヒント 質問", "reminder") ,array("SELECT_CHECK", "NUM_CHECK"));
768        $objErr->doFunc(array("パスワードを忘れたときのヒント 答え", "reminder_answer", STEXT_LEN) ,array("EXIST_CHECK","SPTAB_CHECK" , "MAX_LENGTH_CHECK"));
769        $objErr->doFunc(array("メールマガジン", "mailmaga_flg") ,array("SELECT_CHECK", "NUM_CHECK"));
770
771        $objErr->doFunc(array("生年月日", "year", "month", "day"), array("CHECK_DATE"));
772        $objErr->doFunc(array("メールマガジン", 'mailmaga_flg'), array("SELECT_CHECK"));
773        return $objErr->arrErr;
774    }
775
776    //確認ページ用パスワード表示用
777
778    function lfPassLen($passlen){
779        $ret = "";
780        for ($i=0;$i<$passlen;true){
781        $ret.="*";
782        $i++;
783        }
784        return $ret;
785    }
786
787    // }}}
788    // {{{ mobile functions
789
790    // 郵便番号から住所の取得
791    function lfGetAddress($zipcode) {
792
793        $conn = new SC_DBconn(ZIP_DSN);
794
795        // 郵便番号検索文作成
796        $zipcode = mb_convert_kana($zipcode ,"n");
797        $sqlse = "SELECT state, city, town FROM mtb_zip WHERE zipcode = ?";
798
799        $data_list = $conn->getAll($sqlse, array($zipcode));
800
801        // インデックスと値を反転させる。
802        $arrREV_PREF = array_flip($this->arrPref);
803
804        /*
805         総務省からダウンロードしたデータをそのままインポートすると
806         以下のような文字列が入っているので  対策する。
807         ・(1・19丁目)
808         ・以下に掲載がない場合
809        */
810        $town =  $data_list[0]['town'];
811        $town = ereg_replace("(.*)$","",$town);
812        $town = ereg_replace("以下に掲載がない場合","",$town);
813        $data_list[0]['town'] = $town;
814        $data_list[0]['state'] = $arrREV_PREF[$data_list[0]['state']];
815
816        return $data_list;
817    }
818
819    //---- 入力エラーチェック
820    function lfErrorCheck1($array) {
821
822        $objErr = new SC_CheckError($array);
823        $objDb = new SC_Helper_DB_Ex();
824
825        $objErr->doFunc(array("お名前(姓)", 'name01', STEXT_LEN), array("EXIST_CHECK", "NO_SPTAB", "SPTAB_CHECK" ,"MAX_LENGTH_CHECK"));
826        $objErr->doFunc(array("お名前(名)", 'name02', STEXT_LEN), array("EXIST_CHECK", "NO_SPTAB", "SPTAB_CHECK" , "MAX_LENGTH_CHECK"));
827        $objErr->doFunc(array("お名前(カナ/姓)", 'kana01', STEXT_LEN), array("EXIST_CHECK", "NO_SPTAB", "SPTAB_CHECK" ,"MAX_LENGTH_CHECK", "KANA_CHECK"));
828        $objErr->doFunc(array("お名前(カナ/名)", 'kana02', STEXT_LEN), array("EXIST_CHECK", "NO_SPTAB", "SPTAB_CHECK" ,"MAX_LENGTH_CHECK", "KANA_CHECK"));
829        $objErr->doFunc(array('メールアドレス', "email", MTEXT_LEN) ,array("NO_SPTAB", "EXIST_CHECK", "EMAIL_CHECK", "SPTAB_CHECK" ,"EMAIL_CHAR_CHECK", "MAX_LENGTH_CHECK", "MOBILE_EMAIL_CHECK"));
830
831        //現会員の判定 → 現会員もしくは仮登録中は、メアド一意が前提になってるので同じメアドで登録不可
832        if (strlen($array["email"]) > 0) {
833            $array['email'] = strtolower($array['email']);
834            $objQuery = new SC_Query();
835            $arrRet = $objQuery->select("email, update_date, del_flg", "dtb_customer","email = ? OR email_mobile = ? ORDER BY del_flg", array($array["email"], $array["email"]));
836
837            if(count($arrRet) > 0) {
838                if($arrRet[0]['del_flg'] != '1') {
839                    // 会員である場合
840                    $objErr->arrErr["email"] .= "※ すでに会員登録で使用されているメールアドレスです。<br />";
841                } else {
842                    // 退会した会員である場合
843                    $leave_time = SC_Utils_Ex::sfDBDatetoTime($arrRet[0]['update_date']);
844                    $now_time = time();
845                    $pass_time = $now_time - $leave_time;
846                    // 退会から何時間-経過しているか判定する。
847                    $limit_time = ENTRY_LIMIT_HOUR * 3600;
848                    if($pass_time < $limit_time) {
849                        $objErr->arrErr["email"] .= "※ 退会から一定期間の間は、同じメールアドレスを使用することはできません。<br />";
850                    }
851                }
852            }
853        }
854
855        $objErr->doFunc(array("パスワード", 'password', PASSWORD_LEN1, PASSWORD_LEN2), array("EXIST_CHECK", "SPTAB_CHECK" ,"ALNUM_CHECK", "NUM_RANGE_CHECK"));
856        $objErr->doFunc(array("パスワード確認用の質問", "reminder") ,array("SELECT_CHECK", "NUM_CHECK"));
857        $objErr->doFunc(array("パスワード確認用の質問の答え", "reminder_answer", STEXT_LEN) ,array("EXIST_CHECK","SPTAB_CHECK" , "MAX_LENGTH_CHECK"));
858
859        return $objErr->arrErr;
860    }
861
862    //---- 入力エラーチェック
863    function lfErrorCheck2($array) {
864        $objErr = new SC_CheckError($array);
865
866        $objErr->doFunc(array("郵便番号1", "zip01", ZIP01_LEN ) ,array("EXIST_CHECK", "SPTAB_CHECK" ,"NUM_CHECK", "NUM_COUNT_CHECK"));
867        $objErr->doFunc(array("郵便番号2", "zip02", ZIP02_LEN ) ,array("EXIST_CHECK", "SPTAB_CHECK" ,"NUM_CHECK", "NUM_COUNT_CHECK"));
868        $objErr->doFunc(array("郵便番号", "zip01", "zip02"), array("ALL_EXIST_CHECK"));
869
870        $objErr->doFunc(array("性別", "sex") ,array("SELECT_CHECK", "NUM_CHECK"));
871        $objErr->doFunc(array("生年月日 (年)", "year", 4), array("EXIST_CHECK", "SPTAB_CHECK", "NUM_CHECK", "NUM_COUNT_CHECK"));
872        if (!isset($objErr->arrErr['year']) && strlen($array['year'] > 0)) {
873            $objErr->doFunc(array("生年月日 (年)", "year", $this->objDate->getStartYear()), array("MIN_CHECK"));
874            $objErr->doFunc(array("生年月日 (年)", "year", $this->objDate->getEndYear()), array("MAX_CHECK"));
875        }
876        $objErr->doFunc(array("生年月日 (月日)", "month", "day"), array("SELECT_CHECK"));
877        if (!isset($objErr->arrErr['year']) && !isset($objErr->arrErr['month']) && !isset($objErr->arrErr['day'])) {
878            $objErr->doFunc(array("生年月日", "year", "month", "day"), array("CHECK_DATE"));
879        }
880
881        return $objErr->arrErr;
882    }
883
884    //---- 入力エラーチェック
885    function lfErrorCheck3($array) {
886        $objErr = new SC_CheckError($array);
887
888        $objErr->doFunc(array("都道府県", 'pref'), array("SELECT_CHECK","NUM_CHECK"));
889        $objErr->doFunc(array("市区町村", "addr01", MTEXT_LEN), array("EXIST_CHECK","SPTAB_CHECK" ,"MAX_LENGTH_CHECK"));
890        $objErr->doFunc(array("番地", "addr02", MTEXT_LEN), array("EXIST_CHECK","SPTAB_CHECK" ,"MAX_LENGTH_CHECK"));
891        $objErr->doFunc(array("電話番号1", 'tel01'), array("EXIST_CHECK","SPTAB_CHECK" ));
892        $objErr->doFunc(array("電話番号2", 'tel02'), array("EXIST_CHECK","SPTAB_CHECK" ));
893        $objErr->doFunc(array("電話番号3", 'tel03'), array("EXIST_CHECK","SPTAB_CHECK" ));
894        $objErr->doFunc(array("電話番号", "tel01", "tel02", "tel03",TEL_ITEM_LEN) ,array("TEL_CHECK"));
895
896        return $objErr->arrErr;
897    }
898
899}
900?>
Note: See TracBrowser for help on using the repository browser.