-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
99 lines (91 loc) · 2.77 KB
/
Copy pathindex.html
File metadata and controls
99 lines (91 loc) · 2.77 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Captcha Checker</title>
<style>
body {
font-family: Arial, sans-serif;
max-width: 400px;
margin: 50px auto;
text-align: center;
}
img {
margin: 20px 0;
max-width: 100%;
}
input {
padding: 8px;
font-size: 16px;
width: 100px;
text-align: center;
}
button {
padding: 8px 16px;
font-size: 16px;
margin-left: 10px;
cursor: pointer;
}
.result {
margin-top: 20px;
font-weight: bold;
font-size: 18px;
}
</style>
</head>
<body>
<h1>Captcha Checker</h1>
<div>
<img id="captchaImg" src="" alt="Captcha" />
</div>
<div>
<input type="text" id="answerInput" placeholder="Enter captcha" />
<button id="checkBtn">Check</button>
</div>
<div>
<button id="newCaptchaBtn">New Captcha</button>
</div>
<div class="result" id="result"></div>
<h2>wowcaptcha.netlify.app is a Text Captcha API Coded 100% on JavaScript. when using m8captcha.js.org/api/, you get the captcha code "correct" and the image "captcha".</h2>
<h2>use our API endpoint "wowcaptcha.netlify.app/api/" to implement the captcha in your codes. the API answers like: {"captcha":"data:image/png;base64,iVBORw0KGgoAAAA...","correct":"288"}</h2>
<script>
const captchaImg = document.getElementById('captchaImg');
const answerInput = document.getElementById('answerInput');
const checkBtn = document.getElementById('checkBtn');
const newCaptchaBtn = document.getElementById('newCaptchaBtn');
const resultDiv = document.getElementById('result');
let correctAnswer = '';
async function loadCaptcha() {
resultDiv.textContent = '';
answerInput.value = '';
try {
const response = await fetch('https://wowcaptcha.netlify.app/api/');
const data = await response.json();
captchaImg.src = data.captcha;
correctAnswer = data.correct;
} catch (error) {
resultDiv.textContent = 'Failed to load captcha. Try again.';
captchaImg.src = '';
}
}
checkBtn.addEventListener('click', () => {
const userAnswer = answerInput.value.trim();
if (!userAnswer) {
resultDiv.textContent = 'Please enter the captcha answer.';
return;
}
if (userAnswer === correctAnswer) {
resultDiv.style.color = 'green';
resultDiv.textContent = 'Correct! 🎉';
} else {
resultDiv.style.color = 'red';
resultDiv.textContent = 'Wrong answer, try again.';
}
});
newCaptchaBtn.addEventListener('click', loadCaptcha);
// Load captcha on page load
loadCaptcha();
</script>
</body>
</html>