中谷 友哉
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Make a copy
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Make a copy Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    fuelphp質問 === 初めまして。 今回はfuelphpでのログイン認証した際の無限ループの抜け出し方を質問です。 宿題を終わらせた後に、上記の質問者のようにauthメソッドを使いログイン認証コードを書いたのですが、無限ループにハマっています。 いろいろ試したのですが、解決がしませんでした。 webサービス部を見直したところ、lesson12に無限ループの説明があったので、basename関数を使ったのですが、反応しませんでした。 basename関数をfuelphpでどう書くのかわからなかったのでいろいろ調べて試したのですがうまくいきません。 phpドキュメントで調べたらbasenameはファイルシステム関数と表記されていたので、fuelphpのドキュメントでfileかな?っと思い調べたのですがうまくいきません。 何か、ヒントをいただけましたら幸いです。 よろしくお願いします。 検証したコードは長いため、下記のURLに添付しときます。 https://hackmd.io/lCswnNUEQLOWoSQs4IjVEA?both 参照URL https://www.php.net/manual/ja/function.basename.php http://fuelphp.jp/docs/1.9/classes/file/intro.html ## 変更なしのコード ### login.php **app/controller/login.php** ```php= <!-- login.php --> class Controller_Login extends Controller_Auth { //クラス定数の作成 const PASS_LENGTH_MIN = 6; const PASS_LENGTH_MAX = 20; public function action_index() { Log::debug('「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「'); Log::debug('「 ログインページ '); Log::debug('「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「'); // $this->before(); // $this->action_login(); $error = ''; $formData = ''; // Fieldestクラスは、formの生成やバリデーションをしてくれる // 実際の生成やバリデーション処理はFormクラスとValidationクラスが行っている $form = Fieldset::forge('loginform'); Log::debug('Fieldestクラス作成'); // addメソッドでformを生成、第一引数:name属性の値、第二引数:ラベルの文言、第三引数:色々な属性を配列形式で // add_ruleメソッドでバリデーションを設定(使えるルールはValidationクラスと全く同じ。Validationクラスを使っているので。) $form->add('username', 'ユーザー名', array('type' => 'text', 'placeholder' => 'ユーザー名')) ->add_rule('required') ->add_rule('min_length', 1) ->add_rule('max_length', 255); $form->add('email', 'Email', array('type' => 'email', 'placeholder' => 'Email')) ->add_rule('required') ->add_rule('valid_email') ->add_rule('min_length', 1) ->add_rule('max_length', 255); $form->add('password', 'Password', array('type' => 'password', 'placeholder' => 'パスワード')) ->add_rule('required') ->add_rule('min_length', self::PASS_LENGTH_MIN) ->add_rule('max_length', self::PASS_LENGTH_MAX); $form->add('submit', '', array('type' => 'submit', 'value' => 'ログイン')); Log::debug('Fieldestクラス作成完了'); // Input::method()でHTTPメソッドが返ってくるので、POSTかどうかを確認 if (Input::method() === 'POST') { Log::debug('POST送信があります。'); // バリデーションインスタンスを取得 $val = $form->validation(); Log::debug('バリデーションインスタンスを取得', var_dump($val)); if ($val->run()) { Log::debug('バリデーションインスタンス実行', var_dump($val)); $formData = $val->validated(); Log::debug('フォームデータ取得', var_dump($formData)); $auth = Auth::instance(); //Authインスタンス生成 Log::debug('Authインスタンス生成'); if ($auth->login($formData['username'], $formData['password'], $formData['email'])) { // メッセージ格納 Session::set_flash('sucMsg', 'ログインが完了しました!'); Log::debug('sucMsg', 'ログイン登録が完了しました!'); // リダイレクト Response::redirect('member/mypage'); Log::debug('member/mypage', 'にリダイレクト'); } else { // メッセージ格納 Session::set_flash('errMsg', 'ログインに失敗しました!時間を置いてお試し下さい!'); Log::debug('errMsg', 'ログインに失敗しました!時間を置いてお試し下さい!'); } } else { // エラー格納 $error = $val->error(); Log::debug($error); // メッセージ格納 Session::set_flash('errMsg', 'ログインに失敗しました!時間を置いてお試し下さい!'); Log::debug('errMsg', 'ログインに失敗しました!時間を置いてお試し下さい!'); } // フォームにPOSTされた値をセット $form->repopulate(); } //変数としてビューを割り当てる $view = View::forge('template/index'); $view->set('head', View::forge('template/head')); $view->set('header', View::forge('template/header')); $view->set('contents', View::forge('auth/login')); $view->set('footer', View::forge('template/footer')); $view->set_global('loginform', $form->build(''), false); $view->set_global('error', $error); // レンダリングした HTML をリクエストに返す return $view; } } ``` ### signup.php **app/controller/signup.php** ```php= class Controller_Signup extends Controller_Auth { //クラス定数の作成 const PASS_LENGTH_MIN = 6; const PASS_LENGTH_MAX = 20; public function action_index() { Log::debug('「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「'); Log::debug('「 ユーザー登録ページ '); Log::debug('「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「'); $error = ''; $formData = ''; // Fieldestクラスは、formの生成やバリデーションをしてくれる // 実際の生成やバリデーション処理はFormクラスとValidationクラスが行っている $form = Fieldset::forge('signupform'); Log::debug('Fieldestクラス作成'); // addメソッドでformを生成、第一引数:name属性の値、第二引数:ラベルの文言、第三引数:色々な属性を配列形式で // add_ruleメソッドでバリデーションを設定(使えるルールはValidationクラスと全く同じ。Validationクラスを使っているので。) $form->add('username', 'ユーザー名', array('type' => 'text', 'placeholder' => 'ユーザー名')) ->add_rule('required') ->add_rule('min_length', 1) ->add_rule('max_length', 255); $form->add('email', 'Email', array('type' => 'email', 'placeholder' => 'Email')) ->add_rule('required') ->add_rule('valid_email') ->add_rule('min_length', 1) ->add_rule('max_length', 255); $form->add('password', 'Password', array('type' => 'password', 'placeholder' => 'パスワード')) ->add_rule('required') ->add_rule('min_length', self::PASS_LENGTH_MIN) ->add_rule('max_length', self::PASS_LENGTH_MAX); $form->add('password_re', 'Password(再入力)', array('type' => 'password', 'placeholder' => 'パスワード(再入力)')) // match_fieldをつける場合は必ず他のadd_ruleの前につける ->add_rule('match_field', 'password') ->add_rule('required') ->add_rule('min_length', self::PASS_LENGTH_MIN) ->add_rule('max_length', self::PASS_LENGTH_MAX); $form->add('submit', '', array('type' => 'submit', 'value' => '登録')); Log::debug('Fieldestクラス作成完了'); // Input::method()でHTTPメソッドが返ってくるので、POSTかどうかを確認 if (Input::method() === 'POST') { Log::debug('POST送信があります。'); // バリデーションインスタンスを取得 $val = $form->validation(); Log::debug('バリデーションインスタンスを取得', var_dump($val)); if ($val->run()) { Log::debug('バリデーションインスタンス実行', var_dump($val)); $formData = $val->validated(); Log::debug('フォームデータ取得', var_dump($formData)); $auth = Auth::instance(); //Authインスタンス生成 Log::debug('Authインスタンス生成'); if ($auth->create_user($formData['username'], $formData['password'], $formData['email'])) { // メッセージ格納 Session::set_flash('sucMsg', 'ユーザー登録が完了しました!'); Log::debug('sucMsg', 'ユーザー登録が完了しました!'); // リダイレクト Log::debug('member/mypage', 'にリダイレクト'); Response::redirect('member/mypage'); } else { // メッセージ格納 Session::set_flash('errMsg', 'ユーザー登録に失敗しました!時間を置いてお試し下さい!'); Log::debug('errMsg', 'ユーザー登録に失敗しました!時間を置いてお試し下さい!'); } } else { // エラー格納 $error = $val->error(); Log::debug($error); // メッセージ格納 Session::set_flash('errMsg', 'ユーザー登録に失敗しました!時間を置いてお試し下さい!'); Log::debug('errMsg', 'ユーザー登録に失敗しました!時間を置いてお試し下さい!'); } // フォームにPOSTされた値をセット $form->repopulate(); } //変数としてビューを割り当てる $view = View::forge('template/index'); $view->set('head', View::forge('template/head')); $view->set('header', View::forge('template/header')); $view->set('contents', View::forge('auth/signup')); $view->set('footer', View::forge('template/footer')); $view->set_global('signupform', $form->build(''), false); $view->set_global('error', $error); // レンダリングした HTML をリクエストに返す return $view; } } ``` ### mypage.php **app/controller/member/mypage.php** ```php= class Controller_Member_Mypage extends Controller_Auth { public function action_index() { Log::debug('「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「'); Log::debug('「 マイページ and ログアウトページ '); Log::debug('「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「'); $btn = Form::submit('logout_btn', $value = 'ログアウト', array('style' => 'float:none', 'method' => 'POST')); Log::debug('submitクラス作成'); Log::debug('submitクラス作成完了'); if (Input::method() === 'POST') { $auth = Auth::instance(); $auth->logout(); Session::destroy(); // メッセージ格納 Log::debug('セッション削除'); Session::set_flash('sucMsg', 'ログアウトが完了しました!'); Log::debug('ログアウト完了'); // リダイレクト Response::redirect('login'); } //変数としてビューを割り当てる $view = View::forge('template/index'); $view->set('head', View::forge('template/head')); $view->set('header', View::forge('template/header')); $view->set('contents', View::forge('member/mypage')); $view->set('footer', View::forge('template/footer')); $view->set_global('logout_btn', $btn, false); // レンダリングした HTML をリクエストに返す return $view; } } ``` ## 試したパターン ### パターン1(無限ループ) **app/controller/auth.php** ```php= class Controller_Auth extends Controller { public function before() { parent::before(); if (!Auth::check()) { Log::debug('ログイン済みユーザーです。'); Log::debug('マイページに遷移します'); Response::redirect('member/mypage'); } else { Log::debug('未ログインユーザーです。'); Log::debug('ログインページに遷移します'); Response::redirect('login'); } } } ``` ```php= <!-- ログ --> WARNING - 2019-12-07 23:30:50 --> Fuel\Core\Fuel::init - The configured locale ja_JP.utf8 is not installed on your system. INFO - 2019-12-07 23:30:50 --> Fuel\Core\Request::__construct - Creating a new main Request with URI = "member/mypage" INFO - 2019-12-07 23:30:50 --> Fuel\Core\Request::execute - Called INFO - 2019-12-07 23:30:50 --> Fuel\Core\Request::execute - Setting main Request DEBUG - 2019-12-07 23:30:50 --> ログイン済みユーザーです。 DEBUG - 2019-12-07 23:30:50 --> マイページに遷移します ....永遠 ``` http://localhost:8888/fuelphp_base_webukatu03-1/public/member/mypage マイページに遷移されてることはわかった ![Uploading file..._7gzafujzq]()   ### パターン2(無限ループ) * 変更点:auth.php ```php= class Controller_Auth extends Controller { public function before() { parent::before(); if (!Auth::check()) { Log::debug('未ログインユーザーです。'); Log::debug('ログインページに遷移します'); Response::redirect('login'); } else { Log::debug('ログイン済みユーザーです。'); Log::debug('マイページに遷移します'); Response::redirect('member/mypage'); } } } ``` ```php= <!-- ログ --> WARNING - 2019-12-07 23:37:48 --> Fuel\Core\Fuel::init - The configured locale ja_JP.utf8 is not installed on your system. INFO - 2019-12-07 23:37:48 --> Fuel\Core\Request::__construct - Creating a new main Request with URI = "member/mypage" INFO - 2019-12-07 23:37:48 --> Fuel\Core\Request::execute - Called INFO - 2019-12-07 23:37:48 --> Fuel\Core\Request::execute - Setting main Request DEBUG - 2019-12-07 23:37:48 --> 未ログインユーザーです。 DEBUG - 2019-12-07 23:37:48 --> ログインページに遷移します ...永遠 ``` http://localhost:8888/fuelphp_base_webukatu03-1/public/login ログインページに遷移されてることはわかった ### パターン3 * 変更点:auth.php ```php= class Controller_Auth extends Controller { public function before() { parent::before(); if (!Auth::check() && Request::active()->action != 'login') { Log::debug('未ログインユーザーです。'); Log::debug('ログインページに遷移します'); Response::redirect('login'); } } } ``` ```php= WARNING - 2019-12-08 00:10:16 --> Fuel\Core\Fuel::init - The configured locale ja_JP.utf8 is not installed on your system. INFO - 2019-12-08 00:10:16 --> Fuel\Core\Request::__construct - Creating a new main Request with URI = "login" INFO - 2019-12-08 00:10:16 --> Fuel\Core\Request::execute - Called INFO - 2019-12-08 00:10:16 --> Fuel\Core\Request::execute - Setting main Request DEBUG - 2019-12-08 00:10:16 --> 未ログインユーザーです。 DEBUG - 2019-12-08 00:10:16 --> ログインページに遷移します ``` ### パターン4 * 変更点:auth.php * basename追加 ```php= <!-- auth.php --> class Controller_Auth extends Controller { public function before() { parent::before(); if (!Auth::check()) { Log::debug('未ログインユーザーです。'); if (basename($_SERVER['PHP_SELF']) === Uri::create('login')) { Log::debug('ログインページに遷移します'); Response::redirect('login'); } } else { Log::debug('ログイン済みユーザーです。'); if (basename($_SERVER['PHP_SELF']) === Uri::create('member/mypage')) { Log::debug('マイページに遷移します'); Response::redirect('member/mypage'); } } } ``` **login** ```php= <!-- ログ --> WARNING - 2019-12-07 23:06:14 --> Fuel\Core\Fuel::init - The configured locale ja_JP.utf8 is not installed on your system. INFO - 2019-12-07 23:06:14 --> Fuel\Core\Request::__construct - Creating a new main Request with URI = "login" INFO - 2019-12-07 23:06:14 --> Fuel\Core\Request::execute - Called INFO - 2019-12-07 23:06:14 --> Fuel\Core\Request::execute - Setting main Request DEBUG - 2019-12-07 23:06:14 --> 未ログインユーザーです。 DEBUG - 2019-12-07 23:06:14 --> 「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「 DEBUG - 2019-12-07 23:06:14 --> 「 ログインページ  DEBUG - 2019-12-07 23:06:14 --> 「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「 DEBUG - 2019-12-07 23:06:14 --> Fieldestクラス作成 DEBUG - 2019-12-07 23:06:14 --> Fieldestクラス作成完了 ``` **signup** ```php= <!-- ログ --> WARNING - 2019-12-07 23:07:45 --> Fuel\Core\Fuel::init - The configured locale ja_JP.utf8 is not installed on your system. INFO - 2019-12-07 23:07:45 --> Fuel\Core\Request::__construct - Creating a new main Request with URI = "signup" INFO - 2019-12-07 23:07:45 --> Fuel\Core\Request::execute - Called INFO - 2019-12-07 23:07:45 --> Fuel\Core\Request::execute - Setting main Request DEBUG - 2019-12-07 23:07:45 --> 未ログインユーザーです。 DEBUG - 2019-12-07 23:07:45 --> 「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「 DEBUG - 2019-12-07 23:07:45 --> 「 ユーザー登録ページ  DEBUG - 2019-12-07 23:07:45 --> 「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「 DEBUG - 2019-12-07 23:07:45 --> Fieldestクラス作成 DEBUG - 2019-12-07 23:07:45 --> Fieldestクラス作成完了 ``` **mypage** ```php= <!-- ログ --> WARNING - 2019-12-07 23:13:12 --> Fuel\Core\Fuel::init - The configured locale ja_JP.utf8 is not installed on your system. INFO - 2019-12-07 23:13:12 --> Fuel\Core\Request::__construct - Creating a new main Request with URI = "member/mypage" INFO - 2019-12-07 23:13:12 --> Fuel\Core\Request::execute - Called INFO - 2019-12-07 23:13:12 --> Fuel\Core\Request::execute - Setting main Request DEBUG - 2019-12-07 23:13:12 --> 未ログインユーザーです。 DEBUG - 2019-12-07 23:13:12 --> 「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「 DEBUG - 2019-12-07 23:13:12 --> 「 マイページ and ログアウトページ  DEBUG - 2019-12-07 23:13:12 --> 「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「 DEBUG - 2019-12-07 23:13:12 --> submitクラス作成 DEBUG - 2019-12-07 23:13:12 --> submitクラス作成完了 ``` #### ユーザー登録完了 ```php= WARNING - 2019-12-07 23:14:48 --> Fuel\Core\Fuel::init - The configured locale ja_JP.utf8 is not installed on your system. INFO - 2019-12-07 23:14:48 --> Fuel\Core\Request::__construct - Creating a new main Request with URI = "signup" INFO - 2019-12-07 23:14:48 --> Fuel\Core\Request::execute - Called INFO - 2019-12-07 23:14:48 --> Fuel\Core\Request::execute - Setting main Request DEBUG - 2019-12-07 23:14:48 --> 未ログインユーザーです。 DEBUG - 2019-12-07 23:14:48 --> 「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「 DEBUG - 2019-12-07 23:14:48 --> 「 ユーザー登録ページ  DEBUG - 2019-12-07 23:14:48 --> 「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「 DEBUG - 2019-12-07 23:14:48 --> Fieldestクラス作成 DEBUG - 2019-12-07 23:14:48 --> Fieldestクラス作成完了 WARNING - 2019-12-07 23:15:44 --> Fuel\Core\Fuel::init - The configured locale ja_JP.utf8 is not installed on your system. INFO - 2019-12-07 23:15:44 --> Fuel\Core\Request::__construct - Creating a new main Request with URI = "signup" INFO - 2019-12-07 23:15:44 --> Fuel\Core\Request::execute - Called INFO - 2019-12-07 23:15:44 --> Fuel\Core\Request::execute - Setting main Request DEBUG - 2019-12-07 23:15:44 --> 未ログインユーザーです。 DEBUG - 2019-12-07 23:15:44 --> 「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「 DEBUG - 2019-12-07 23:15:44 --> 「 ユーザー登録ページ  DEBUG - 2019-12-07 23:15:44 --> 「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「 DEBUG - 2019-12-07 23:15:44 --> Fieldestクラス作成 DEBUG - 2019-12-07 23:15:44 --> Fieldestクラス作成完了 DEBUG - 2019-12-07 23:15:44 --> POST送信があります。 DEBUG - 2019-12-07 23:15:44 --> バリデーションインスタンスを取得 DEBUG - 2019-12-07 23:15:44 --> バリデーションインスタンス実行 DEBUG - 2019-12-07 23:15:44 --> フォームデータ取得 DEBUG - 2019-12-07 23:15:44 --> Authインスタンス生成 DEBUG - 2019-12-07 23:15:44 --> ユーザー登録が完了しました! - sucMsg DEBUG - 2019-12-07 23:15:44 --> にリダイレクト - member/mypage WARNING - 2019-12-07 23:15:45 --> Fuel\Core\Fuel::init - The configured locale ja_JP.utf8 is not installed on your system. INFO - 2019-12-07 23:15:45 --> Fuel\Core\Request::__construct - Creating a new main Request with URI = "member/mypage" INFO - 2019-12-07 23:15:45 --> Fuel\Core\Request::execute - Called INFO - 2019-12-07 23:15:45 --> Fuel\Core\Request::execute - Setting main Request DEBUG - 2019-12-07 23:15:45 --> 未ログインユーザーです。 DEBUG - 2019-12-07 23:15:45 --> 「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「 DEBUG - 2019-12-07 23:15:45 --> 「 マイページ and ログアウトページ  DEBUG - 2019-12-07 23:15:45 --> 「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「 DEBUG - 2019-12-07 23:15:45 --> submitクラス作成 DEBUG - 2019-12-07 23:15:45 --> submitクラス作成完了 ``` #### ユーザー登録完了後 login.phpに移動 ```php= <!-- ログ --> WARNING - 2019-12-07 23:21:35 --> Fuel\Core\Fuel::init - The configured locale ja_JP.utf8 is not installed on your system. INFO - 2019-12-07 23:21:35 --> Fuel\Core\Request::__construct - Creating a new main Request with URI = "login" INFO - 2019-12-07 23:21:35 --> Fuel\Core\Request::execute - Called INFO - 2019-12-07 23:21:35 --> Fuel\Core\Request::execute - Setting main Request DEBUG - 2019-12-07 23:21:35 --> 未ログインユーザーです。 DEBUG - 2019-12-07 23:21:35 --> 「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「 DEBUG - 2019-12-07 23:21:35 --> 「 ログインページ  DEBUG - 2019-12-07 23:21:35 --> 「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「 DEBUG - 2019-12-07 23:21:35 --> Fieldestクラス作成 DEBUG - 2019-12-07 23:21:35 --> Fieldestクラス作成完了 ``` sign.phpに移動 ```php= <!-- ログ --> WARNING - 2019-12-07 23:22:14 --> Fuel\Core\Fuel::init - The configured locale ja_JP.utf8 is not installed on your system. INFO - 2019-12-07 23:22:14 --> Fuel\Core\Request::__construct - Creating a new main Request with URI = "signup" INFO - 2019-12-07 23:22:14 --> Fuel\Core\Request::execute - Called INFO - 2019-12-07 23:22:14 --> Fuel\Core\Request::execute - Setting main Request DEBUG - 2019-12-07 23:22:14 --> 未ログインユーザーです。 DEBUG - 2019-12-07 23:22:14 --> 「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「 DEBUG - 2019-12-07 23:22:14 --> 「 ユーザー登録ページ  DEBUG - 2019-12-07 23:22:14 --> 「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「 DEBUG - 2019-12-07 23:22:14 --> Fieldestクラス作成 DEBUG - 2019-12-07 23:22:14 --> Fieldestクラス作成完了 ``` ユーザー登録前と変わらず ### パターン5 * 変更点:auth.php ```php= <!-- auth.php --> class Controller_Auth extends Controller { public function before() { if (!Auth::check()) { Log::debug('ログイン済みユーザーです。'); if (basename($_SERVER['PHP_SELF']) === Uri::create('member/mypage')) { Log::debug('マイページに遷移します'); Response::redirect('member/mypage'); } } else { Log::debug('未ログインユーザーです。'); if (basename($_SERVER['PHP_SELF']) === Uri::create('login')) { Log::debug('ログインページに遷移します'); Response::redirect('login'); } } } } ``` ```php= <!-- ログ --> WARNING - 2019-12-07 23:26:50 --> Fuel\Core\Fuel::init - The configured locale ja_JP.utf8 is not installed on your system. INFO - 2019-12-07 23:26:50 --> Fuel\Core\Request::__construct - Creating a new main Request with URI = "login" INFO - 2019-12-07 23:26:50 --> Fuel\Core\Request::execute - Called INFO - 2019-12-07 23:26:50 --> Fuel\Core\Request::execute - Setting main Request DEBUG - 2019-12-07 23:26:51 --> ログイン済みユーザーです。 DEBUG - 2019-12-07 23:26:51 --> 「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「 DEBUG - 2019-12-07 23:26:51 --> 「 ログインページ  DEBUG - 2019-12-07 23:26:51 --> 「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「 DEBUG - 2019-12-07 23:26:51 --> Fieldestクラス作成 DEBUG - 2019-12-07 23:26:51 --> Fieldestクラス作成完了 WARNING - 2019-12-07 23:27:12 --> Fuel\Core\Fuel::init - The configured locale ja_JP.utf8 is not installed on your system. INFO - 2019-12-07 23:27:12 --> Fuel\Core\Request::__construct - Creating a new main Request with URI = "signup" INFO - 2019-12-07 23:27:12 --> Fuel\Core\Request::execute - Called INFO - 2019-12-07 23:27:12 --> Fuel\Core\Request::execute - Setting main Request DEBUG - 2019-12-07 23:27:12 --> ログイン済みユーザーです。 DEBUG - 2019-12-07 23:27:12 --> 「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「 DEBUG - 2019-12-07 23:27:12 --> 「 ユーザー登録ページ  DEBUG - 2019-12-07 23:27:12 --> 「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「 DEBUG - 2019-12-07 23:27:12 --> Fieldestクラス作成 DEBUG - 2019-12-07 23:27:12 --> Fieldestクラス作成完了 WARNING - 2019-12-07 23:27:22 --> Fuel\Core\Fuel::init - The configured locale ja_JP.utf8 is not installed on your system. INFO - 2019-12-07 23:27:22 --> Fuel\Core\Request::__construct - Creating a new main Request with URI = "member/mypage" INFO - 2019-12-07 23:27:22 --> Fuel\Core\Request::execute - Called INFO - 2019-12-07 23:27:22 --> Fuel\Core\Request::execute - Setting main Request DEBUG - 2019-12-07 23:27:22 --> ログイン済みユーザーです。 DEBUG - 2019-12-07 23:27:22 --> 「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「 DEBUG - 2019-12-07 23:27:22 --> 「 マイページ and ログアウトページ  DEBUG - 2019-12-07 23:27:22 --> 「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「「 DEBUG - 2019-12-07 23:27:22 --> submitクラス作成 DEBUG - 2019-12-07 23:27:22 --> submitクラス作成完了 ``` ## 検証してわかったこと auth.phpの中のif (!Auth::check())は最初の中身は反応するが無限ループになる。 basename関数使うが、反応なし。

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully