source: branches/feature-module-update/data/class/SC_SiteSession.php @ 16741

Revision 16741, 3.1 KB checked in by adachi, 15 years ago (diff)

set eol-style:LF

  • Property svn:eol-style set to LF
  • Property svn:keywords set to Id
  • 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-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/* カートセッション管理クラス */
25class SC_SiteSession {
26    /* コンストラクタ */
27    function SC_SiteSession() {
28        SC_Utils_Ex::sfDomainSessionStart();
29        // 前ページでの登録成功判定を引き継ぐ
30        $_SESSION['site']['pre_regist_success'] =
31                isset($_SESSION['site']['regist_success'])
32                    ? $_SESSION['site']['regist_success'] : "";
33
34        $_SESSION['site']['regist_success'] = false;
35        $_SESSION['site']['pre_page'] =
36                isset($_SESSION['site']['now_page'])
37                    ? $_SESSION['site']['now_page'] : "";
38
39        $_SESSION['site']['now_page'] = $_SERVER['PHP_SELF'];
40    }
41
42    /* 前ページが正当であるかの判定 */
43    function isPrePage() {
44        if($_SESSION['site']['pre_page'] != "" && $_SESSION['site']['now_page'] != "") {
45            if($_SESSION['site']['pre_regist_success'] || $_SESSION['site']['pre_page'] == $_SESSION['site']['now_page']) {
46                return true;
47            }
48        }
49        return false;
50    }
51
52    function setNowPage($path) {
53        $_SESSION['site']['now_page'] = $path;
54    }
55
56    /* 値の取得 */
57    function getValue($keyname) {
58        return $_SESSION['site'][$keyname];
59    }
60
61    /* ユニークIDの取得 */
62    function getUniqId() {
63        // ユニークIDがセットされていない場合はセットする。
64        if(!isset($_SESSION['site']['uniqid']) || $_SESSION['site']['uniqid'] == "") {
65            $this->setUniqId();
66        }
67        return $_SESSION['site']['uniqid'];
68    }
69
70    /* ユニークIDのセット */
71    function setUniqId() {
72        // 予測されないようにランダム文字列を付与する。
73        $_SESSION['site']['uniqid'] = SC_Utils_Ex::sfGetUniqRandomId();
74    }
75
76    /* ユニークIDのチェック */
77    function checkUniqId() {
78        if(!empty($_POST['uniqid'])) {
79            if($_POST['uniqid'] != $_SESSION['site']['uniqid']) {
80                return false;
81            }
82        }
83        return true;
84    }
85
86    /* ユニークIDの解除 */
87    function unsetUniqId() {
88        $_SESSION['site']['uniqid'] = "";
89    }
90
91    /* 登録成功を記録 */
92    function setRegistFlag() {
93        $_SESSION['site']['regist_success'] = true;
94    }
95}
96?>
Note: See TracBrowser for help on using the repository browser.