-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpost.html
More file actions
212 lines (175 loc) · 5.72 KB
/
post.html
File metadata and controls
212 lines (175 loc) · 5.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,minimum-scale=1.0,user-scalable=no">
<meta charset="UTF-8">
<title>获得邀请码</title>
<!--------------------------------------------------------------------->
<!-- 这里导入两个文件 -->
<link href="anti-bot-verification/anti-bot-style.css" rel="stylesheet"/>
<script type="text/javascript" src="anti-bot-verification/anti-bot-js.js"></script>
<!--------------------------------------------------------------------->
</head>
<script>
let restrictTime = 30; // 限制访问的时长,以秒为单位
let restrictUrl = "post.html"; // 用户访问受限制的网址
function setCookie(name, value, expires, path, domain, secure) {
var cookieText = encodeURIComponent(name) + "=" + encodeURIComponent(value);
if (expires) {
cookieText += "; expires=" + expires.toUTCString();
}
if (path) {
cookieText += "; path=" + path;
}
if (domain) {
cookieText += "; domain=" + domain;
}
if (secure) {
cookieText += "; secure";
}
document.cookie = cookieText;
}
function getCookie(name) {
var cookieText = document.cookie;
var cookieArray = cookieText.split("; ");
for (var i = 0; i < cookieArray.length; i++) {
var cookie = cookieArray[i];
while (cookie.charAt(0) == " ") {
cookie = cookie.substring(1, cookie.length);
}
if (cookie.indexOf(name + "=") == 0) {
return decodeURIComponent(cookie.substring(name.length + 1));
}
}
return null;
}
function checkCookie(name) {
var cookie = getCookie(name);
if (cookie == null) {
return false;
} else {
return true;
}
}
function redirect() {
var time = new Date();
time.setTime(time.getTime() + restrictTime * 1000);
setCookie("restrict", time.toUTCString(), time, "/", null, false);
window.location.href = restrictUrl;
}
if (!checkCookie("restrict")) {
redirect();
} else {
alert("操作过快。");
}
<style>
#captcha {
cursor: pointer;
}
#captcha:hover {
opacity: 0.7;
}
body {
font-family: Arial, sans-serif;
background-color: #f0f0f0;
margin: 0;
padding: 0;
}
.container {
width: 300px;
padding: 16px;
background-color: white;
margin: 100px auto;
border: 1px solid black;
border-radius: 4px;
}
input[type=text], input[type=password] {
width: 100%;
margin: 8px 0;
padding: 12px 20px;
display: inline-block;
border: 1px solid #ccc;
box-sizing: border-box;
}
input[type=username], input[type=username] {
width: 100%;
margin: 8px 0;
padding: 12px 20px;
display: inline-block;
border: 1px solid #ccc;
box-sizing: border-box;
}
input[type=email], input[type=email] {
width: 100%;
margin: 8px 0;
padding: 12px 20px;
display: inline-block;
border: 1px solid #ccc;
box-sizing: border-box;
}
auto[id="anti_bot_frame"] {
width: 310px;
height: 240px;
position: absolute;
box-sizing: border-box;
top: 90%;
left: 45%;
margin-left: -100px;
right: ;
bottom: 0;
opacity: 0.8;
display: block;
margin: auto;
}
button {
background-color: #4CAF50;
color: white;
padding: 14px 20px;
margin: 8px 0;
border: none;
cursor: pointer;
width: 100%;
}
button:hover {
opacity: 0.8;
}
</style>
<body>
<form action="email.php" method="post">
<div class="container">
<h1>邀请码申请</h1>
<label for="username">用户名:</label>
<input type="text" id="username" name="username" required><br>
<label for="captcha">验证码<img src="verify.php" alt="验证码" id="captcha" onclick="refreshCaptcha(this)" />
<script>
function refreshCaptcha(imgElement) {
imgElement.src = 'verify.php?t=' + new Date().getTime(); // 重新加载验证码
}
</script>
<input type="text" id="captcha-input" name="captcha" required><br>
<label for="email">邮箱:</label>
<input type="email" id="email" name="email" required><br>
<auto id="anti_bot_frame" class="anti-bot-frame-large"></auto>
<button type="submit">注册</button>
<script>
</script>
<body>
<!--------------------------------------------------------------------->
<!--
千万不要放置两个图像验证在同一个页面上
如果你想要不同大小的图像验证界面,请把标签修改成:
<div id="anti_bot_frame" class="anti-bot-frame-verylarge">
<div id="anti_bot_frame" class="anti-bot-frame-large">
<div id="anti_bot_frame" class="anti-bot-frame-medium">
<div id="anti_bot_frame" class="anti-bot-frame-small">
<div id="anti_bot_frame" class="anti-bot-frame-verysmall">
如果你想要自定义大小的话,请务必把宽高比例设置为310:240。
-->
<!--------------------------------------------------------------------->
</body>
<!--------------------------------------------------------------------->
<!-- 在界面尾部,运行JS -->
<script>anti_bot_verification_ini("anti-bot-verification");</script>
<!-- 其参数 "anti-bot-verification" 是这个页面到后台目录的路径,必要时修改 -->
<!--------------------------------------------------------------------->
</html>