-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
51 lines (36 loc) · 1.16 KB
/
index.php
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
<?php
$url = 'https://www.google.com/';
$seconds = 5;
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Redirect Page</title>
</head>
<body>
<div id="timer"></div>
<script type="text/javascript">
var seconds = <?= $seconds ?>;
var seconds_ =<?= $seconds ?>;
function startTimer(display) {
setInterval(function () {
seconds--;
display.textContent = "";
display.innerHTML="You will redirect in " + seconds + " seconds <br>" +
"if this page doesn't forward you in " + seconds_ + " seconds, please <a href='<?= $url ?>'>click here</a> "
if (seconds <= 0){
window.location.href = "<?=$url ?>";
display.innerHTML="";
}
}, 1000);
}
window.onload = function () {
document.getElementById("timer").innerHTML = "You will redirect in " + seconds + " seconds <br>" +
"if this page doesn't forward you in " + seconds_ + " seconds, please <a href='<?= $url ?>'>click here</a> ";
display = document.querySelector('#timer');
startTimer(display);
};
</script>
</body>
</html>