host_info; } public function getClientIP(): string { $xff = $_SERVER['HTTP_X_FORWARDED_FOR'] ?? null; if ($xff) { $ips = array_map('trim', explode(',', $xff)); $clientIp = $ips[0]; return $clientIp; } else { return $_SERVER['REMOTE_ADDR']; } } public function getRequestTime(): string { date_default_timezone_set('Europe/Berlin'); $timestamp = $_SERVER['REQUEST_TIME'] ?? time(); return date('Y-m-d H:i:s', $timestamp); } function getGeoIP($ClientIP) { $response = file_get_contents("http://ip-api.com/json/{$ClientIP}?fields=country,countryCode"); $data = json_decode($response); return $data->country; } function getWhitelistedIPs() { include_once 'DatabaseController.php'; $data = DatabaseShow( "Whitelisted", "`IP-ADDRESSE`" ); $results = []; foreach ($data as $row) { $results[] =$row['IP-ADDRESSE']; } return $results; } function getServerNode($ServerIP) { $nodes = [ 'node1' => '172.30.0.11', 'node2' => '172.30.0.12', 'node3' => '172.30.0.13', 'node4' => '172.30.0.14', ]; foreach ($nodes as $node => $ip) { if ($ServerIP == $ip) { // $ServerIP = $node; return $node; break; } } } function getClientStatus($ClientIP) { if (in_array($ClientIP, $this->getWhitelistedIPs())) { return "Trusted"; } return "Untrusted"; } public function getAllData(): array { return [ 'Document-Root' => $this->getDocumentRoot(), 'CurrentDir' => $this->getCurrentDir(), 'SERVER-IP' => $this->getServerIP(), 'Node' => $this->getServerNode($this->getServerIP()), 'Server-Port' => $this->getServerPort(), 'Server-Name' => $this->getServerName(), 'Client-IP' => $this->getClientIP(), 'Client-Port' => $this->getClientPort(), 'User-Agent' => $this->getUserAgent(), 'Request URL' => $this->getRequestURL(), 'Cookie' => $this->getCookie('USER'), 'Server Cookie' => $this->getCookie('SESSSRV'), 'Session' => $this->getSessionID(), 'Query' => $this->getQuery(), 'Request-Method' => $this->getRequestMethod(), 'Request-Time' => $this->getRequestTime(), 'Unix-timestamp' => $this->getRequestTimeFloat(), 'Land' => $this->getGeoIP($this->getClientIP()), 'Database' => $this->getDatabase(), 'Whitelisted Status' => $this->getClientStatus($this->getClientIP()), 'Whitelisted IPs' => $this->getWhitelistedIPs(), ]; } public function ShowAllData(): void { $SpecificData = (new getSpecificData())->getAllData(); echo "
";
print_r($SpecificData);
echo "";
}
}
// $ShowAllDAta = (new getSpecificData())->ShowAllData();