myip.coffee/index.php
Kumi dc49da70d3
feat: migrate index.html to PHP for dynamic IP endpoints
Migrated index.html to index.php to enable dynamic generation of IPv4 and IPv6 endpoints based on the server's domain. This change facilitates the embedding of IP address information via iframe elements, enhancing flexibility and ensuring that the correct IP endpoints are utilized.
2024-09-18 10:00:03 +02:00

68 lines
No EOL
2.7 KiB
PHP

<?php
$domain = $_SERVER['HTTP_HOST'];
$domain = preg_replace('/^www\./', '', $domain);
$ipv4_endpoint = "https://ipv4." . $domain;
$ipv6_endpoint = "https://ipv6." . $domain;
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Welcome to MyIP.Coffee</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<header>
<div class="container">
<h1>MyIP.Coffee</h1>
<nav>
<ul>
<li><a href="#ipv4">IPs</a></li>
<li><a href="#about">About</a></li>
<li><a href="#api">API</a></li>
</ul>
</nav>
</div>
</header>
<section class="hero">
<div class="container">
<h2>Discover Your IP Address Instantly</h2>
<p>Fast, reliable, and coffee-powered. Your public IP addresses displayed below:</p>
</div>
</section>
<main>
<div class="container">
<section class="ip-display">
<div class="ip-card"">
<h3>IPv4 Address</h3>
<p id="ipv4">
<iframe src="<?php echo $ipv4_endpoint; ?>" frameborder="0" width="100%" height="100%"></iframe>
</p>
</div>
<div class="ip-card">
<h3>IPv6 Address</h3>
<p id="ipv6">
<iframe src="<?php echo $ipv6_endpoint; ?>" frameborder="0" width="100%" height="100%"></iframe>
</p>
</div>
</section>
<section id="about">
<h2>About MyIP.Coffee</h2>
<p>MyIP.Coffee was brewed with the idea of providing internet users a quick way to check their public IPv4 and IPv6 addresses. Whether you're troubleshooting network issues, setting up a server, or just curious, our site serves up your IP addresses without any fuss or frills.</p>
</section>
<section id="api">
<h2>Programmatical use</h2>
<p>You can get your current IP addresses from <code>https://ipv4.myip.coffee</code> and <code>https://ipv6.myip.coffee</code>.</p>
</section>
</div>
</main>
<footer>
<div class="container">
<p>&copy; 2024 Private.coffee | <a href="https://private.coffee/privacy.html">Privacy Policy</a> | <a href="https://private.coffee/legal.html">Legal Notice</a> | <a href="https://git.private.coffee/PrivateCoffee/myip.coffee">Git</a></p>
</div>
</footer>
<script src="script.js"></script>
</body>
</html>