snowcake-website/ip-info/index.php

43 lines
1.3 KiB
PHP
Raw Normal View History

2022-11-20 02:02:26 +00:00
<!--Page design by Lilium_Snow (Primrose) (2022)-->
<!--This document is licensed under the Creative Commons Attribution-ShareAlike 4.0 International License. Get a copy of the license at https://creativecommons.org/licenses/by-sa/4.0/legalcode-->
2022-11-20 02:02:26 +00:00
<!DOCTYPE html>
<html lang="en-US">
<head>
<title>IP Info - Snowcake</title>
<link rel="icon" type="image/x-icon" href="/assets/images/favicon.png">
<link rel="stylesheet" href="/main_theme.css">
<meta charset="UTF-8">
</head>
<body>
<h1>IP Info</h1>
<div>
<a href="/" class="button">🏠 Back to Home</a>
</div>
<br>
<br>
<div class="content">
<?php
$client_ip = $_SERVER['REMOTE_ADDR'];
$client_hostname = gethostbyaddr($_SERVER['REMOTE_ADDR']);
$token = "your_token_here";
$request_url = file_get_contents("https://ipinfo.io/" . $client_ip . "/json/?token=" . $token);
$json = json_decode($request_url);
echo "<p>IP Address: $client_ip</p>";
2022-11-20 02:02:26 +00:00
echo "<p>Hostname: $client_hostname</p>";
echo "<p>ISP: " . $json->org, "</p>";
echo "<p>City: " . $json->city, "</p>";
echo "<p>Region: " . $json->region, "</p>";
echo "<p>Country: " . $json->country, "</p>";
echo "<p>Coordinates: " . $json->loc, "</p>";
echo "<p>Postal Code: " . $json->postal, "</p>";
echo "<p>Timezone: " . $json->timezone, "</p>";
2022-11-20 02:02:26 +00:00
?>
</div>
</body>
</html>