Anladığım kadarı ile bu kod size yardımcı olacaktır.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Robot Doğrulama</title>
<style>
body {
display: flex;
align-items: center;
justify-content: center;
height: 100vh;
margin: 0;
}
#container {
text-align: center;
}
#result {
font-size: 24px;
margin-bottom: 10px;
}
#inputBox {
padding: 5px;
}
#devamEtButton {
background-color: #ff0000;
color: #fff;
padding: 10px 20px;
cursor: pointer;
}
/* Ana içerik stilleri */
.main-content {
display: none; /* Başlangıçta ana içerik gizli olacak */
text-align: center;
font-size: 24px;
margin-top: 50px;
}
</style>
</head>
<body>
<div id="container">
<div id="result">Üzerindeki sayı: <span id="randomNumber"></span></div>
<input type="text" id="inputBox" placeholder="Sayıyı girin">
<button id="devamEtButton" onclick="checkNumber()">Devam Et</button>
</div>
<div class="main-content">
<!-- Ana içerik burada olacak -->
<h1>Hoş Geldiniz!</h1>
<p>Site içeriği burada olacak...</p>
<p>Burada yönlendirileceksiniz. Kalan süre: <span id="redirectTimer">5</span> saniye.</p>
</div>
<script>
// Rastgele altı basamaklı sayılarla doldurulan 250 element
const elements = Array.from({ length: 250 }, () => Math.floor(100000 + Math.random() * 900000));
let currentIndex = Math.floor(Math.random() * elements.length);
const resultElement = document.getElementById('result');
const inputBox = document.getElementById('inputBox');
const randomNumberElement = document.getElementById('randomNumber');
const mainContent = document.querySelector('.main-content');
// Sayfa yüklendiğinde rastgele numarayı göster
window.onload = function() {
randomNumberElement.textContent = elements[currentIndex];
};
// Check function for number verification
function checkNumber() {
const userInput = parseInt(inputBox.value);
if (!isNaN(userInput) && userInput === elements[currentIndex]) {
currentIndex = Math.floor(Math.random() * elements.length);
updateResult();
allowAccess(); // Allow access to main content
} else {
alert('Yanlış numara! Sayfa yeniden başlatılıyor...');
location.reload();
}
}
// Update result box
function updateResult() {
randomNumberElement.textContent = elements[currentIndex];
}
// Function to allow access to the main content
function allowAccess() {
// Ana içeriği göster
mainContent.style.display = 'block';
// Doğrulama alanını gizle
document.getElementById('container').style.display = 'none';
}
// Sayfa yüklendiğinde rastgele numarayı göster
window.onload = function() {
randomNumberElement.textContent = elements[currentIndex];
redirectTimer(); // 5 saniyelik yönlendirme süresini başlat
};
// Diğer fonksiyonlar burada
// Fonksiyon: 5 saniyelik süre bitince yönlendirme
function redirectTimer() {
let seconds = 5;
const redirectInterval = setInterval(function() {
document.getElementById('redirectTimer').textContent = seconds;
seconds--;
if (seconds < 0) {
clearInterval(redirectInterval);
redirectToPage(); // Yönlendirme fonksiyonunu çağır
}
}, 1000);
}
// Fonksiyon: Yönlendirme
function redirectToPage() {
let count = 5; // Yönlendirme için geri sayım süresi
const redirectCountdown = setInterval(function() {
document.getElementById('redirectTimer').textContent = count;
count--;
if (count < 0) {
clearInterval(redirectCountdown);
window.location.href = 'https://www.yonlendirme-linki.com'; // Yönlendirme yapılacak link
}
}, 1000);
}
</script>
</body>
</html>