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

source: OpenPNE/branches/work/ebihara/prj_id_login/webapp/modules/ktai/auth.inc @ 5565

Last change on this file since 5565 was 5565, checked in by ebihara, 12 years ago

#2021:IS_SLAVEPNE->OPENPNE_AUTH_MODE='slavepne'

File size: 2.5 KB
Line 
1<?php
2/**
3 * @copyright 2005-2008 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');
12require_once 'OpenPNE/Auth.php';
13
14$config = get_auth_config(true);
15$auth = new OpenPNE_Auth($config);
16$auth->setExpire($GLOBALS['OpenPNE']['ktai']['session_lifetime']);
17$auth->setIdle($GLOBALS['OpenPNE']['ktai']['session_idletime']);
18
19if (   !$auth->auth()
20    || !($u = db_member_c_member_id4username_encrypted($auth->getUsername(), true))
21    || db_member_is_login_rejected($u)) {
22    $auth->logout();
23   
24    __logout();
25}
26
27if (db_member_is_blacklist($u)) {
28    ktai_display_error('ログインできませんでした。');
29}
30
31$auth->uid($u);
32$GLOBALS['AUTH'] = $auth;
33
34$GLOBALS['KTAI_C_MEMBER_ID'] = $auth->uid();
35$GLOBALS['KTAI_URL_TAIL'] = "ksid=" . session_id();
36
37
38if (OPENPNE_AUTH_MODE == 'slavepne' && (empty($_SESSION['regist_step']) || !$_SESSION['regist_step'])) {
39    $check_param = db_member_check_param_inputed($u, true);
40    $_SESSION['regist_step'] = ($check_param == 0);
41    $current_page = $GLOBALS['__Framework']['current_type']."_".$GLOBALS['__Framework']['current_action'];
42   
43    //プロフィールが未登録の場合はリダイレクト
44    $prof_ext_page = array(
45        'page_h_regist_pre' => true,
46        'do_h_regist_prof' => true,
47        'page_h_regist_prof' => true,
48    );
49   
50    if (($check_param == 1) && !$prof_ext_page[$current_page]) {
51        openpne_redirect('ktai', 'page_h_regist_pre');
52    }
53   
54    //メールアドレスが未登録の場合はリダイレクト
55    $mail_ext_page = array(
56        'do_h_regist_address' => true,
57        'page_h_regist_address' => true,
58    );
59   
60    if (($check_param == 2) && !$mail_ext_page[$current_page]) {
61        openpne_redirect('ktai', 'page_h_regist_address');
62    }
63}
64
65function __logout($msg = 0, $c_member_id = 0)
66{
67    @session_destroy();
68
69    if ($msg) {
70        $_REQUEST['msg'] = $msg;
71    }
72    if ($c_member_id) {
73        $_REQUEST['kad'] = t_encrypt(db_member_username4c_member_id($c_member_id, true));
74    }
75    $_REQUEST['login_params'] = $_SERVER['QUERY_STRING'];
76    if ($_SERVER['REQUEST_METHOD'] == 'POST') {
77        $_POST = array('login_params' => $_SERVER['QUERY_STRING']);
78    } else {
79        $_GET = array('login_params' => $_SERVER['QUERY_STRING']);
80    }
81    if (LOGIN_URL_KTAI) {
82        client_redirect_absolute(LOGIN_URL_KTAI);
83    } else {
84        openpne_forward('ktai', 'page', 'o_login');
85    }
86    exit;
87}
88
89?>
Note: See TracBrowser for help on using the repository browser.