-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
127 lines (109 loc) · 2.88 KB
/
index.html
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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>Check Password Page</title>
<meta name="robots" content="noindex, nofollow">
<meta name="googlebot" content="noindex, nofollow">
<meta name="viewport" content="width=device-width, initial-scale=1">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<style type="text/css">
body {
background: #ffffff;
padding: 20px;
font-family: Helvetica;
}
#banner-message {
background: #fff;
border-radius: 4px;
padding: 20px;
font-size: 25px;
text-align: center;
transition: all 0.2s;
margin: 0 auto;
width: 300px;
}
button {
background: #0084ff;
border: none;
border-radius: 5px;
padding: 8px 14px;
font-size: 15px;
color: #fff;
}
#banner-message.alt {
background: #0084ff;
color: #fff;
margin-top: 40px;
width: 200px;
}
#banner-message.alt button {
background: #fff;
color: #000;
}
#output {
color:red;
}
/* EOS */
</style>
<script type="text/javascript">//<![CDATA[
$(document).ready(function() {
// handle click and add class
$("#checkButton").on("click", () => {
var myRootUrl = "";
var myFolderUrl = "password/";
var myEndUrlPrefix = ".htm";
var myPassword = $("#password").val();
var myUrl = myRootUrl + myFolderUrl + myPassword + myEndUrlPrefix;
if (myPassword != "") {
if (checkFileExist(myUrl))
window.location.href = myUrl;
else
$("#output").text("password is not correct");
} else {
$("#output").text("please enter the password");
}
});
function checkFileExist(url) {
var http = new XMLHttpRequest();
if (url.length === 0) {
return false;
} else {
http.open('HEAD', url, false);
http.send();
if (http.status === 200) {
return true;
} else {
return false;
}
}
}
function checkFileExist2(url) {
$.ajax({
url: myUrl,
type: 'HEAD',
error: function() {
return false;
},
success: function() {
return true;
}
});
}
});
//]]></script>
</head>
<body>
<div>
<p>Password Checking</p>
</div>
<div>
<form id="form1">
<input type="password" id="password"/>
<input type="button" id="checkButton" class="submit" value="Check Password" />
<span id="output" color="red"></p>
</form>
</div>
</body>
</html>