質問編集履歴
4
タイトル変更 ログイン後○秒
test
CHANGED
@@ -1 +1 @@
|
|
1
|
-
php ○秒後に自動ログアウトしたいがint_setを使用しているのに即ログアウトとなってしまう。
|
1
|
+
php ログイン後○秒後に自動ログアウトしたいがint_setを使用しているのに即ログアウトとなってしまう。
|
test
CHANGED
File without changes
|
3
タイトル追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -160,7 +160,7 @@
|
|
160
160
|
|
161
161
|
|
162
162
|
|
163
|
-
###login_output.php
|
163
|
+
###login_output.php(ログイン成功後list.phpへ飛ぶ)
|
164
164
|
|
165
165
|
```ここに言語を入力
|
166
166
|
|
2
ログアウト画面追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -96,14 +96,6 @@
|
|
96
96
|
|
97
97
|
|
98
98
|
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
99
|
<!------ ログインフォーム 2---------->
|
108
100
|
|
109
101
|
|
@@ -163,3 +155,81 @@
|
|
163
155
|
|
164
156
|
|
165
157
|
```
|
158
|
+
|
159
|
+
|
160
|
+
|
161
|
+
|
162
|
+
|
163
|
+
###login_output.php
|
164
|
+
|
165
|
+
```ここに言語を入力
|
166
|
+
|
167
|
+
<?php session_start();?>
|
168
|
+
|
169
|
+
<?php
|
170
|
+
|
171
|
+
|
172
|
+
|
173
|
+
unset($_SESSION["customer"]);
|
174
|
+
|
175
|
+
$pdo=new PDO("mysql:host=localhost;dbname=shop7;charset=utf8","staff","password");
|
176
|
+
|
177
|
+
|
178
|
+
|
179
|
+
$sql=$pdo->prepare("select*from customer where login=? and password=?");
|
180
|
+
|
181
|
+
|
182
|
+
|
183
|
+
|
184
|
+
|
185
|
+
|
186
|
+
|
187
|
+
|
188
|
+
|
189
|
+
|
190
|
+
|
191
|
+
foreach($sql->fetchAll() as $row){
|
192
|
+
|
193
|
+
|
194
|
+
|
195
|
+
$_SESSION["customer"]=[
|
196
|
+
|
197
|
+
|
198
|
+
|
199
|
+
"id"=>$row["id"],"name"=>$row["name"],
|
200
|
+
|
201
|
+
"address"=>$row["address"],"login"=>$row["login"],
|
202
|
+
|
203
|
+
"password"=>$row["password"] ];
|
204
|
+
|
205
|
+
}
|
206
|
+
|
207
|
+
|
208
|
+
|
209
|
+
if (isset($_SESSION["customer"])){
|
210
|
+
|
211
|
+
echo "いらっしゃいませ",$_SESSION["customer"] ["name"],"さん";
|
212
|
+
|
213
|
+
|
214
|
+
|
215
|
+
header('Location: list.php');
|
216
|
+
|
217
|
+
exit();
|
218
|
+
|
219
|
+
}
|
220
|
+
|
221
|
+
|
222
|
+
|
223
|
+
else{
|
224
|
+
|
225
|
+
echo "ログイン名またはパスワードが違います";
|
226
|
+
|
227
|
+
}
|
228
|
+
|
229
|
+
|
230
|
+
|
231
|
+
|
232
|
+
|
233
|
+
?>
|
234
|
+
|
235
|
+
```
|
1
login.phpの追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -71,3 +71,95 @@
|
|
71
71
|
?>
|
72
72
|
|
73
73
|
```
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
|
82
|
+
|
83
|
+
###login.php
|
84
|
+
|
85
|
+
```ここに言語を入力
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
<!-- ヘッダー 読み込み -->
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
<?php require"header.html"; ?>
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
<!------ ログインフォーム 2---------->
|
108
|
+
|
109
|
+
|
110
|
+
|
111
|
+
<div class="form-wrapper">
|
112
|
+
|
113
|
+
<h1>Sign In</h1>
|
114
|
+
|
115
|
+
<form action="login_output.php" method="post">
|
116
|
+
|
117
|
+
|
118
|
+
|
119
|
+
<div class="form-item">
|
120
|
+
|
121
|
+
<label for="email"></label>
|
122
|
+
|
123
|
+
<input type="text" name="login" required="required" placeholder="user name"></input>
|
124
|
+
|
125
|
+
</div>
|
126
|
+
|
127
|
+
|
128
|
+
|
129
|
+
<div class="form-item">
|
130
|
+
|
131
|
+
<label for="password"></label>
|
132
|
+
|
133
|
+
<input type="password" name="password" required="required" placeholder="password"></input>
|
134
|
+
|
135
|
+
</div>
|
136
|
+
|
137
|
+
<div class="button-panel">
|
138
|
+
|
139
|
+
<input type="submit" class="button" title="Sign In" value="Sign In"></input>
|
140
|
+
|
141
|
+
</div>
|
142
|
+
|
143
|
+
</form>
|
144
|
+
|
145
|
+
|
146
|
+
|
147
|
+
|
148
|
+
|
149
|
+
|
150
|
+
|
151
|
+
<div class="form-footer">
|
152
|
+
|
153
|
+
<p><a href="#">Create an account</a></p>
|
154
|
+
|
155
|
+
<p><a href="#">Forgot password?</a></p>
|
156
|
+
|
157
|
+
</div>
|
158
|
+
|
159
|
+
</div>
|
160
|
+
|
161
|
+
|
162
|
+
|
163
|
+
|
164
|
+
|
165
|
+
```
|