Repository navigation
Expand file tree
/
Copy pathindex.html
More file actions
314 lines (289 loc) · 18.1 KB
/
Copy pathindex.html
File metadata and controls
314 lines (289 loc) · 18.1 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
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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="shortcut icon" href="logo.svg" type="image/x-icon">
<title>Coderbrowser</title>
<link rel="stylesheet" href="style.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha3/dist/css/bootstrap.min.css">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha3/dist/js/bootstrap.bundle.min.js"></script>
<link href="https://cdn.jsdelivr.net/npm/mdbootstrap@4.19.2/dist/css/mdb.min.css" rel="stylesheet">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0/dist/css/bootstrap.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/2.11.6/umd/popper.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/mdbootstrap@4.19.2/dist/js/mdb.min.js"></script>
<script src=" https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-LWJTB6V8YM');
</script>
<script>
const http = require('http');
const url = require('url');
const { parse } = require('querystring');
// Daftar IP yang diblokir
const blockedIPs = ['192.168.1.100', '203.0.113.42'];
// Variabel untuk menyimpan jumlah permintaan dari setiap IP
let requestCounts = {};
const requestLimit = 100; // Batas permintaan per menit
const windowTime = 60000; // 1 menit dalam milidetik
const server = http.createServer((req, res) => {
const parsedUrl = url.parse(req.url, true);
const path = parsedUrl.pathname;
const ip = req.connection.remoteAddress;
const currentTime = Date.now();
// Memeriksa apakah IP termasuk dalam daftar yang diblokir
if (blockedIPs.includes(ip)) {
res.writeHead(403, { 'Content-Type': 'text/plain' });
res.end('Anda telah diblokir.');
return;
}
// Rate limiting untuk setiap permintaan
if (!requestCounts[ip]) {
requestCounts[ip] = [];
}
// Filter permintaan yang lebih lama dari windowTime
requestCounts[ip] = requestCounts[ip].filter(timestamp => currentTime - timestamp < windowTime);
// Memeriksa apakah jumlah permintaan melebihi batas
if (requestCounts[ip].length >= requestLimit) {
res.writeHead(429, { 'Content-Type': 'text/plain' });
res.end('Terlalu banyak permintaan, coba lagi nanti.');
return;
}
// Tambahkan waktu permintaan saat ini ke array
requestCounts[ip].push(currentTime);
// Menangani permintaan POST ke '/submit'
if (req.method === 'POST' && path === '/submit') {
let body = '';
req.on('data', chunk => {
body += chunk.toString();
});
req.on('end', () => {
const postData = parse(body);
// Validasi input
if (!postData.name || postData.name.length > 100) {
res.writeHead(400, { 'Content-Type': 'application/json' });
res.end(JSON.stringify({ message: 'Input tidak valid.' }));
return;
}
res.writeHead(200, { 'Content-Type': 'application/json' });
res.end(JSON.stringify({ message: 'Data berhasil diterima.' }));
});
} else if (path === '/') {
// Jika permintaan bukan POST ke '/submit', kirim respons 'Halo, Dunia!'
res.writeHead(200, { 'Content-Type': 'text/plain' });
res.end('Halo, Dunia!');
} else {
// Jika path tidak dikenal, kirim respons 'Halaman tidak ditemukan'
res.writeHead(404, { 'Content-Type': 'text/plain' });
res.end('Halaman tidak ditemukan.');
}
});
server.listen(3000, () => {
console.log('Server berjalan di port 3000');
});
</script>
</head>
<body>
<div class="info">
<div class="time">
</div>
<div class="day">
</div>
</div>
<div class="main">
<img src="logo.svg" alt="">
<div class="search">
<div class="input-group">
<span class="input-group-text btn-group" id="addon-wrapping">
<button id="type" class="btn btn-secondary dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false" style="background-color: transparent; border: none; margin:0; color: gray; padding: 1px;">
<svg id="myImage" xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-search" viewBox="0 0 16 16">
<path d="M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z"/>
</svg>
</button>
<ul class="dropdown-menu">
<li class="dropdown-item" onclick="search()"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-search" viewBox="0 0 16 16">
<path d="M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z"/>
</svg> Pencarian</li>
<li class="dropdown-item" onclick="kalku()"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-calculator" viewBox="0 0 16 16">
<path d="M12 1a1 1 0 0 1 1 1v12a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1h8zM4 0a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2H4z"/>
<path d="M4 2.5a.5.5 0 0 1 .5-.5h7a.5.5 0 0 1 .5.5v2a.5.5 0 0 1-.5.5h-7a.5.5 0 0 1-.5-.5v-2zm0 4a.5.5 0 0 1 .5-.5h1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-1a.5.5 0 0 1-.5-.5v-1zm0 3a.5.5 0 0 1 .5-.5h1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-1a.5.5 0 0 1-.5-.5v-1zm0 3a.5.5 0 0 1 .5-.5h1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-1a.5.5 0 0 1-.5-.5v-1zm3-6a.5.5 0 0 1 .5-.5h1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-1a.5.5 0 0 1-.5-.5v-1zm0 3a.5.5 0 0 1 .5-.5h1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-1a.5.5 0 0 1-.5-.5v-1zm0 3a.5.5 0 0 1 .5-.5h1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-1a.5.5 0 0 1-.5-.5v-1zm3-6a.5.5 0 0 1 .5-.5h1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-1a.5.5 0 0 1-.5-.5v-1zm0 3a.5.5 0 0 1 .5-.5h1a.5.5 0 0 1 .5.5v4a.5.5 0 0 1-.5.5h-1a.5.5 0 0 1-.5-.5v-4z"/>
</svg> Kalkulator</li>
<li class="dropdown-item" onclick="crypto()"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-currency-bitcoin" viewBox="0 0 16 16">
<path d="M5.5 13v1.25c0 .138.112.25.25.25h1a.25.25 0 0 0 .25-.25V13h.5v1.25c0 .138.112.25.25.25h1a.25.25 0 0 0 .25-.25V13h.084c1.992 0 3.416-1.033 3.416-2.82 0-1.502-1.007-2.323-2.186-2.44v-.088c.97-.242 1.683-.974 1.683-2.19C11.997 3.93 10.847 3 9.092 3H9V1.75a.25.25 0 0 0-.25-.25h-1a.25.25 0 0 0-.25.25V3h-.573V1.75a.25.25 0 0 0-.25-.25H5.75a.25.25 0 0 0-.25.25V3l-1.998.011a.25.25 0 0 0-.25.25v.989c0 .137.11.25.248.25l.755-.005a.75.75 0 0 1 .745.75v5.505a.75.75 0 0 1-.75.75l-.748.011a.25.25 0 0 0-.25.25v1c0 .138.112.25.25.25L5.5 13zm1.427-8.513h1.719c.906 0 1.438.498 1.438 1.312 0 .871-.575 1.362-1.877 1.362h-1.28V4.487zm0 4.051h1.84c1.137 0 1.756.58 1.756 1.524 0 .953-.626 1.45-2.158 1.45H6.927V8.539z"/>
</svg> Kripto</li>
</ul>
</span>
<div class="form-control" style="display: none;" id="crypto"><p style="margin:0;">Bitcoin= <span id="bitcoinPrice"></span> $</p><p style="margin:0;">Ethereum= <span id="ethereumPrice"></span> $</p>
</div>
<input type="text" class="form-control" placeholder="Cari di sini" id="input">
<input type="text" class="form-control" placeholder="Masukkan angka" id="kalku" style="display:none;">
<span class="input-group-text" id="addon-wrapping">
<button type="button" class="btn-close" aria-label="Close" onclick="hapusInput()" id="close"></button>
<p id="output" style="display:none; margin: 0; text-align: center;">0</p>
<p id="currency" style="display: flex; margin: 0; flex-direction: column;">
</p>
</span>
</div>
</div>
<div class="comp">
<p id="os"></p>
<p id="ip"></p>
</div>
</div>
</div>
<script>
var time = document.querySelector('.time');
var day = document.querySelector('.day');
function updateClock() {
var now = new Date();
var hours = now.getHours();
var minutes = now.getMinutes();
var seconds = now.getSeconds();
var day2 = now.getDate();
var year = now.getFullYear();
var month = now.getMonth()+1;
hours = hours % 12 || 12;
minutes = minutes < 10 ? '0' + minutes : minutes;
var period = hours < 12 ? 'PM' : 'AM';
time.innerHTML = hours + ':' + minutes + ':' + seconds + ' ' + period;
day.innerHTML = day2 + '/' + month + '/' + year;
}
updateClock();
setInterval(updateClock, 1000);
let query = document.getElementById('input');
window.addEventListener('keydown', checkKeyPress, false)
function crypto() {
var image = document.getElementById("myImage");
image.innerHTML = '<path d="M5.5 13v1.25c0 .138.112.25.25.25h1a.25.25 0 0 0 .25-.25V13h.5v1.25c0 .138.112.25.25.25h1a.25.25 0 0 0 .25-.25V13h.084c1.992 0 3.416-1.033 3.416-2.82 0-1.502-1.007-2.323-2.186-2.44v-.088c.97-.242 1.683-.974 1.683-2.19C11.997 3.93 10.847 3 9.092 3H9V1.75a.25.25 0 0 0-.25-.25h-1a.25.25 0 0 0-.25.25V3h-.573V1.75a.25.25 0 0 0-.25-.25H5.75a.25.25 0 0 0-.25.25V3l-1.998.011a.25.25 0 0 0-.25.25v.989c0 .137.11.25.248.25l.755-.005a.75.75 0 0 1 .745.75v5.505a.75.75 0 0 1-.75.75l-.748.011a.25.25 0 0 0-.25.25v1c0 .138.112.25.25.25L5.5 13zm1.427-8.513h1.719c.906 0 1.438.498 1.438 1.312 0 .871-.575 1.362-1.877 1.362h-1.28V4.487zm0 4.051h1.84c1.137 0 1.756.58 1.756 1.524 0 .953-.626 1.45-2.158 1.45H6.927V8.539z"/>';
image.classList.add("bi", "bi-calculator");
var input = document.getElementById("input");
var kalku = document.getElementById("kalku");
var button = document.getElementById("close");
var output = document.getElementById("output");
var crypto = document.getElementById("crypto");
var search = document.getElementsByClassName('search');
var browserWidth = window.innerWidth;
input.value = "";
input.style.display = "none";
kalku.style.display = "none";
button.style.display = "none";
output.style.display = "none";
crypto.style.display = "block";
for (var i = 0; i < search.length; i++) {
search[i].style.width = '300px';
}
if (browserWidth < 310) {
for (var i = 0; i < search.length; i++) {
search[i].style.width = '98%';
}
}
$.ajax({
url: 'https://api.coingecko.com/api/v3/simple/price?ids=bitcoin%2Cethereum&vs_currencies=usd',
dataType: 'json',
success: function(data) {
document.getElementById("bitcoinPrice").innerHTML = data.bitcoin.usd;
document.getElementById("ethereumPrice").innerHTML = data.ethereum.usd;
}
});
}
function kalku() {
var image = document.getElementById("myImage");
image.innerHTML = '<path d="M12 1a1 1 0 0 1 1 1v12a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1h8zM4 0a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2H4z"/> <path d="M4 2.5a.5.5 0 0 1 .5-.5h7a.5.5 0 0 1 .5.5v2a.5.5 0 0 1-.5.5h-7a.5.5 0 0 1-.5-.5v-2zm0 4a.5.5 0 0 1 .5-.5h1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-1a.5.5 0 0 1-.5-.5v-1zm0 3a.5.5 0 0 1 .5-.5h1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-1a.5.5 0 0 1-.5-.5v-1zm0 3a.5.5 0 0 1 .5-.5h1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-1a.5.5 0 0 1-.5-.5v-1zm3-6a.5.5 0 0 1 .5-.5h1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-1a.5.5 0 0 1-.5-.5v-1zm0 3a.5.5 0 0 1 .5-.5h1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-1a.5.5 0 0 1-.5-.5v-1zm0 3a.5.5 0 0 1 .5-.5h1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-1a.5.5 0 0 1-.5-.5v-1zm3-6a.5.5 0 0 1 .5-.5h1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-1a.5.5 0 0 1-.5-.5v-1zm0 3a.5.5 0 0 1 .5-.5h1a.5.5 0 0 1 .5.5v4a.5.5 0 0 1-.5.5h-1a.5.5 0 0 1-.5-.5v-4z"/>';
image.classList.add("bi", "bi-calculator");
var input = document.getElementById("input");
var kalku = document.getElementById("kalku");
var button = document.getElementById("close");
var output = document.getElementById("output");
var crypto = document.getElementById("crypto");
var search = document.getElementsByClassName('search');
var browserWidth = window.innerWidth;
input.value = "";
input.style.display = "none";
kalku.style.display = "block";
button.style.display = "none";
output.style.display = "block";
crypto.style.display = "none";
if (browserWidth > 1024) {
for (var i = 0; i < search.length; i++) {
search[i].style.width = '60%';
}
}
else{
for (var i = 0; i < search.length; i++) {
search[i].style.width = '95%';
}
}
}
function search() {
var image = document.getElementById("myImage");
image.innerHTML = '<path d="M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z"/>';
image.classList.remove("bi", "bi-calculator");
image.classList.add("bi", "bi-search");
var input = document.getElementById("input");
var kalku = document.getElementById("kalku");
var button = document.getElementById("close");
var output = document.getElementById("output");
var crypto = document.getElementById("crypto");
var search = document.getElementsByClassName('search');
var browserWidth = window.innerWidth;
kalku.value = "";
input.style.display = "block";
kalku.style.display = "none";
button.style.display = "block";
output.style.display = "none";
crypto.style.display = "none";
if (browserWidth > 1024) {
for (var i = 0; i < search.length; i++) {
search[i].style.width = '60%';
}
}
else{
for (var i = 0; i < search.length; i++) {
search[i].style.width = '95%';
}
}
}
function checkKeyPress(key){
if (key.keyCode == '13'){
if (document.getElementById("input").value !== ""){
let url = 'https://duckduckgo.com/?va=&t=h&q='+query.value;
window.open(url,'_self');
}
if (document.getElementById("input").value === ""){
var kalku = document.getElementById("kalku").value;
var output = document.getElementById("output");
if(kalku !== ""){
hasil = eval(kalku);
}
else{
hasil = 0;
}
output.innerHTML = hasil;
}
}
}
function hapusInput() {
document.getElementById("input").value = "";
}
$.getJSON("https://api.ipify.org?format=json", function(data) {
document.getElementById("ip").innerHTML = data.ip;
})
var OSName = "Unknown OS ";
if (window.navigator.userAgent.indexOf("Windows NT 10.0")!= -1) OSName="Windows ";
if (window.navigator.userAgent.indexOf("Windows NT 6.2") != -1) OSName="Windows ";
if (window.navigator.userAgent.indexOf("Windows NT 6.1") != -1) OSName="Windows ";
if (window.navigator.userAgent.indexOf("Windows NT 6.0") != -1) OSName="Windows ";
if (window.navigator.userAgent.indexOf("Windows NT 5.1") != -1) OSName="Windows ";
if (window.navigator.userAgent.indexOf("Windows NT 5.0") != -1) OSName="Windows ";
if (window.navigator.userAgent.indexOf("Mac") != -1) OSName="Mac/iOS ";
if (window.navigator.userAgent.indexOf("X11") != -1) OSName="UNIX ";
if (window.navigator.userAgent.indexOf("Linux") != -1) OSName="Linux ";
document.getElementById("os").innerHTML = OSName;
</script>
</body>
</html>