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.
This commit is contained in:
Kumi 2024-09-18 10:00:03 +02:00
parent 14b7d088a0
commit dc49da70d3
Signed by: kumi
GPG key ID: ECBCC9082395383F

View file

@ -1,3 +1,10 @@
<?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>
@ -30,11 +37,15 @@
<section class="ip-display">
<div class="ip-card"">
<h3>IPv4 Address</h3>
<p id="ipv4">Loading...</p>
<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">Loading...</p>
<p id="ipv6">
<iframe src="<?php echo $ipv6_endpoint; ?>" frameborder="0" width="100%" height="100%"></iframe>
</p>
</div>
</section>
<section id="about">