Пример #1
0
 /**
  * 認証を行う
  *
  * @access  public
  * @return  void
  */
 function authorize()
 {
     global $_conf, $_p2session;
     // 認証チェック
     if (!$this->authCheck()) {
         // ログイン失敗
         require_once P2_LIB_DIR . '/login_first.inc.php';
         printLoginFirst($this);
         exit;
     }
     // 以下、ログインOKなら
     // {{{ ログアウトの指定があれば
     if (!empty($_REQUEST['logout'])) {
         // セッションをクリア(アクティブ、非アクティブを問わず)
         Session::unSession();
         // 補助認証をクリア
         $this->clearCookieAuth();
         $mobile =& Net_UserAgent_Mobile::singleton();
         if (isset($_SERVER['HTTP_X_UP_SUBNO'])) {
             $this->removeRegistedAuthCarrier('EZWEB');
         } elseif ($mobile->isSoftBank()) {
             $this->removeRegistedAuthCarrier('SOFTBANK');
             /* docomoはログイン画面が表示されるので、補助認証情報を自動破棄しない
                } elseif ($mobile->isDoCoMo()) {
                    $this->removeRegistedAuthCarrier('DOCOMO');
                */
         }
         // $user_u_q = empty($_conf['ktai']) ? '' : '?user='******'/') . '/';
         // . $user_u_q;
         header('Location: ' . $url);
         exit;
     }
     // }}}
     // {{{ セッションが利用されているなら、セッション変数の更新
     if (isset($_p2session)) {
         // ユーザ名とパスXを更新
         $_SESSION['login_user'] = $this->user_u;
         $_SESSION['login_pass_x'] = $this->pass_x;
     }
     // }}}
     // 要求があれば、補助認証を登録
     $this->registCookie();
     $this->registKtaiId();
     // 認証後はセッションを閉じる
     session_write_close();
 }
Пример #2
0
 /**
  * 認証を行う
  */
 public function authorize()
 {
     global $_conf, $_p2session;
     // {{{ 認証チェック
     $auth_result = $this->_authCheck();
     if (!$auth_result) {
         // ログイン失敗
         if (!function_exists('printLoginFirst')) {
             include P2_LIB_DIR . '/login_first.inc.php';
         }
         printLoginFirst($this);
         exit;
     }
     // }}}
     // ■ログインOKなら
     // {{{ ログアウトの指定があれば
     if (!empty($_REQUEST['logout'])) {
         // セッションをクリア(アクティブ、非アクティブを問わず)
         Session::unSession();
         // 補助認証をクリア
         $this->clearCookieAuth();
         $url = rtrim(dirname(P2Util::getMyUrl()), '/') . '/';
         // . $user_u_q;
         header('Location: ' . $url);
         exit;
     }
     // }}}
     // {{{ セッションが利用されているなら、セッション変数の更新
     if (isset($_p2session)) {
         // ユーザ名とパスXを更新
         $_SESSION['login_user'] = $this->user_u;
         $_SESSION['login_pass_x'] = $this->pass_x;
         if (!array_key_exists('login_microtime', $_SESSION)) {
             $_SESSION['login_microtime'] = microtime();
         }
         // devicePixelRatio指定があれば保持
         if (!empty($_REQUEST['device_pixel_ratio'])) {
             $device_pixel_ratio = floatval($_REQUEST['device_pixel_ratio']);
             if ($device_pixel_ratio === 1.5 || $device_pixel_ratio === 2.0) {
                 $_SESSION['device_pixel_ratio'] = $device_pixel_ratio;
             }
         }
     }
     // }}}
     // {{{ 要求があれば、補助認証を登録
     $this->registerCookie();
     // }}}
     // セッションを認証以外に使わない場合は閉じる
     if (P2_SESSION_CLOSE_AFTER_AUTHENTICATION) {
         session_write_close();
     }
     // _authCheck() が文字列を返したときは、URLと見なしてリダイレクト
     if (is_string($auth_result)) {
         header('Location: ' . $auth_result);
         exit;
     }
     return true;
 }
Пример #3
0
 /**
  * 認証を行う
  */
 public function authorize()
 {
     global $_conf, $_p2session;
     // {{{ 認証チェック
     $auth_result = $this->_authCheck();
     if (!$auth_result) {
         // ログイン失敗
         if (!function_exists('printLoginFirst')) {
             include P2_LIB_DIR . '/login_first.inc.php';
         }
         printLoginFirst($this);
         exit;
     }
     // }}}
     // ■ログインOKなら
     // {{{ ログアウトの指定があれば
     if (!empty($_REQUEST['logout'])) {
         // セッションをクリア(アクティブ、非アクティブを問わず)
         Session::unSession();
         // 補助認証をクリア
         $this->clearCookieAuth();
         $mobile = Net_UserAgent_Mobile::singleton();
         if ($mobile->isEZweb()) {
             $this->_registAuthOff($_conf['auth_ez_file']);
         } elseif ($mobile->isSoftBank()) {
             $this->_registAuthOff($_conf['auth_jp_file']);
             /* docomoはログイン画面が表示されるので、補助認証情報を自動破棄しない
                } elseif ($mobile->isDoCoMo()) {
                    $this->_registAuthOff($_conf['auth_imodeid_file']);
                    $this->_registAuthOff($_conf['auth_docomo_file']);
                */
         }
         // $user_u_q = $_conf['ktai'] ? "?user={$this->user_u}" : '';
         $url = rtrim(dirname(P2Util::getMyUrl()), '/') . '/';
         // . $user_u_q;
         header('Location: ' . $url);
         exit;
     }
     // }}}
     // {{{ セッションが利用されているなら、セッション変数の更新
     if (isset($_p2session)) {
         // ユーザ名とパスXを更新
         $_SESSION['login_user'] = $this->user_u;
         $_SESSION['login_pass_x'] = $this->pass_x;
         if (!array_key_exists('login_microtime', $_SESSION)) {
             $_SESSION['login_microtime'] = microtime();
         }
     }
     // }}}
     // {{{ 要求があれば、補助認証を登録
     $this->registCookie();
     $this->registKtaiId();
     // }}}
     // セッションを認証以外に使わない場合は閉じる
     if (P2_SESSION_CLOSE_AFTER_AUTHENTICATION) {
         session_write_close();
     }
     // _authCheck() が文字列を返したときは、URLと見なしてリダイレクト
     if (is_string($auth_result)) {
         header('Location: ' . $auth_result);
         exit;
     }
     return true;
 }