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

質問編集履歴

4

誤字編集

2020/02/08 14:56

投稿

Ms.yy
Ms.yy

スコア83

title CHANGED
File without changes
body CHANGED
@@ -93,7 +93,7 @@
93
93
  ~(省略)~
94
94
  $sql=$pdo->prepare('select * from customer where email=? and password=?');
95
95
 
96
- if(!preg_match("/[0-9]+/",$_REQUEshow ST["password"]) ){
96
+ if(!preg_match("/[0-9]+/",$_REQUEST["password"]) ){
97
97
  echo "条件通り入力してください";
98
98
  }
99
99
 

3

タグ追加

2020/02/08 14:56

投稿

Ms.yy
Ms.yy

スコア83

title CHANGED
File without changes
body CHANGED
File without changes

2

login.blade.php追加

2020/02/08 07:19

投稿

Ms.yy
Ms.yy

スコア83

title CHANGED
File without changes
body CHANGED
@@ -60,7 +60,31 @@
60
60
  ```
61
61
 
62
62
 
63
+ ###login.blade.php
64
+ ```
65
+ ~(省略)~
66
+ <form action="{{ url('/posts/login_output') }}" method="post">
63
67
 
68
+ {{ csrf_field() }}
69
+
70
+ <div class="form-item">
71
+ <label for="email"></label>
72
+ <input type="text" name="email" required="required" placeholder="メールアドレス"></input>
73
+ </div>
74
+
75
+ <div class="form-item">
76
+ <label for="password"></label>
77
+ <input type="password" name="password" required="required" placeholder="password"></input>
78
+ </div>
79
+ <div class="button-panel">
80
+ <input type="submit" class="button" title="Sign In" value="ログイン"></input>
81
+ </div>
82
+ </form>
83
+
84
+ ~(省略)~
85
+ ```
86
+
87
+
64
88
  ### 試したこと
65
89
 
66
90
  **$sql->execute([$_REQUEST['email'], $_REQUEST['password']] );**までは"ログイン成功しました。";と表示されていたので実行確認できています。

1

画像追加

2020/02/08 07:08

投稿

Ms.yy
Ms.yy

スコア83

title CHANGED
File without changes
body CHANGED
@@ -1,12 +1,12 @@
1
1
  ### 前提・実現したいこと
2
2
 
3
-
3
+ PHPのログイン機能に関してですが
4
4
  executeは実行され$_SESSIONに値が定義されているはずなのにeles判定になってしまうので、if判定に持っていきたいです。
5
5
  どなたかお力を貸して頂けましたら幸いです。
6
6
   
7
7
 
8
+ ![イメージ説明](a31ef680150e686b5bc83daee8618382.png)
8
9
 
9
-
10
10
  ### login_output.blade.php
11
11
 
12
12
  ```ここに言語名を入力
@@ -21,7 +21,7 @@
21
21
  $sql=$pdo->prepare('select * from customer where email=? and password=?');
22
22
 
23
23
 
24
- $sql->execute([$_REQUEST['email'], $_REQUEST['password']] );
24
+ $sql->execute([$_REQUEST['email'], $_REQUEST['password']] ); //ここまでは実行確認済み(試したこと)
25
25
 
26
26
  foreach($sql->fetchAll() as $row){
27
27