
<!DOCTYPE html>
<html lang="pl">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Twoje IP i lokalizacja</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            display: flex;
            justify-content: center;
            align-items: center;
            height: 100vh;
            background-color: #121212;
            color: #ffffff;
        }
        .container {
            text-align: center;
            background: #1e1e1e;
            padding: 20px;
            border-radius: 10px;
            box-shadow: 0 0 10px rgba(255, 255, 255, 0.1);
        }
    </style>
</head>
<body>
    <div class="container">
        <h1>Twoje IP:</h1>
        <p id="ip">Ładowanie...</p>
        <h2>Lokalizacja:</h2>
        <p id="country">Ładowanie...</p>
        <p id="city">Ładowanie...</p>
        <p id="region">Ładowanie...</p>
        <p id="latitude">Ładowanie...</p>
        <p id="longitude">Ładowanie...</p>
        <p id="isp">Ładowanie...</p>
    </div>
    
    <script>
        fetch('https://api64.ipify.org?format=json')
            .then(response => response.json())
            .then(data => {
                document.getElementById('ip').textContent = data.ip;
                return fetch(`http://ip-api.com/json/${data.ip}`);
            })
            .then(response => response.json())
            .then(locationData => {
                document.getElementById('country').textContent = `Kraj: ${locationData.country}`;
                document.getElementById('city').textContent = `Miasto: ${locationData.city}`;
                document.getElementById('region').textContent = `Region: ${locationData.regionName}`;
                document.getElementById('latitude').textContent = `Szerokość: ${locationData.lat}`;
                document.getElementById('longitude').textContent = `Długość: ${locationData.lon}`;
                document.getElementById('isp').textContent = `Dostawca: ${locationData.isp}`;
            })
            .catch(error => {
                document.getElementById('country').textContent = 'Nie udało się pobrać lokalizacji';
                document.getElementById('city').textContent = '';
                document.getElementById('region').textContent = '';
                document.getElementById('latitude').textContent = '';
                document.getElementById('longitude').textContent = '';
                document.getElementById('isp').textContent = '';
                console.error('Błąd:', error);
            });
    </script>
</body>
</html>