<?php include "../../root.class.php";
$html = new html();
$html->add_styles_page();



?>
<div class="row">
    <form class="form_down" method="POST">
        <?php
        echo $html->input_html("IP ADDRESS", "", "ip", "ip");
        echo $html->submit_btn('submit', "SEARCH", '')
            ?>
    </form>

    <div>
        <?php
        function getIpInfo($ip)
        {
            $url = "http://ip-api.com/json/{$ip}";
            $response = file_get_contents($url);
            return json_decode($response, true);
        }
        if (isset($_POST['ip'])) {
            $ip = $_POST['ip']; // Get the user's IP address
            $info = getIpInfo($ip);

            if ($info && $info['status'] == 'success') {
                echo "IP: " . $info['query'] . "<br>";
                echo "Country: " . $info['country'] . "<br>";
                echo "Region: " . $info['regionName'] . "<br>";
                echo "City: " . $info['city'] . "<br>";
                echo "ISP: " . $info['isp'] . "<br>";
            } else {
                echo "Unable to retrieve IP information.";
            }
        }
        ?>
    </div>
</div>