403Webshell
Server IP : 202.61.199.114  /  Your IP : 216.73.217.139
Web Server : nginx/1.22.1
System : Linux de.arni-solutions.de 6.1.0-49-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.174-1 (2026-05-26) x86_64
User : web20 ( 1018)
PHP Version : 8.4.23
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /var/www/clients/client2/web21/web/api/lib/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/clients/client2/web21/web/api/lib/geo.php
<?php
/**
 * Zusätzliche Geo-/Netz-Anreicherung über kostenlose APIs (ip-api.com, keyless).
 * Liefert Region/PLZ/Zeitzone/ISP sowie Proxy-/VPN-/Mobil-/Hosting-Signale.
 *
 * Hinweis Datenschutz: ip-api.com ist ein externer Dienst. Die Abfrage erfolgt
 * serverseitig (die Besucher-IP wird nur bei „Meine IP" übermittelt) und wird
 * gecacht. Deaktivierbar über die Admin-Einstellung (Modul „geo").
 *
 * @package SafeMyIdent\Api
 */

declare(strict_types=1);

require_once __DIR__ . '/net.php';
require_once __DIR__ . '/ipintel.php';

/**
 * ip-api.com Abfrage – wahlweise DIREKT (US) oder über den Gateway-Proxy
 * (VPN-Egress, DSGVO-freundlich). Steuerung über Config:
 *   intel.enabled + ipapi_via_gateway → über Gateway
 *   sonst ipapi_direct               → direkt
 *   sonst                            → aus (nur RIPEstat).
 *
 * @param string $ip   IP.
 * @param string $lang Sprache (de|en).
 * @return array<string,mixed> Leeres Array bei Fehler/aus.
 */
function smi_ipapi(string $ip, string $lang = 'de'): array
{
    if (!smi_ip_is_public($ip)) {
        return [];
    }
    $cfg        = smi_config();
    $viaGateway = !empty($cfg['ipapi_via_gateway']) && smi_intel_enabled();
    $direct     = !empty($cfg['ipapi_direct']);
    if (!$viaGateway && !$direct) {
        return []; // ip-api komplett deaktiviert.
    }

    $mode = $viaGateway ? 'gw' : 'direct';
    $key  = 'ipapi|' . $mode . '|' . $ip . '|' . $lang;
    $hit  = smi_cache_get($key);
    if ($hit !== null) {
        return is_array($hit) ? $hit : [];
    }

    $fields = 'status,message,continent,country,countryCode,region,regionName,city,district,zip,lat,lon,timezone,offset,currency,isp,org,as,asname,reverse,mobile,proxy,hosting,query';
    $url = 'http://ip-api.com/json/' . rawurlencode($ip) . '?fields=' . $fields . '&lang=' . ($lang === 'en' ? 'en' : 'de');

    $body = $viaGateway ? smi_gateway_fetch($url) : smi_provider_get($url, 5);
    $out  = [];
    if ($body !== '') {
        $d = json_decode($body, true);
        if (is_array($d) && ($d['status'] ?? '') === 'success') {
            $out = $d;
        }
    }
    smi_cache_set($key, $out, (int) ($cfg['cache_ttl'] ?? 900));
    return $out;
}

Youez - 2016 - github.com/yon3zu
LinuXploit