Esempio n. 1
0
 /**
  * メールアドレス、パスワードを元に認証判定を行う
  *
  * @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();
 }
Esempio n. 2
0
 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);
 }
Esempio n. 3
0
 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');
 }