質問編集履歴

1

fdf

2016/07/20 07:09

投稿

isacRu
isacRu

スコア64

test CHANGED
File without changes
test CHANGED
@@ -3,3 +3,127 @@
3
3
 
4
4
 
5
5
  ちなみに実行結果はempty set(何もでない)でした。
6
+
7
+
8
+
9
+ [追記]
10
+
11
+ ```PHP
12
+
13
+ <!DOCTYPE html>
14
+
15
+ <html>
16
+
17
+ <head>
18
+
19
+ <title>ログイン画面</title>
20
+
21
+ <meta http-equiv="Content-Type" content="text/html; charset=utf8">
22
+
23
+ <link rel="stylesheet" type="text/css" href="css/app_style.css">
24
+
25
+ </head>
26
+
27
+ <body>
28
+
29
+ <div>
30
+
31
+ <h1>ログイン</h1><br>
32
+
33
+ <form method='POST'>
34
+
35
+ <input type="email" name="mail" placeholder="Email">
36
+
37
+ <input type="password" name="pass" placeholder="Password">
38
+
39
+ <br>
40
+
41
+ <input type="submit" name="login_user" value="ログイン">
42
+
43
+ </form>
44
+
45
+
46
+
47
+ <form method='POST' action='user_create.php'>
48
+
49
+ <input type="submit" name="new" value="新規">
50
+
51
+ </form>
52
+
53
+ <a href="reset_pass.php">パスワード忘れた場合</a>
54
+
55
+
56
+
57
+ <?php
58
+
59
+ require ('mysql_connect.php');
60
+
61
+
62
+
63
+ if (isset($_POST['login_user'])) {
64
+
65
+ $mail = $_REQUEST['mail'];
66
+
67
+ $pass = $_REQUEST['pass'];
68
+
69
+ $is_login = false;
70
+
71
+ if (!empty($mail) AND !empty($pass)) {
72
+
73
+ $sql_query = mysql_query("select * from users_info where mail='" . $mail . "' and password='" . $pass . "'");
74
+
75
+
76
+
77
+ if ($sql_query)) {
78
+
79
+ $is_login = true;
80
+
81
+ } else {
82
+
83
+ echo "<p align='left' style='color: red;'>メールまたはパスワードが間違っています。</p>";
84
+
85
+ }
86
+
87
+ } else {
88
+
89
+ if (empty($mail)) {
90
+
91
+ echo "<p align='left' style='color: red;'>メールが空です。</p>";
92
+
93
+ }
94
+
95
+ if (empty($pass)) {
96
+
97
+ echo "<p align='left' style='color: red;'>パスワードが空です。</p>";
98
+
99
+ }
100
+
101
+ }
102
+
103
+ if ($is_login == true) {
104
+
105
+ header("Location: ./top.php");
106
+
107
+ mysql_close($sql_connect);
108
+
109
+ exit;
110
+
111
+ }
112
+
113
+ }
114
+
115
+ ?>
116
+
117
+
118
+
119
+ </div>
120
+
121
+ </body>
122
+
123
+ </html>
124
+
125
+ ```
126
+
127
+
128
+
129
+ 上記の部分「if ($sql_query))」の条件式でいけるかなと思ったのですが、SQL文自体にエラーがなかったので、条件式が成立してしまっている状態です。