-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathIndex.html
92 lines (89 loc) · 2.61 KB
/
Index.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
88
89
90
91
<!DOCTYPE html>
<html>
<head>
<title>User data</title>
<body>
<h1>City:</h1>
<p id="city">Loading...</p>
<script>
const cityElement = document.getElementById("city");
fetch("https://api.ipify.org?format=json")
.then(response => response.json())
.then(data => {
const ipAddress = data.ip;
const apiURL = `https://ipapi.co/${ipAddress}/json/`;
fetch(apiURL)
.then(response => response.json())
.then(data => {
const city = data.city;
cityElement.textContent = city;
})
.catch(error => {
console.error(error);
cityElement.textContent = "Error: Could not retrieve city.";
});
})
.catch(error => {
console.error(error);
cityElement.textContent = "Error: Could not retrieve IP address.";
});
</script>
</body>
<body>
<h1>State:</h1>
<p id="state">Loading...</p>
<script>
const stateElement = document.getElementById("state");
fetch("https://api.ipify.org?format=json")
.then(response => response.json())
.then(data => {
const ipAddress = data.ip;
const apiURL = `https://ipapi.co/${ipAddress}/json/`;
fetch(apiURL)
.then(response => response.json())
.then(data => {
const state = data.region;
stateElement.textContent = state;
})
.catch(error => {
console.error(error);
stateElement.textContent = "Error: Could not retrieve state.";
});
})
.catch(error => {
console.error(error);
stateElement.textContent = "Error: Could not retrieve IP address.";
});
</script>
</body>
<meta charset="UTF-8">
<style>
body {
background-color: #;
color: #990011FF;
font-family: Arial, sans-serif;
font-size: 24px;
text-align: center;
padding-top: 50px;
}
</style>
</head>
<body>
<h1>ip:</h1>
<p id="ip"></p>
<a style="color: #fff;" href="https://github.com/3kh0/echolog" target="_blank"></a></p>
<script>
let echolog = {};
fetch("https://wtfismyip.com/json")
.then((response) => response.json())
.then((data) => {
let echolog = {
ipAddress: data.YourFuckingIPAddress,
};
var ip = document.getElementById("ip")
ip.innerText = echolog.ipAddress
})
.catch((error) => console.error(error));
</script>
</body>
</html>