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/web19/web/classes/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/clients/client2/web19/web/classes/geo.class.php
<?php

class geo {
    public $aGEOdata;
    public $city;
    private $db;
    private $aConfig;
    
    public function __construct($ip_address = FALSE) {
        
        // API Daten
        $this->aConfig = array(
            'user' => "119292",
            'pass' => "uHZ8ht6T6LF6"
        );
        
        // MySQL Verbindung
        $this->db = $oMySQL = new MySQL(DB_NAME, DB_USER, DB_PASSWORD);
        
        // GEO Daten aus Session holen
        if(isset($_SESSION['geo_collection'])) {
            $this->city = $_SESSION['geo_collection']['city'];
            $this->aGEOdata = array(
                'city' => array(
                    'name' => $_SESSION['geo_collection']['city']
                ),
                'coordinates' => array(
                    'latitude' => $_SESSION['geo_collection']['latitude'],
                    'longitude' => $_SESSION['geo_collection']['longitude']
                )
            );
        } else {
            // GEO Daten durch IP des Besuchers o. alternativ Eingabe ermitteln
            $this->aGEOdata = $this->getGeoByIP(($ip_address ? $ip_address : $_SERVER['REMOTE_ADDR']));
            
            //$this->getFullRequest(($ip_address ? $ip_address : $_SERVER['REMOTE_ADDR']));
        }
    }
    
    private function getGeoByIP($sIP) {
        $sFile = file_get_contents('http://api.ipinfodb.com/v3/ip-city/?key=e6de2ab116a66d3d0885115ea782a032dcc7b14c322c7a89e190885d7cdc16b9&ip=' . $sIP);
        
        $aFile = explode(';', $sFile);
        
        // GEO Informationen aus der Datenbank abrufen
        $aGEOdata = $this->getGeoInformation($aFile[8], $aFile[9]);
        
        $sCountry = str_replace('Germany', 'Deutschland', $aFile[4]);
        
        $aCollect = array(
            'ip' => array(
                'address' => $aFile[2],
                'return' => (!empty($sIP) ? $aFile[2] : '-')
            ),
            'country' => array(
                'name' => $sCountry,
                'code' => $aFile[3]
            ),
            'state' => array(
                'name' => (!empty($aGEOdata['state']) ? $aGEOdata['state'] : $aFile[4]),
                'code' => $aFile[3]
            ),
            'city' => array(
                'zipcode' => $aFile[7],
                'name' => ($aFile[3] == "DE" || $aFile[3] == "AT" || $aFile[3] == "CH" ? $aGEOdata['geo_city'] : $aFile[6]),
                'return' => (!empty($aFile[6]) ? $aFile[7] . ' ' . ($aFile[3] == "DE" || $aFile[3] == "AT" || $aFile[3] == "CH" ? $aGEOdata['geo_city'] : $aFile[6]) . '<br>' . ($aFile[3] == "DE" || $aFile[3] == "AT" ? $aGEOdata['state'] . ' in ' : FALSE) . $sCountry :
                            '-')
            ),
            'coordinates' => array(
                'latitude' => $aFile[8],
                'longitude' => $aFile[9],
                'return' => ($aFile[8] != "0" && $aFile[9] != "0" ? $aFile[8] . ', ' . $aFile[9] :
                            'nicht gefunden')
            ),
            'time' => array(
                'zone' => $aFile[10],
                'return' => (!empty($aFile[6]) ? $aFile[10] . ' UTC' :
                            '-')
            )
        );
        
        return $aCollect;
    }
    
    private function getGeoInformation($latitude, $longitude) {
        
        $aGEO = $this->db->ExecuteSQL('
                    SELECT
                        l.id as geo_id,
                        l.breite as geo_latitude,
                        l.laenge as geo_longitude,
                        l.ort as geo_city,
                        (
                            6371 * acos(
                                cos(
                                    radians( ' . $latitude . ' )
                                ) * cos(
                                    radians( l.breite )
                                ) * cos(
                                    radians( l.laenge ) - radians( ' . $longitude . ' )
                                ) + sin(
                                    radians( ' . $latitude . ' )
                                ) * sin(
                                    radians( l.breite )
                                )
                            )
                        ) AS distance,
                        a.adm0 as country_code,
                        a.name as state,
                        a.adm1 as state_code
                        FROM geodb_locations l
                        LEFT JOIN
                            geodb_adm1 a
                            ON l.adm0 = a.adm0
                            AND l.adm1 = a.adm1
                        ORDER by distance ASC
                        LIMIT 1
        ');

        return $aGEO[0];
    }
    
    private function makeAPIcall($ip_address) {
        $url = 'https://geoip.maxmind.com/geoip/v2.1/insights/' . trim($ip_address);
        $ch = curl_init($url);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
        curl_setopt($ch,CURLOPT_HEADER, FALSE);
        curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
        curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
        curl_setopt($ch, CURLOPT_USERPWD, $this->aConfig['user'] . ':' . $this->aConfig['pass']);
        $output = curl_exec($ch);
        
        return json_decode($output);
    }
    
    private function getFullRequest($ip_address) {
        
        // MaxMind API aufrufen
        $oReturn = $this->makeAPIcall($ip_address);
        
        // Falls nicht gefunden, einfach zweites Netzwerk nutzen
        if(is_null($oReturn->traits->ip_address)) {
            $ip_scan = $this->getGeoByIP($ip_address);
            $oReturn = $this->makeAPIcall($ip_scan['ip']['address']);
        }
        
        // GEO Informationen aus der Datenbank abrufen
        $aGEOdata = (!empty($oReturn->location->latitude) ? $this->getGeoInformation($oReturn->location->latitude, $oReturn->location->longitude) : FALSE);
        
        $sCityName = (!empty($oReturn->city->names->de) ? $oReturn->city->names->de : $oReturn->city->names->en);
        $sCityName = (empty($sCityName) && isset($ip_scan['city']['name']) ? $ip_scan['city']['name'] : $sCityName);
        
        $iZipcode = (empty($oReturn->postal->code) && !empty($ip_scan['city']['zipcode']) ? $ip_scan['city']['zipcode'] : FALSE);
        
        $this->aGEOdata = array(
            'ip' => array(
                'address' => $oReturn->traits->ip_address,
                'isp' => $oReturn->traits->isp,
                'user_type' => $oReturn->traits->user_type,
                'return' => (!empty($oReturn->traits->ip_address) ? $oReturn->traits->ip_address : $ip_address)
            ),
            'country' => array(
                'name' => $oReturn->country->names->de,
                'code' => $oReturn->country->iso_code
            ),
            'city' => array(
                'zipcode' => $iZipcode,
                'name' => $sCityName,
                'return' => (!empty($sCityName) ? $iZipcode . ' ' . ($oReturn->country->iso_code == "DE" || $oReturn->country->iso_code == "AT" || $oReturn->country->iso_code == "CH" ? $aGEOdata['geo_city'] : $sCityName) . '<br>' . ($oReturn->country->iso_code == "DE" || $oReturn->country->iso_code == "AT" || $oReturn->country->iso_code == "CH" ? $aGEOdata['state'] . ' in ' : FALSE) . $oReturn->country->names->de :
                            '-')
            ),
            'coordinates' => array(
                'latitude' => $oReturn->location->latitude,
                'longitude' => $oReturn->location->longitude,
                'return' => (!empty($oReturn->location->latitude) ? $oReturn->location->latitude . ', ' . $oReturn->location->longitude :
                            'nicht gefunden')
            ),
            'time' => array(
                'zone' => $oReturn->location->time_zone,
                'return' => (!empty($oReturn->location->time_zone) ? $oReturn->location->time_zone :
                            '-')
            ),
            'query' => $oReturn,
            'misc' => $this->aConfig
        );
    }
}

Youez - 2016 - github.com/yon3zu
LinuXploit