source: branches/comu-ver2/data/class/pages/mypage/LC_Page_Mypage_LoginCheck.php @ 17605

Revision 17605, 4.1 KB checked in by Seasoft, 16 years ago (diff)

/index.php にリンクやリダイレクトしている箇所の「index.php」を定数化。

  • 定数「DIR_INDEX_FILE」… DirectoryIndex? の実ファイル名。現状の EC-CUBE は、「index.php」。/html/define.php で定義するが、定義が無い場合 SC_Initial::defineDirectoryIndex() で「index.php」と定義。本来は、プログラム中で実ファイルとしての index.php を指すときとは、この定数を使うのが良い気がするが、今回はそこまでは書き換えていない。
  • 定数「USE_FILENAME_DIR_INDEX」… DIR_INDEX_FILE にアクセスするときにファイル名を使用するか。/html/define.php で定義。
  • 定数「DIR_INDEX_URL」… /index.php にリンクやリダイレクトしている箇所の「index.php」部分を示す。この定数は SC_Initial::defineDirectoryIndex() で自動生成する。

・$_SERVERPHP_SELF? や自身をあらわすファイル名を利用している箇所を文字列「?」に書き換え。これにより、/ が自己URLにリンクするときに /index.php となることを防ぐ。RFC3986 を参考にする。モバイル端末がこのRFCに準拠しているのか確信が無いので、モバイルではこの変更は見送った。
・従来 / にリンクしていた箇所に、定数「DIR_INDEX_URL」を付加。漏れがあると予測される。

  • 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
Line 
1<?php
2/*
3 * This file is part of EC-CUBE
4 *
5 * Copyright(c) 2000-2007 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 * TODO frontparts/LC_Page_Frontparts_LoginCheck と抽象化させる
31 * FIXME ロジック見なおし...
32 *
33 * @package Page
34 * @author LOCKON CO.,LTD.
35 * @version $Id$
36 */
37class LC_Page_Mypage_LoginCheck extends LC_Page {
38
39    // }}}
40    // {{{ functions
41
42    /**
43     * Page を初期化する.
44     *
45     * @return void
46     */
47    function init() {
48        parent::init();
49    }
50
51    /**
52     * Page のプロセス.
53     *
54     * @return void
55     */
56    function process() {
57        $objCustomer = new SC_Customer();
58        // クッキー管理クラス
59        $objCookie = new SC_Cookie(COOKIE_EXPIRE);
60        // パラメータ管理クラス
61        $this->objFormParam = new SC_FormParam();
62        // パラメータ情報の初期化
63        $this->lfInitParam();
64        // POST値の取得
65        $this->objFormParam->setParam($_POST);
66
67        if (!isset($_POST['mode'])) $_POST['mode'] = "";
68
69        switch($_POST['mode']) {
70        case 'login':
71            $this->objFormParam->toLower('mypage_login_email');
72            $arrErr = $this->objFormParam->checkError();
73
74            // エラーの場合はエラー画面に遷移
75            if (count($arrErr) > 0) {
76                SC_Utils_Ex::sfDispSiteError(TEMP_LOGIN_ERROR);
77            }
78            $arrForm =  $this->objFormParam->getHashArray();
79            // クッキー保存判定
80            if ($arrForm['mypage_login_memory'] == "1" && $arrForm['mypage_login_email'] != "") {
81                $objCookie->setCookie('login_email', $_POST['mypage_login_email']);
82            } else {
83                $objCookie->setCookie('login_email', '');
84            }
85
86            if($objCustomer->getCustomerDataFromEmailPass($arrForm['mypage_login_pass'], $arrForm['mypage_login_email'], true)) {
87                $this->sendRedirect($this->getLocation(DIR_INDEX_URL));
88                exit;
89            } else {
90                $arrForm['mypage_login_email'] = strtolower($arrForm['mypage_login_email']);
91                $objQuery = new SC_Query;
92                $where = "(email = ? OR email_mobile = ?) AND status = 1 AND del_flg = 0";
93                $ret = $objQuery->count("dtb_customer", $where, array($arrForm['mypage_login_email'], $arrForm['mypage_login_email']));
94
95                if($ret > 0) {
96                    SC_Utils_Ex::sfDispSiteError(TEMP_LOGIN_ERROR);
97                } else {
98                    SC_Utils_Ex::sfDispSiteError(SITE_LOGIN_ERROR);
99                }
100            }
101            break;
102        }
103    }
104
105    /**
106     * デストラクタ.
107     *
108     * @return void
109     */
110    function destroy() {
111        parent::destroy();
112    }
113
114    /* パラメータ情報の初期化 */
115    function lfInitParam() {
116        $this->objFormParam->addParam("記憶する", "mypage_login_memory", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"));
117        $this->objFormParam->addParam("メールアドレス", "mypage_login_email", MTEXT_LEN, "a", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "EMAIL_CHECK", "NO_SPTAB" ,"EMAIL_CHAR_CHECK"));
118        $this->objFormParam->addParam("パスワード", "mypage_login_pass", MTEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
119    }
120}
121?>
Note: See TracBrowser for help on using the repository browser.