質問編集履歴
4
タイトル変更 ログイン後○秒
title
CHANGED
@@ -1,1 +1,1 @@
|
|
1
|
-
php ○秒後に自動ログアウトしたいがint_setを使用しているのに即ログアウトとなってしまう。
|
1
|
+
php ログイン後○秒後に自動ログアウトしたいがint_setを使用しているのに即ログアウトとなってしまう。
|
body
CHANGED
File without changes
|
3
タイトル追記
title
CHANGED
File without changes
|
body
CHANGED
@@ -79,7 +79,7 @@
|
|
79
79
|
```
|
80
80
|
|
81
81
|
|
82
|
-
###login_output.php
|
82
|
+
###login_output.php(ログイン成功後list.phpへ飛ぶ)
|
83
83
|
```ここに言語を入力
|
84
84
|
<?php session_start();?>
|
85
85
|
<?php
|
2
ログアウト画面追記
title
CHANGED
File without changes
|
body
CHANGED
@@ -47,10 +47,6 @@
|
|
47
47
|
<?php require"header.html"; ?>
|
48
48
|
|
49
49
|
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
50
|
<!------ ログインフォーム 2---------->
|
55
51
|
|
56
52
|
<div class="form-wrapper">
|
@@ -80,4 +76,43 @@
|
|
80
76
|
</div>
|
81
77
|
|
82
78
|
|
79
|
+
```
|
80
|
+
|
81
|
+
|
82
|
+
###login_output.php
|
83
|
+
```ここに言語を入力
|
84
|
+
<?php session_start();?>
|
85
|
+
<?php
|
86
|
+
|
87
|
+
unset($_SESSION["customer"]);
|
88
|
+
$pdo=new PDO("mysql:host=localhost;dbname=shop7;charset=utf8","staff","password");
|
89
|
+
|
90
|
+
$sql=$pdo->prepare("select*from customer where login=? and password=?");
|
91
|
+
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
|
96
|
+
foreach($sql->fetchAll() as $row){
|
97
|
+
|
98
|
+
$_SESSION["customer"]=[
|
99
|
+
|
100
|
+
"id"=>$row["id"],"name"=>$row["name"],
|
101
|
+
"address"=>$row["address"],"login"=>$row["login"],
|
102
|
+
"password"=>$row["password"] ];
|
103
|
+
}
|
104
|
+
|
105
|
+
if (isset($_SESSION["customer"])){
|
106
|
+
echo "いらっしゃいませ",$_SESSION["customer"] ["name"],"さん";
|
107
|
+
|
108
|
+
header('Location: list.php');
|
109
|
+
exit();
|
110
|
+
}
|
111
|
+
|
112
|
+
else{
|
113
|
+
echo "ログイン名またはパスワードが違います";
|
114
|
+
}
|
115
|
+
|
116
|
+
|
117
|
+
?>
|
83
118
|
```
|
1
login.phpの追加
title
CHANGED
File without changes
|
body
CHANGED
@@ -34,4 +34,50 @@
|
|
34
34
|
exit();
|
35
35
|
}
|
36
36
|
?>
|
37
|
+
```
|
38
|
+
|
39
|
+
|
40
|
+
|
41
|
+
|
42
|
+
###login.php
|
43
|
+
```ここに言語を入力
|
44
|
+
|
45
|
+
<!-- ヘッダー 読み込み -->
|
46
|
+
|
47
|
+
<?php require"header.html"; ?>
|
48
|
+
|
49
|
+
|
50
|
+
|
51
|
+
|
52
|
+
|
53
|
+
|
54
|
+
<!------ ログインフォーム 2---------->
|
55
|
+
|
56
|
+
<div class="form-wrapper">
|
57
|
+
<h1>Sign In</h1>
|
58
|
+
<form action="login_output.php" method="post">
|
59
|
+
|
60
|
+
<div class="form-item">
|
61
|
+
<label for="email"></label>
|
62
|
+
<input type="text" name="login" required="required" placeholder="user name"></input>
|
63
|
+
</div>
|
64
|
+
|
65
|
+
<div class="form-item">
|
66
|
+
<label for="password"></label>
|
67
|
+
<input type="password" name="password" required="required" placeholder="password"></input>
|
68
|
+
</div>
|
69
|
+
<div class="button-panel">
|
70
|
+
<input type="submit" class="button" title="Sign In" value="Sign In"></input>
|
71
|
+
</div>
|
72
|
+
</form>
|
73
|
+
|
74
|
+
|
75
|
+
|
76
|
+
<div class="form-footer">
|
77
|
+
<p><a href="#">Create an account</a></p>
|
78
|
+
<p><a href="#">Forgot password?</a></p>
|
79
|
+
</div>
|
80
|
+
</div>
|
81
|
+
|
82
|
+
|
37
83
|
```
|