ここの情報は古いです。ご理解頂いた上でお取り扱いください。

source: OpenPNE/branches/takanashi/prj_takanashi3/webapp/modules/ktai/auth.inc @ 1068

Last change on this file since 1068 was 404, checked in by ogawa, 14 years ago

ログイン情報保存をQUERY_STRINGで書き直し

File size: 1.7 KB
Line 
1<?php
2/**
3 * @copyright 2005-2006 OpenPNE Project
4 * @license   http://www.php.net/license/3_01.txt PHP License 3.01
5 */
6
7if (empty($_REQUEST['ksid'])) {
8    __logout();
9}
10
11session_name('OpenPNEktai');
12session_id($_REQUEST['ksid']);
13session_start();
14
15if (OPENPNE_SESSION_CHECK_URL) {
16    if (@$_SESSION['OPENPNE_URL'] != OPENPNE_URL) {
17        __logout(15);
18    }
19}
20
21if (   empty($_SESSION['c_member_id'])
22    || !k_auth($_SESSION['c_member_id'])
23    || db_member_is_login_rejected($_SESSION['c_member_id'])) {
24    __logout(15);
25}
26
27// 携帯アドレスのチェック
28$c_member_id = _db_c_member_id4ktai_address_encrypted($_SESSION['ktai_address']);
29if ($c_member_id != $_SESSION['c_member_id']) {
30    __logout(15);
31}
32
33// セッションの有効期限
34$lifetime = $GLOBALS['OpenPNE']['ktai']['session_lifetime'];
35$idletime = $GLOBALS['OpenPNE']['ktai']['session_idletime'];
36if (!isset($_SESSION['timestamp']) ||
37    ($liftime && ($_SESSION['timestamp'] + $lifetime) < time())
38   ) {
39    __logout(15, $_SESSION['c_member_id']);
40}
41if (!isset($_SESSION['idle']) ||
42    ($idletime && ($_SESSION['idle'] + $idletime) < time())
43   ) {
44    __logout(15, $_SESSION['c_member_id']);
45}
46
47$_SESSION['idle'] = time();
48
49$GLOBALS['KTAI_C_MEMBER_ID'] = $_SESSION['c_member_id'];
50$GLOBALS['KTAI_URL_TAIL'] = "ksid=" . session_id();
51
52
53function __logout($msg = 0, $c_member_id = 0)
54{
55    @session_destroy();
56
57    if ($msg) {
58        $_REQUEST['msg'] = $msg;
59    }
60    if ($c_member_id) {
61        $c_member_secure = db_common_c_member_secure4c_member_id($c_member_id);
62        $_REQUEST['kad'] = t_encrypt($c_member_secure['ktai_address']);
63    }
64    $_REQUEST['login_params'] = $_SERVER['QUERY_STRING'];
65    openpne_forward('ktai', 'page', 'o_login');
66    exit;
67}
68
69?>
Note: See TracBrowser for help on using the repository browser.