teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

3

コードの修正

2018/10/10 05:12

投稿

Company_
Company_

スコア16

title CHANGED
File without changes
body CHANGED
@@ -48,6 +48,7 @@
48
48
  を試してみたところログインできました
49
49
 
50
50
  ###変更後
51
+ ```ここに言語を入力
51
52
  <?php
52
53
 
53
54
  class Login_Authentication
@@ -69,4 +70,5 @@
69
70
  }
70
71
  }
71
72
 
72
- $Authentication = new Login_Authentication();
73
+ $Authentication = new Login_Authentication();
74
+ ```

2

コードの修正

2018/10/10 05:12

投稿

Company_
Company_

スコア16

title CHANGED
File without changes
body CHANGED
@@ -69,4 +69,4 @@
69
69
  }
70
70
  }
71
71
 
72
- $Authentication = new Login_Authentication;
72
+ $Authentication = new Login_Authentication();

1

コードの修正

2018/10/10 03:15

投稿

Company_
Company_

スコア16

title CHANGED
File without changes
body CHANGED
@@ -45,4 +45,28 @@
45
45
  クラスを使用せずに
46
46
  if (isset($_SESSION["NAME"]))
47
47
  {
48
- を試してみたところログインできました
48
+ を試してみたところログインできました
49
+
50
+ ###変更後
51
+ <?php
52
+
53
+ class Login_Authentication
54
+ {
55
+ private $session;
56
+
57
+ public function __construct()
58
+ {
59
+   session_start();
60
+    session_regenerate_id(true);
61
+ $this->session = $_SESSION["NAME"]
62
+ $login = $this->session;
63
+
64
+ if (empty($login)) {
65
+ $_SESSION["FAILURE"] = "ログインされていません";
66
+ header("Location: ログイン画面のURL");
67
+ exit();
68
+ }
69
+ }
70
+ }
71
+
72
+ $Authentication = new Login_Authentication;