質問編集履歴
1
ソースコードを改めました
test
CHANGED
File without changes
|
test
CHANGED
@@ -44,23 +44,29 @@
|
|
44
44
|
|
45
45
|
```php
|
46
46
|
|
47
|
+
<?php
|
48
|
+
|
49
|
+
session_start();
|
50
|
+
|
51
|
+
?>
|
52
|
+
|
47
53
|
<!DOCTYPE html>
|
48
54
|
|
49
55
|
<html lang="ja">
|
50
56
|
|
51
57
|
<head>
|
52
58
|
|
53
|
-
|
59
|
+
<meta charset="UTF-8">
|
54
|
-
|
60
|
+
|
55
|
-
|
61
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
56
|
-
|
62
|
+
|
57
|
-
|
63
|
+
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
58
|
-
|
64
|
+
|
59
|
-
|
65
|
+
<title>ひとこと掲示板</title>
|
60
|
-
|
61
|
-
|
62
|
-
|
66
|
+
|
67
|
+
|
68
|
+
|
63
|
-
|
69
|
+
<link rel="stylesheet" href="../style.css" />
|
64
70
|
|
65
71
|
</head>
|
66
72
|
|
@@ -78,193 +84,197 @@
|
|
78
84
|
|
79
85
|
<div id="content">
|
80
86
|
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
<
|
266
|
-
|
267
|
-
</
|
87
|
+
<?php
|
88
|
+
|
89
|
+
require('dbconnect.php');
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
//session_start();
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
if ($_COOKIE['email'] != '') {
|
98
|
+
|
99
|
+
$_POST['email'] = $_COOKIE['email'];
|
100
|
+
|
101
|
+
$_POST['password'] = $_COOKIE['password'];
|
102
|
+
|
103
|
+
$_POST['save'] = 'on';
|
104
|
+
|
105
|
+
}
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
if (!empty($_POST)) {
|
110
|
+
|
111
|
+
// ログインの処理
|
112
|
+
|
113
|
+
if ($_POST['email'] != '' && $_POST['password'] != '') {
|
114
|
+
|
115
|
+
$login = $db->prepare('SELECT * FROM members WHERE email=? AND password=?');
|
116
|
+
|
117
|
+
$login->execute(array(
|
118
|
+
|
119
|
+
$_POST['email'],
|
120
|
+
|
121
|
+
sha1($_POST['password'])
|
122
|
+
|
123
|
+
));
|
124
|
+
|
125
|
+
$member = $login->fetch();
|
126
|
+
|
127
|
+
|
128
|
+
|
129
|
+
if ($member) {
|
130
|
+
|
131
|
+
// ログイン成功
|
132
|
+
|
133
|
+
$_SESSION['id'] = $member['id'];
|
134
|
+
|
135
|
+
$_SESSION['time'] = time();
|
136
|
+
|
137
|
+
|
138
|
+
|
139
|
+
// ログイン情報を記録する
|
140
|
+
|
141
|
+
if ($_POST['save'] == 'on') {
|
142
|
+
|
143
|
+
setcookie('email', $_POST['email'], time()+60*60*24*14);
|
144
|
+
|
145
|
+
setcookie('password', $_POST['password'], time()+60*60*24*14);
|
146
|
+
|
147
|
+
}
|
148
|
+
|
149
|
+
|
150
|
+
|
151
|
+
header('Location: index.php'); exit();
|
152
|
+
|
153
|
+
} else {
|
154
|
+
|
155
|
+
$error['login'] = 'failed';
|
156
|
+
|
157
|
+
}
|
158
|
+
|
159
|
+
} else {
|
160
|
+
|
161
|
+
$error['login'] = 'blank';
|
162
|
+
|
163
|
+
}
|
164
|
+
|
165
|
+
}
|
166
|
+
|
167
|
+
?>
|
168
|
+
|
169
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
170
|
+
|
171
|
+
<html xmlns="http://www.w3.org/1999/xhtml">
|
172
|
+
|
173
|
+
<head>
|
174
|
+
|
175
|
+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
176
|
+
|
177
|
+
<link rel="stylesheet" type="text/css" href="../style.css" />
|
178
|
+
|
179
|
+
<link href="https://fonts.googleapis.com/css?family=Pacifico" rel="stylesheet">
|
180
|
+
|
181
|
+
<title>ログインする</title>
|
182
|
+
|
183
|
+
</head>
|
184
|
+
|
185
|
+
|
186
|
+
|
187
|
+
<body>
|
188
|
+
|
189
|
+
<div id="wrap">
|
190
|
+
|
191
|
+
<div id="head">
|
192
|
+
|
193
|
+
|
194
|
+
|
195
|
+
</div>
|
196
|
+
|
197
|
+
<div id="content">
|
198
|
+
|
199
|
+
<div id="lead">
|
200
|
+
|
201
|
+
<p>メールアドレスとパスワードを記入してログインしてください。</p>
|
202
|
+
|
203
|
+
<p>入会手続きがまだの方はこちらからどうぞ。</p>
|
204
|
+
|
205
|
+
<p>»<a href="join/">入会手続きをする</a></p>
|
206
|
+
|
207
|
+
</div>
|
208
|
+
|
209
|
+
<form action="" method="post">
|
210
|
+
|
211
|
+
<dl>
|
212
|
+
|
213
|
+
<dt>メールアドレス</dt>
|
214
|
+
|
215
|
+
<dd>
|
216
|
+
|
217
|
+
<input type="text" name="email" size="35" maxlength="255" value="<?php echo htmlspecialchars($_POST['email']); ?>" />
|
218
|
+
|
219
|
+
<?php if ($error['login'] == 'blank'): ?>
|
220
|
+
|
221
|
+
<p class="error">* メールアドレスとパスワードをご記入ください</p>
|
222
|
+
|
223
|
+
<?php endif; ?>
|
224
|
+
|
225
|
+
<?php if ($error['login'] == 'failed'): ?>
|
226
|
+
|
227
|
+
<p class="error">* ログインに失敗しました。正しくご記入ください。</p>
|
228
|
+
|
229
|
+
<?php endif; ?>
|
230
|
+
|
231
|
+
</dd>
|
232
|
+
|
233
|
+
<dt>パスワード</dt>
|
234
|
+
|
235
|
+
<dd>
|
236
|
+
|
237
|
+
<input type="password" name="password" size="35" maxlength="255" value="<?php echo htmlspecialchars($_POST['password']); ?>" />
|
238
|
+
|
239
|
+
</dd>
|
240
|
+
|
241
|
+
<dt>ログイン情報の記録</dt>
|
242
|
+
|
243
|
+
<dd>
|
244
|
+
|
245
|
+
<input id="save" type="checkbox" name="save" value="on">
|
246
|
+
|
247
|
+
<label for="save">次回からは自動的にログインする</label>
|
248
|
+
|
249
|
+
</dd>
|
250
|
+
|
251
|
+
</dl>
|
252
|
+
|
253
|
+
<div>
|
254
|
+
|
255
|
+
<input type="submit" value="ログインする" />
|
256
|
+
|
257
|
+
</div>
|
258
|
+
|
259
|
+
</form>
|
260
|
+
|
261
|
+
</div>
|
262
|
+
|
263
|
+
|
264
|
+
|
265
|
+
</div>
|
266
|
+
|
267
|
+
</div>
|
268
|
+
|
269
|
+
<div id="foot">
|
270
|
+
|
271
|
+
<p style="font-family: 'Pacifico', cursive; font-size:25px; text-align:center;">©2012-2018 Todaylesson Team BLACKBOARD <br>© H2O Space. MYCOM,</p>
|
272
|
+
|
273
|
+
</div>
|
274
|
+
|
275
|
+
</body>
|
276
|
+
|
277
|
+
</html>
|
268
278
|
|
269
279
|
</div>
|
270
280
|
|