-
Notifications
You must be signed in to change notification settings - Fork 13
/
a.html
87 lines (79 loc) · 2.62 KB
/
a.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Admins</title>
<!-- Add Bootstrap CSS link -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
<style>
body {
background-color: #f8f9fa;
}
.container {
margin-top: 20px;
}
th, td {
background-color: #007bff;
color: #ffffff;
}
#main {
margin-top: 20px;
text-align: center;
}
</style>
</head>
<script>
function fetchData() {
fetch("https://sheetdb.io/api/v1/o3nxu9n6otryl")
.then(function(response) {
if (!response.ok) {
throw new Error("Network response was not ok");
}
return response.json();
})
.then(function(datas) {
let thedata = document.querySelector("#data");
let out = "";
for (let i = 0; i < datas.length; i++) {
let data = datas[i];
out += `<tr><td>${i + 1}</td><td>${data.username}</td><td>${data.time}</td></tr>`;
}
thedata.innerHTML = out;
})
.catch(function(error) {
console.error('Error during fetch:', error);
document.getElementById("main").innerHTML = "<h3>Sorry, the server is down</h3>";
});
}
// Fetch data initially
fetchData();
// Set up auto-update every 60 seconds (adjust as needed)
setInterval(fetchData, 6000000);
</script>
<body>
<div class="container">
<h2 class="text-center text-primary">Only for Admins</h2>
<p class="text-center">Login Details</p>
<div class="table-responsive">
<table class="table table-bordered">
<thead>
<tr>
<th>S.no</th>
<th>Username</th>
<th>Time</th>
</tr>
</thead>
<tbody id="data">
<!-- Data will be dynamically inserted here -->
</tbody>
</table>
</div>
<div id="main" class="text-center"></div>
</div>
<!-- Add Bootstrap JS and Popper.js -->
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script>
</body>
</html>