/** * メールアドレス、パスワードを元に認証判定を行う * * @param array $requests リクエストパラメータ * @return string sessionid セッションID */ function op_k_login($requests) { require_once 'OpenPNE/Auth.php'; // --- リクエスト変数 $c_member_id = $requests['c_member_id']; $address = $requests['address']; $password = $requests['password']; $sid = $requests['sid']; $is_ktai = $requests['is_ktai']; // ---------- // --- セッションIDが渡されてきた場合は一旦ログアウト if (!empty($sid)) { session_id($sid); session_start(); $_SESSION = array(); session_destroy(); } if ($is_ktai) { $sess_name = 'OpenPNEktai'; $ei_name = "ktai"; } else { $sess_name = 'PHPSESSID'; $ei_name = "common"; } $_POST['username'] = $address; $_POST['password'] = $password; @session_name($sess_name); @session_start(); @session_regenerate_id(); $config = get_auth_config($is_ktai); $config['options']['advancedsecurity'] = false; $auth = new OpenPNE_Auth($config); $auth->setExpire($GLOBALS['OpenPNE'][$ei_name]['session_lifetime']); $auth->setIdle($GLOBALS['OpenPNE'][$ei_name]['session_idletime']); $auth->logout(); if (LOGIN_CHECK_ENABLE) { include_once 'OpenPNE/LoginChecker.php'; $options = array('check_num' => LOGIN_CHECK_NUM, 'check_time' => LOGIN_CHECK_TIME, 'reject_time' => LOGIN_REJECT_TIME); $lc =& new OpenPNE_LoginChecker($options); if ($lc->is_rejected() || !$auth->login(false)) { $lc->fail_login(); return false; } } else { if (!$auth->login(false)) { return false; } } $_SESSION['c_member_id'] = $c_member_id; return session_id(); }
function execute($requests) { $this->_login_params = $requests['login_params']; $config = get_auth_config(); $auth = new OpenPNE_Auth($config); $this->_auth =& $auth; $auth->setExpire($GLOBALS['OpenPNE']['common']['session_lifetime']); $auth->setIdle($GLOBALS['OpenPNE']['common']['session_idletime']); // 現在のセッションを削除 $auth->logout(); if (LOGIN_CHECK_ENABLE) { include_once 'OpenPNE/LoginChecker.php'; $options = array('check_num' => LOGIN_CHECK_NUM, 'check_time' => LOGIN_CHECK_TIME, 'reject_time' => LOGIN_REJECT_TIME); $this->_lc =& new OpenPNE_LoginChecker($options); } if (!$auth->login($requests['is_save'])) { $this->_fail_login(); } if (LOGIN_CHECK_ENABLE && $this->_lc->is_rejected()) { $this->_fail_login(); } $c_member_id = db_member_c_member_id4username_encrypted($auth->getUsername(), false); if (OPENPNE_AUTH_MODE == 'slavepne' && !$c_member_id) { $c_member_id = db_member_create_member($_POST['username']); } if (!$c_member_id) { $this->_fail_login(); } if (OPENPNE_ONE_SESSION_PER_USER) { db_member_update_c_member_secure_insert_sess_id($c_member_id, session_id()); } if (db_member_is_login_rejected($c_member_id)) { $this->_fail_login('login_rejected'); } if (db_member_is_blacklist($c_member_id)) { $this->_fail_login('login_rejected'); } db_member_do_access($c_member_id); db_api_update_token($c_member_id); $url = OPENPNE_URL; if ($this->_login_params) { $url .= '?' . $this->_login_params; } client_redirect_absolute($url); }
function execute($requests) { $config['storage'] = 'DB'; $config['options'] = array('dsn' => db_get_dsn(), 'table' => 'c_admin_user', 'usernamecol' => 'username', 'passwordcol' => 'password', 'cryptType' => 'md5'); $auth = new OpenPNE_Auth($config); $auth->setExpire($GLOBALS['OpenPNE']['admin']['session_lifetime']); $auth->setIdle($GLOBALS['OpenPNE']['admin']['session_idletime']); $this->_auth =& $auth; // 現在のセッションを削除 $auth->logout(); if (!$auth->login($requests['is_save'])) { $this->_fail_login(); } if (OPENPNE_ONE_SESSION_PER_USER) { $uid = db_admin_c_admin_user_id4username($auth->getUsername()); db_admin_update_c_admin_user_insert_sess_id($uid, session_id()); } admin_client_redirect('top'); }
function execute($requests) { if (!($c_member_id = db_member_c_member_id4easy_access_id(OpenPNE_KtaiID::getID()))) { // 認証エラー $p = array('msg' => 14, 'kad' => t_encrypt($requests['ktai_address']), 'login_params' => $requests['login_params']); openpne_redirect('ktai', 'page_o_login', $p); } $c_member = db_member_c_member4c_member_id($c_member_id, true); @session_name('OpenPNEktai'); $config = get_auth_config(true); $auth = new OpenPNE_Auth($config); $auth->setExpire($GLOBALS['OpenPNE']['ktai']['session_lifetime']); $auth->setIdle($GLOBALS['OpenPNE']['ktai']['session_idletime']); $this->_auth =& $auth; if (LOGIN_CHECK_ENABLE) { // 不正ログインチェック include_once 'OpenPNE/LoginChecker.php'; $options = array('check_num' => LOGIN_CHECK_NUM, 'check_time' => LOGIN_CHECK_TIME, 'reject_time' => LOGIN_REJECT_TIME); $lc = new OpenPNE_LoginChecker($options); if ($lc->is_rejected()) { // 認証エラー $lc->fail_login(); $p = array('msg' => '0', 'login_params' => $requests['login_params']); openpne_redirect('ktai', 'page_o_login', $p); } } $auth->auth =& $auth->factory(true); $username = db_member_username4c_member_id($c_member_id, true); if (OPENPNE_AUTH_MODE == 'email') { $username = t_encrypt($username); } $auth->auth->setAuth($username); $auth->auth->setAuthData('OPENPNE_URL', OPENPNE_URL); $auth->auth->setAuthData('USER_AGENT', $_SERVER['HTTP_USER_AGENT']); if (OPENPNE_ONE_SESSION_PER_USER) { db_member_update_c_member_secure_insert_sess_id($c_member_id, session_id()); } if (db_member_is_login_rejected($c_member_id)) { ktai_display_error('ログインできませんでした。'); } if (db_member_is_blacklist($c_member_id)) { ktai_display_error('ログインできませんでした。'); } db_member_do_access($c_member_id); // ログイン後のリダイレクト先を決定する $a = ''; $m = 'ktai'; $p = array(); if ($requests['login_params']) { parse_str($requests['login_params'], $p); } if (!empty($p['a'])) { $a = $p['a']; } if (!empty($p['m'])) { $m = $p['m']; } if ($m == 'ktai' && $a == 'page_o_login') { $a = ''; } $_SESSION['c_member_id'] = $c_member_id; $p['ksid'] = session_id(); openpne_redirect($m, $a, $p); }
public function __construct($storageDriver = 'DB', $options = '') { parent::__construct($storageDriver, $options, false); }
function execute($requests) { // --- リクエスト変数 $c_member_id = $requests['c_member_id']; $ktai_address = $requests['ktai_address']; $password = $requests['password']; // ---------- @session_name('OpenPNEktai'); $config = get_auth_config(true); $auth = new OpenPNE_Auth($config); $auth->setExpire($GLOBALS['OpenPNE']['ktai']['session_lifetime']); $auth->setIdle($GLOBALS['OpenPNE']['ktai']['session_idletime']); $this->_auth =& $auth; if (LOGIN_CHECK_ENABLE) { // 不正ログインチェック include_once 'OpenPNE/LoginChecker.php'; $options = array('check_num' => LOGIN_CHECK_NUM, 'check_time' => LOGIN_CHECK_TIME, 'reject_time' => LOGIN_REJECT_TIME); $lc = new OpenPNE_LoginChecker($options); if ($lc->is_rejected() || !$auth->login()) { // 認証エラー $lc->fail_login(); $p = array('msg' => '0', 'kad' => t_encrypt($ktai_address), 'login_params' => $requests['login_params']); openpne_redirect('ktai', 'page_o_login', $p); } } else { if (!$auth->login()) { $p = array('msg' => '0', 'kad' => t_encrypt($ktai_address), 'login_params' => $requests['login_params']); openpne_redirect('ktai', 'page_o_login', $p); } } $c_member_id = db_member_c_member_id4username_encrypted($auth->getUsername(), true); if (OPENPNE_AUTH_MODE == 'slavepne' && !$c_member_id) { $c_member_id = db_member_create_member($_POST['username']); } if (!$c_member_id) { $p = array('msg' => '0', 'kad' => t_encrypt($ktai_address), 'login_params' => $requests['login_params']); openpne_redirect('ktai', 'page_o_login', $p); } if (OPENPNE_ONE_SESSION_PER_USER) { db_member_update_c_member_secure_insert_sess_id($c_member_id, session_id()); } if (db_member_is_login_rejected($c_member_id)) { ktai_display_error('ログインできませんでした。'); } if (db_member_is_blacklist($c_member_id)) { ktai_display_error('ログインできませんでした。'); } db_member_do_access($c_member_id); // ログイン後のリダイレクト先を決定する $a = ''; $m = 'ktai'; $p = array(); if ($requests['login_params']) { parse_str($requests['login_params'], $p); } if (!empty($p['a'])) { $a = $p['a']; } if (!empty($p['m'])) { $m = $p['m']; } if ($m == 'ktai' && $a == 'page_o_login') { $a = ''; } $_SESSION['c_member_id'] = $c_member_id; $p['ksid'] = session_id(); openpne_redirect($m, $a, $p); }