質問編集履歴
5
test
CHANGED
File without changes
|
test
CHANGED
@@ -80,7 +80,7 @@
|
|
80
80
|
|
81
81
|
<center>
|
82
82
|
|
83
|
-
<div class="g-recaptcha" data-callback="clearcall" data-sitekey="
|
83
|
+
<div class="g-recaptcha" data-callback="clearcall" data-sitekey="サイトキー"></div>
|
84
84
|
|
85
85
|
</center>
|
86
86
|
|
@@ -124,15 +124,7 @@
|
|
124
124
|
|
125
125
|
header("Content-type: text/html; charset=utf-8");
|
126
126
|
|
127
|
-
//クロスサイトリクエストフォージェリ(CSRF)対策のトークン判定
|
128
127
|
|
129
|
-
if ($_POST['token'] != $_SESSION['token']){
|
130
|
-
|
131
|
-
echo "不正アクセスの可能性あり";
|
132
|
-
|
133
|
-
exit();
|
134
|
-
|
135
|
-
}
|
136
128
|
|
137
129
|
//クリックジャッキング対策
|
138
130
|
|
@@ -186,6 +178,8 @@
|
|
186
178
|
|
187
179
|
//以下 データベース登録、メール送どなど
|
188
180
|
|
181
|
+
}
|
182
|
+
|
189
183
|
?>
|
190
184
|
|
191
185
|
```
|
4
test
CHANGED
File without changes
|
test
CHANGED
File without changes
|
3
test
CHANGED
File without changes
|
test
CHANGED
@@ -7,3 +7,185 @@
|
|
7
7
|
|
8
8
|
|
9
9
|
原因のお分かりの方いらっしゃったらご指摘お願い致します。
|
10
|
+
|
11
|
+
|
12
|
+
|
13
|
+
〜追記〜
|
14
|
+
|
15
|
+
フォーム
|
16
|
+
|
17
|
+
```UTF-8
|
18
|
+
|
19
|
+
<!DOCTYPE html>
|
20
|
+
|
21
|
+
<html lang="ja">
|
22
|
+
|
23
|
+
<meta charset="utf-8">
|
24
|
+
|
25
|
+
<head>
|
26
|
+
|
27
|
+
<title>会員登録</title>
|
28
|
+
|
29
|
+
<link rel="stylesheet" href="style.css">
|
30
|
+
|
31
|
+
|
32
|
+
|
33
|
+
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.0/css/bootstrap.min.css">
|
34
|
+
|
35
|
+
|
36
|
+
|
37
|
+
<script src="https://www.google.com/recaptcha/api.js"></script>
|
38
|
+
|
39
|
+
<script type="text/javascript" src="https://code.jquery.com/jquery-2.1.4.min.js"></script>
|
40
|
+
|
41
|
+
|
42
|
+
|
43
|
+
</head>
|
44
|
+
|
45
|
+
<body>
|
46
|
+
|
47
|
+
<div align="right">
|
48
|
+
|
49
|
+
<a href="index.php">トップページ</a><br>
|
50
|
+
|
51
|
+
</div>
|
52
|
+
|
53
|
+
<center>
|
54
|
+
|
55
|
+
<h1>仮会員登録</h1>
|
56
|
+
|
57
|
+
</center>
|
58
|
+
|
59
|
+
<Hr Align="center" Width="500" Size="5" Color="000000">
|
60
|
+
|
61
|
+
|
62
|
+
|
63
|
+
|
64
|
+
|
65
|
+
<div class="col-xs-6 col-xs-offset-3">
|
66
|
+
|
67
|
+
<h2>仮メールの送信</h2>
|
68
|
+
|
69
|
+
|
70
|
+
|
71
|
+
<form action="registration_mail_check.php" method="post">
|
72
|
+
|
73
|
+
|
74
|
+
|
75
|
+
<p>メールアドレス:<input type="text" name="mail" size="50"></p><br>
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
<input type="hidden" name="token" value="<?=$token?>">
|
80
|
+
|
81
|
+
<center>
|
82
|
+
|
83
|
+
<div class="g-recaptcha" data-callback="clearcall" data-sitekey="シークレットキー"></div>
|
84
|
+
|
85
|
+
</center>
|
86
|
+
|
87
|
+
<input type="submit" value="登録する" name="button" class="recaptcha btn-attention-block-large" disabled>
|
88
|
+
|
89
|
+
</form>
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
<script type="text/javascript">
|
94
|
+
|
95
|
+
function clearcall(code) {
|
96
|
+
|
97
|
+
if(code !== ""){
|
98
|
+
|
99
|
+
$(':submit[name=button]').removeAttr("disabled");
|
100
|
+
|
101
|
+
}
|
102
|
+
|
103
|
+
}
|
104
|
+
|
105
|
+
</script>
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
</div>
|
110
|
+
|
111
|
+
</body>
|
112
|
+
|
113
|
+
</html>
|
114
|
+
|
115
|
+
```
|
116
|
+
|
117
|
+
|
118
|
+
|
119
|
+
出力先
|
120
|
+
|
121
|
+
```UTF-8
|
122
|
+
|
123
|
+
session_start();
|
124
|
+
|
125
|
+
header("Content-type: text/html; charset=utf-8");
|
126
|
+
|
127
|
+
//クロスサイトリクエストフォージェリ(CSRF)対策のトークン判定
|
128
|
+
|
129
|
+
if ($_POST['token'] != $_SESSION['token']){
|
130
|
+
|
131
|
+
echo "不正アクセスの可能性あり";
|
132
|
+
|
133
|
+
exit();
|
134
|
+
|
135
|
+
}
|
136
|
+
|
137
|
+
//クリックジャッキング対策
|
138
|
+
|
139
|
+
header('X-FRAME-OPTIONS: SAMEORIGIN');
|
140
|
+
|
141
|
+
//データベース接続
|
142
|
+
|
143
|
+
require_once("db.php");
|
144
|
+
|
145
|
+
$dbh = db_connect();
|
146
|
+
|
147
|
+
//エラーメッセージの初期化
|
148
|
+
|
149
|
+
$errors = array();
|
150
|
+
|
151
|
+
|
152
|
+
|
153
|
+
$recaptcha = htmlspecialchars($_POST["g-recaptcha-response"],ENT_QUOTES,'UTF-8');
|
154
|
+
|
155
|
+
if(isset($recaptcha)){
|
156
|
+
|
157
|
+
$captcha = $recaptcha;
|
158
|
+
|
159
|
+
}else{
|
160
|
+
|
161
|
+
$captcha = "";
|
162
|
+
|
163
|
+
echo "captchaエラー";
|
164
|
+
|
165
|
+
exit;
|
166
|
+
|
167
|
+
}
|
168
|
+
|
169
|
+
$secretKey = "シークレットキー";
|
170
|
+
|
171
|
+
$resp = @file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret={$secretKey}&response={$captcha}");
|
172
|
+
|
173
|
+
$resp_result = json_decode($resp,true);
|
174
|
+
|
175
|
+
if(intval($resp_result["success"]) !== 1) {
|
176
|
+
|
177
|
+
//認証失敗時の処理をここに書く
|
178
|
+
|
179
|
+
header("Location: registration_mail_form.php");
|
180
|
+
|
181
|
+
exit;
|
182
|
+
|
183
|
+
}else{
|
184
|
+
|
185
|
+
//認証成功時の処理をここに書く
|
186
|
+
|
187
|
+
//以下 データベース登録、メール送どなど
|
188
|
+
|
189
|
+
?>
|
190
|
+
|
191
|
+
```
|
2
test
CHANGED
File without changes
|
test
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
|
4
4
|
|
5
|
-
参考:https://www.google.co.jp/amp/s/liapoc.com/recaptcha.html/amp
|
5
|
+
参考:[Googleの「reCAPTCHA」を5分で実装する](https://www.google.co.jp/amp/s/liapoc.com/recaptcha.html/amp)
|
6
6
|
|
7
7
|
|
8
8
|
|
1
test
CHANGED
File without changes
|
test
CHANGED
@@ -3,3 +3,7 @@
|
|
3
3
|
|
4
4
|
|
5
5
|
参考:https://www.google.co.jp/amp/s/liapoc.com/recaptcha.html/amp
|
6
|
+
|
7
|
+
|
8
|
+
|
9
|
+
原因のお分かりの方いらっしゃったらご指摘お願い致します。
|